Source-linked AI summary
NetKet: A Machine Learning Toolkit for Many-Body Quantum Systems
Giuseppe Carleo, Kenny Choo, Damian Hofmann, James E. T. Smith, Tom Westerhout, Fabien Alet, Emily J. Davis, Stavros Efthymiou, Ivan Glasser, Sheng-Hsuan Lin, Marta Mauri, Guglielmo Mazzola, Christian B. Mendl, Evert van Nieuwenburg, Ossian O'Reilly, Hugo Théveniaut, Giacomo Torlai, Alexander Wietek
TL;DR
Many-body quantum machine-learning research needs accessible, comprehensive tools for representing and studying complex quantum states. NetKet provides an open-source Python/C++11 framework centered on neural-network variational states, with workflows for customizable lattice models, supervised learning, tomography, and ground-state searches. Demonstrations include convergence to an exact Heisenberg ground-state energy with relative error 4.16 × 10^-5 within 200 iterations.
Problem
Many-body quantum machine-learning methods need comprehensive, easy-to-use tools that make technically demanding neural-network quantum-state research accessible and reproducible.
Method
NetKet combines neural-network variational wavefunctions with customizable lattice-model specification and drivers for supervised learning, tomography, and variational optimization.
Results
4.16 × 10^-5 relative error was achieved for the Heisenberg-model Monte Carlo energy estimate relative to the exact ground-state energy within 200 iteration steps.
Takeaways & Limitations
NetKet provides a common open-source platform intended to support accessible research, reproducibility, and collaborative development in machine learning for many-body quantum physics.
Abstract
from arXiv · showhide
We introduce NetKet, a comprehensive open source framework for the study of many-body quantum systems using machine learning techniques. The framework is built around a general and flexible implementation of neural-network quantum states, which are used as a variational ansatz for quantum wave functions. NetKet provides algorithms for several key tasks in quantum many-body physics and quantum technology, namely quantum state tomography, supervised learning from wave-function data, and ground state searches for a wide range of customizable lattice models. Our aim is to provide a common platform for open research and to stimulate the collaborative development of computational methods at the interface of machine learning and many-body physics.
I. MOTIVATION AND SIGNIFICANCE
NetKet addresses the growing need for accessible, comprehensive tools for machine-learning research in many-body quantum physics. It combines a Python interface, C++11 core, modular functionality, and educational resources to support research and reproducibility.
- Motivation and significance: Neural-network quantum states support supervised learning, quantum state tomography, ground- and excited-state searches, and many-body dynamics.These applications motivate a common toolkit for machine-learning approaches to many-body quantum physics.
- Motivation and significance: NetKet provides flexible primitives for developing machine-learning applications and aims to bridge technically demanding methods with newcomers through tutorials.The project also supports open development and reproducibility by providing common tools for certifying and reproducing published results.
- Software architecture: NetKet exposes high-level functionality through a Python interface while retaining a C++11 core for performance and library extension.Users are encouraged to build research applications through Python, whereas extending the library itself involves modifying the C++ code.
- Software architecture: The graph, hilbert, and operator modules specify quantum-system structure, Hamiltonians, and observables.The machine, variational, supervised, and unsupervised modules provide wavefunction representations and drivers for optimization, supervised learning, and tomography.
- Software architecture: NetKet includes exact diagonalization and imaginary-time propagation for benchmarking and exploring small systems.Its utility modules support internal output and statistics, while MPI parallelizes Monte Carlo sampling across independent samples.
B. Software functionalities
NetKet’s software functionality centers on neural-network variational states, customizable lattice models, and loss-based optimization. Its model specification supports predefined and arbitrary graph structures and Hamiltonians.
- Software functionalities: NetKet represents quantum states with artificial neural networks and optimizes their parameters against losses such as energy or target-state overlap.The framework provides models, variational wavefunctions, and learning schemes for these tasks.
- Model specification: Lattice models use finite local Hilbert spaces and a graph whose sites and edges encode the system’s spatial structure.This graph structure also supports spatially structured models such as convolutional neural networks.
- Model specification: NetKet provides Hypercube and Lattice graphs, while CustomGraph supports arbitrary edge-colored graphs for distinguishing bond types.The graph representation is used to define lattice operators and encode spatial relationships.
- Model specification: Predefined spin and bosonic Hamiltonians are available, and GraphOperator constructs custom lattice Hamiltonians from 1-local site and 2-local bond operators.The bond operators can be selected by edge color.
2. Variational quantum states
NetKet uses compact variational wavefunctions to approximate relevant many-body states, offering neural-network, Jastrow, and matrix-product-state representations. Its neural-network options include complex RBMs and feed-forward networks with multiple architectural components.
- Variational quantum states: Variational states provide compact, computationally efficient representations that target the physically relevant subset of the full many-body Hilbert space.The ansatz should capture the relevant physical states for a given problem.
- Variational quantum states: NetKet’s machine module supports neural-network quantum states, Jastrow wavefunctions, and matrix-product states.These alternatives allow comparisons with results obtained using traditional variational approaches.
- Neural-network architectures: The main neural-network types are restricted Boltzmann machines and feed-forward neural networks, both with complex-valued parameters and outputs.RBM variants include symmetric models for lattice symmetries and multi-valued models for larger local Hilbert spaces.
- Neural-network architectures: Feed-forward networks comprise sequences of affine and nonlinear layers, including dense maps y = Wx + b and convolutional layers for hypercubic lattices.Available activations include ReLU, Tanh, and Lncosh.
- Variational quantum states: Custom wavefunctions can be added by implementing subclasses of the AbstractMachine class in C++.
3. Supervised learning
NetKet’s supervised-learning module fits a variational wavefunction to a supplied target state by minimizing a negative-log-overlap loss. Monte Carlo sampling estimates the loss, and gradient-based optimizers update the ansatz parameters.
- Supervised learning: Supervised learning optimizes a chosen variational ansatz to represent a given target wavefunction.This functionality is provided by NetKet’s supervised module.
- Supervised learning: The negative log overlap between the neural-network state and target state is used as the loss function.
- Supervised learning: Monte Carlo sampling directly from the target wavefunction is used to compute the loss and its parameter gradient.
- Supervised learning: NetKet updates parameters with gradient-based optimizers including SGD, AdaGrad, AdaMax, AdaDelta, AMSGrad, and RMSProp.The optimizer module contains the supported update rules.
4. Unsupervised learning
NetKet supports unsupervised quantum-state reconstruction from projective measurement data and illustrates related learning workflows with neural-network states.
- Quantum state tomography: NetKet reconstructs unknown quantum states by training a neural network on projective measurement data.The unsupervised.Qsr class implements this functionality.
- Quantum state tomography: The target-state dataset contains measurements in different bases, with probabilities determined by the target wavefunction.Basis-changing samples require an appropriate unitary transformation before evaluation by the neural-network state.
- Quantum state tomography: Training minimizes the statistical divergence between measurement outcomes and the distribution generated by the neural-network state.Up to a constant dataset-entropy term, this is equivalent to maximizing the network log-likelihood.
- Learning procedure: The network-distribution expectation required for log-likelihood gradients is estimated by Monte Carlo sampling from a Markov chain.Expectations over training data are direct, whereas expectations over π(σ) require sampling.
5. Variational Monte Carlo
NetKet’s variational Monte Carlo driver optimizes parameterized wavefunctions by minimizing energy estimated from sampled configurations, with gradient-based updates and configurable logging.
- Ground-state search: NetKet’s variational.Vmc driver minimizes the energy of a parameterized wavefunction for a specified Hamiltonian.It combines a Hamiltonian, sampler, and optimizer.
- Stochastic estimation: The energy estimate is a stochastic expectation over configurations sampled from the wavefunction’s probability distribution.The sampler uses Metropolis Markov chains, with parallel tempering available to improve sampling efficiency.
- Optimization: Energy gradients can be estimated alongside the energy and used in gradient-based parameter optimization.RBM derivatives are analytic, while multilayer feed-forward networks can use backpropagation.
- Output: Optimization runs can log acceptance rates, energy, variance, observables, and current variational parameters in JSON format.The same information can also be accessed directly within the Python simulation loop.
III. ILLUSTRATIVE EXAMPLES
NetKet is distributed as a Python package and also offers BinderHub deployment, supporting local installation or browser-based execution of tutorials and small jobs.
- Installation: NetKet is available through the Python Package Index as a Python package.Installation requires a properly configured Python environment.
- Installation: A working MPI environment is required to run NetKet.When multiple MPI installations exist, the recommended installation uses the desired MPI environment to select the correct compiler.
- Installation: After installation, the NetKet module can be imported into Python scripts.The build should use the intended MPI environment when multiple installations are present.
- Alternative access: BinderHub deployment provides a stable browser-accessible version for tutorials and other small jobs without local installation.The deployment is hosted through mybinder.org.
A. One-dimensional Heisenberg model
The example obtains a variational restricted Boltzmann machine representation of the one-dimensional spin-1/2 Heisenberg ground state and demonstrates rapid energy convergence.
- Convergence: For 20 sites and 20 hidden units, the energy converges to a relative error of about 10^-5.The convergence is reported for the restricted Boltzmann machine optimization.
- Convergence: The optimization reaches this convergence within about 100 iteration steps.This is the reported iteration count for the small-chain example.
B. Supervised learning
NetKet’s supervised-learning module trains an RBM to represent a known ground state, using exact diagonalization data and overlap minimization.
- The exact ground state is obtained by exact diagonalization and used to train an RBM representation.The resulting training data consist of the known ground-state wavefunction.
- Training minimizes the overlap loss between the RBM state and the target ground state.
- The evolution of the overlap during training is tracked across iterations.
IV. IMPACT
NetKet is presented as an accessible, extensible platform for ML research in quantum many-body physics, combining pedagogical resources with tools for theoretical and experimental applications.
- The example workflow defines a one-dimensional periodic chain, a restricted spin Hilbert space, and a Heisenberg Hamiltonian.
- NetKet targets questions about NQS expressibility, experimental-state learnability, and ground-state searches for k-local Hamiltonians.
- The project lowers implementation and testing costs by providing easy-to-extend tools for NQS-based applications.
- Pedagogical tutorials and step-by-step explanations make NetKet suitable for students, schools, and lectures.
V. CONCLUSIONS AND FUTURE DIRECTIONS
NetKet provides an open-source Python framework for neural-network representations of many-body wavefunctions, with examples and tutorials for newcomers. Future development is intended to add broader framework integrations and quantum-state capabilities.
- NetKet is an open-source framework implemented in C++11 with a Python interface, designed for efficiency and ease of use.
- Examples, tutorials, and notebooks are provided to reduce the learning curve for newcomers.
- NetKet is intended to evolve through user contributions and may add interfaces to PyTorch and TensorFlow.
- The supervised-learning example obtains a transverse-field Ising ground state by exact diagonalization and trains an RBM for 2000 iterations using overlap loss.
- The example uses a 20-hidden-unit RBM ansatz in NetKet’s supervised-learning module.
- Future algorithmic goals include incorporating unitary dynamics and supporting neural density matrices.