Walking the Hypercube: Unbiased Quantum Partition Functions Without the Matrix

Kumar Avinava Dubey, Arijit Sehanobish, Krzysztof Marcin ChoromanskiNeurIPS 2026

TL;DR

Calculating the thermodynamic properties of a quantum system usually requires building a matrix that doubles in size with every single particle—meaning a 50-spin system would require more memory than exists on Earth. The authors introduce a clever random-walk algorithm that estimates these quantum properties with zero approximation bias and without ever building the matrix. By treating the exponentially vast quantum state space like an implicit roadmap generated on the fly, they simulate 50-particle systems on just ~620 MB of RAM.

What Problem Does This Paper Address?

In statistical physics and quantum chemistry, the "holy grail" quantity is the partition function, $\mathcal{Z} = \mathrm{tr}(e^{-\beta H})$, where $H$ is the Hamiltonian matrix describing the energy of the system and $\beta$ is inverse temperature. If you know $\mathcal{Z}$, you can unlock all of a system's thermodynamic secrets.

Here is the catch: for a system of $n$ quantum spins, $H$ lives in a space of dimension $N = 2^n$. Storing $H$ takes $\mathcal{O}(4^n)$ memory, and computing its matrix exponential exactly takes $\mathcal{O}(8^n)$ time. By the time you hit $n = 16$ spins, exact methods crash a 32 GB machine with Out-Of-Memory (OOM) errors. Existing workarounds like Quantum Monte Carlo (QMC) or Tensor Networks either introduce approximation errors, struggle in higher dimensions, or break down completely on "frustrated" systems (where competing magnetic interactions prevent spins from settling neatly).

Methods

The authors introduce the Hypercube Walk Estimator (HWE), which fuses two established mathematical tools—Hutchinson’s trace estimator (using random $\pm 1$ vectors to estimate matrix traces) and Graph Random Features (GRFs) (using random walks on graphs to estimate matrix power series)—with a novel, zero-memory execution trick.

Standard GRF and Hutchinson methods still require storing the matrix or performing $\mathcal{O}(4^n)$ matrix-vector multiplications. The authors bypass this by splitting the Hamiltonian into classical spin-spin interactions (diagonal $D$) and quantum fluctuations (off-diagonal $M$).

  • Dynamic Topology: For many spin models, $M$ maps out an $n$-dimensional hypercube where every spin configuration is a corner, and flipping a spin walks along an edge. Instead of storing a $2^n \times 2^n$ graph, HWE generates neighbors on the fly in $\mathcal{O}(n)$ time using simple bit-flips.
  • Incremental Updates: Rather than recalculating a state's energy from scratch at every step, HWE tracks local magnetic fields and updates only the neighbors of the flipped spin, costing $\mathcal{O}(d)$ (where $d$ is the average connections per spin).
  • Two-Walk Estimator: By rewriting $e^{-\beta H} = (e^{-\frac{\beta}{2}H})^2$, HWE runs pairs of independent random walks from sampled starting states and projects them onto random Rademacher probes, yielding a provably unbiased estimate of $\mathcal{Z}$ in $\mathcal{O}(n + d)$ time per step.

Datasets

Because this is a physics simulation paper rather than a data-driven machine learning paper, there are no training datasets. Instead, the authors evaluate HWE on three canonical synthetic quantum spin Hamiltonians:

  1. Transverse Field Ising Model (TFIM): A sparse 1D chain modeling quantum phase transitions.
  2. Sherrington-Kirkpatrick (SK) Model: A dense, all-to-all randomly coupled spin glass model (heavily frustrated).
  3. XXZ Model: An anisotropic spin model on a random sparse graph whose symmetry restricts moves to two-spin swaps rather than hypercube bit-flips.

