NetKet Foundation
NetKet Foundation is an extension for NetKet to train and evaluate foundation neural quantum states over families of Hamiltonians parameterized by couplings or disorder realizations.
The library builds on top of NetKet's concepts (samplers, operators, logging, drivers) and introduces foundational workflows where one model is optimized across many parameter points at once.
Installation
You can install netket-foundation with pip or uv using one of the two commands below. We strongly recomend against using conda.
uv add netket-foundation
pip install --upgrade nektet-foundation
With GPU support (Linux only):
uv add netket-foundation 'netket[cuda]'
Development version:
uv add git+https://github.com/NeuralQXLab/netket_foundation.git
For detailed installation instructions of NetKet, including GPU setup, we refer to its installation guide.
Getting Started
To get started with NetKet Foundation, we recommend you give a look at our tutorials, by running them on your computer or on Google Colaboratory. There are also several example scripts that you can download, run and edit that showcase some use-cases of NetKet Foundation, although they are not commented.
If you want to get in touch with us, feel free to open an issue or a discussion here on GitHub, or to join the MLQuantum slack group where several people involved with NetKet hang out. The link is on NetKet's website.
New concepts:
Compared to base NetKet, this package introduces:
ParameterSpace: a Hilbert-space-like class describing the space where hamiltonian parameters live.FoundationalQuantumState: a variational state that samples physical configurations together with parameter replicas.ParametrizedOperator: operators whose matrix elements are generated from per-sample parameters.
Minimal Usage
1) Define a foundational state over a parameter range
import jax.numpy as jnp
import netket as nk
import netket_foundation as nkf
from netket_foundation._src.model.vit import ViTFNQS
hi = nk.hilbert.Spin(0.5, 10)
ps = nkf.ParameterSpace(N=1, min=0.8, max=1.2)
model = ViTFNQS(
num_layers=2,
d_model=12,
heads=4,
L_eff=hi.size // 2,
n_coups=ps.size,
b=2,
complex=False,
disorder=False,
transl_invariant=True,
two_dimensional=False,
)
sampler = nk.sampler.MetropolisLocal(hi, n_chains=2048)
vstate = nkf.FoundationalQuantumState(sampler, model, ps, n_replicas=8, seed=1)
# Define the coupling used during training
vstate.parameter_array = jnp.linspace(0.8, 1.2, vstate.n_replicas).reshape(-1, 1)
2) Build a parameter-dependent operator
import netket_foundation as nkf
def create_operator(params):
h = params[0]
ha_x = sum(nkf.operator.sigmax(hi, i) for i in range(hi.size))
ha_zz = sum(
nkf.operator.sigmaz(hi, i) @ nkf.operator.sigmaz(hi, (i + 1) % hi.size)
for i in range(hi.size)
)
return -h * ha_x - ha_zz
ham = nkf.operator.ParametrizedOperator(hi, ps, create_operator)
3) Optimize with foundational natural-gradient VMC
import optax
import netket_foundation as nkf
optimizer = optax.sgd(5e-3)
driver = nkf.VMC_SR(ham, optimizer, variational_state=vstate, diag_shift=1e-4)
driver.run(100)
Metadata
Release files for netket-foundation 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| netket_foundation-0.1.1.tar.gz | 76.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| netket_foundation-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 175.5 kB
Release files / netket_foundation-0.1.1.tar.gz
| Download URL | netket_foundation-0.1.1.tar.gz |
|---|---|
| Size | 76.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d7ff4ccc14e84369ab18ea85d4ce1ea42e7a20f65f1c76dc5fccf6771dbc7236
|
|
BLAKE2b-256 checksum How to use checksums |
9ad8e415ce90cc169cc2a5e07fd92a1182804e5f866670a2d02f2d6563ec6c60
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 11, 2026.
Transparency logRelease files / netket_foundation-0.1.1-py3-none-any.whl
| Download URL | netket_foundation-0.1.1-py3-none-any.whl |
|---|---|
| Size | 99.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
979d5ac61bca00f086db45b406095abcc2d7e15e295d601473ff43fc76d70f03
|
|
BLAKE2b-256 checksum How to use checksums |
40fa00445c2a9c7dc4bd794302fca55c77c6ea8b5cd9f78b0fe125515c08d567
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 11, 2026.
Transparency log