Key Insights and Ideas

  • Trading Impossible Space for Parallelizable Time: Computing partition functions is fundamentally #P-hard—there is no magic wand to erase exponential complexity. However, exact methods hit a hard brick wall of $\mathcal{O}(4^n)$ memory. HWE shifts that exponential cost entirely into sample variance (time), which can be beaten down with parallel computing.
  • Embarrassingly Parallel Quantum Physics: Because every random walk and Hutchinson probe is completely independent, you can throw as many CPU cores at the problem as you have, achieving near-linear speedups without cross-worker communication bottlenecks.
  • Beyond Hypercubes: Even when physical symmetries break the hypercube structure (as in the XXZ model, where magnetization is conserved), the core philosophy holds: generate valid two-spin swaps dynamically in $\mathcal{O}(n^2)$ and update energies locally.

Key Results

Comparison of relative error across system sizes for TFIM, SK, and XXZ models at high and low temperatures.

Figure 1: Relative Error across System Sizes. A comparison of trace estimators on the TFIM, SK, and XXZ models at high (β = 0.4, top) and low (β = 1.0, bottom) temperatures. Methods exceeding a 40% error threshold are strictly labeled as FAIL, while those exceeding available memory (32 GB) at n = 16 are labeled OOM. At low temperatures, MFT fails to capture critical quantum fluctuations, QMC performs well for TFIM but poorly for rest of the evaluations, and HTSE mathematically diverge with increasing n even though they are the most accurate at smaller values of n.
  • Accuracy vs. Baselines: As shown above, matrix-based High-Temperature Series Expansions (HTSE) hit OOM limits before $n=16$ and diverge at lower temperatures ($\beta = 1.0$). Mean-Field Theory (MFT) and QMC frequently fail (>40% error) on frustrated SK and XXZ models, whereas HWE maintains bounded, stable relative errors across all three.
  • Massive Scaling in Tiny Memory: HWE scaled the TFIM benchmark up to $n = 50$ spins—a Hilbert space of $2^{50} \approx 10^{15}$ dimensions—in ~8.5 minutes on 64 cores while using a flat ~620 MB of RAM.
  • Speed & Parallelism: At $n=14$, Exact Diagonalization took 106 minutes, while HWE finished in 49 minutes. Across 32 workers, HWE achieved a 25.12$\times$ speedup.
Figure 3: Hyperparameter ablation for HWE. Mean relative error and variance (shaded) decrease monotonically with respect to the number of walks, Hutchinson probes, and source nodes across varying system sizes.
  • Tunable Precision: Increasing walks, Hutchinson probes, or source nodes monotonically shrinks both error and variance.

Limitations and Future Work

HWE does not escape the notorious quantum sign problem. In frustrated systems at low temperatures (large $\beta$), rapid positive-and-negative sign flips along random walk paths cause the estimator's variance to explode exponentially, requiring an impractical number of samples to converge (though it degrades gracefully at moderate temperatures like $\beta \le 0.5$). Future directions are not explicitly discussed in the paper.

Summary updated

Abstract

Computing the partition function $\mathcal{Z} = \mathrm{tr}(e^{-\beta H})$ of a quantum spin Hamiltonian $H$ on $n$ sites is a fundamental problem in statistical physics and quantum chemistry. However exact evaluation requires $O(8^n)$ time and $O(4^n)$ memory making it intractable for all but the smallest systems. We propose an unbiased stochastic estimator of $\mathcal{Z}$, and more generally of $\mathrm{tr}(f(H))$ for any function $f$ admitting a convergent power series over exponentially large, implicitly defined operators using only local random walks, avoiding both matrix materialization and matrix-vector products. Our approach combines Graph Random Features with the Hutchinson's stochastic trace estimator, and exploits the algebraic structure of quantum spin Hamiltonians to reduce the per-step computational cost to $O(n + d)$, where $d$ is the mean degree of the spin coupling graph, independent of the Hilbert space dimension $N = 2^n$. We validate the estimator empirically against exact matrix exponentiation for small system sizes, and demonstrate its applicability to system sizes where exact methods are infeasible.
BibTeX
@inproceedings{dubey2026walking,
  author = {Kumar Avinava Dubey and Arijit Sehanobish and Krzysztof Marcin Choromanski},
  title = {{Walking the Hypercube: Unbiased Quantum Partition Functions Without the Matrix}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=wLHljLWRDA},
}
Figure