Skip to content
QFT.org

Search QFT.org

Enter a word or phrase.

    You can also browse the main navigation and chapter contents.

    Benchmarking Learned Lattice Samplers

    Does a learned lattice proposal reduce the cost of estimating a physical observable after training, correction and uncertainty are included? We train and test a small autoregressive model against an exactly enumerable Ising target. The comparison measures both a fast even observable and the much slower magnetization mode; their effective sample counts differ dramatically for the conventional chain.

    Preparation: corrected learned proposals, autocorrelation errors and learned-sampling scaling.

    Fix the target and disclose the training oracle

    Use a periodic 4×44\times4 classical Ising lattice with spins si=±1s_i=\pm1, nearest-neighbor energy

    E(s)=−∑⟨ij⟩sisj,p(s)=Z−1e−βE(s),β=0.5.E(s)=-\sum_{\langle ij\rangle}s_is_j, \qquad p(s)=Z^{-1}e^{-\beta E(s)},\qquad \beta=0.5.

    Each of the 3232 spatial bonds is counted once. Coupling and Boltzmann constant are one. The measured observables are energy per site e=E/16e=E/16, magnetization m=16−1∑isim=16^{-1}\sum_i s_i and m2m^2. Enumerating all 65 53665\,536 states gives

    ⟨e⟩=−1.75538029,⟨m⟩=0,⟨m2⟩=0.86892168.\langle e\rangle=-1.75538029,\qquad \langle m\rangle=0,\qquad \langle m^2\rangle=0.86892168.

    In a fixed site ordering, the learned model is

    qθ(s)=∏i=11611+exp⁡[−sihi(s<i)],hi=∑j<iWijsj.q_\theta(s)=\prod_{i=1}^{16} \frac{1}{1+\exp[-s_i h_i(s_{<i})]}, \qquad h_i=\sum_{j<i}W_{ij}s_j.

    Zero biases impose global spin-flip symmetry. Finite weights give full support, and ancestral sampling generates independent draws from qθq_\theta. We fit each conditional by minimizing the exact target-weighted negative log likelihood. The 120120 trainable weights use an enumerated training oracle. This is a controlled method comparison, not a scalable data-free training scheme or a reproduction of a published scalar normalizing-flow benchmark.

    Correct the proposal and test the correction

    An independent proposed state s′s' is accepted with probability

    A(s→s′)=min⁡[1,e−βE(s′)qθ(s)e−βE(s)qθ(s′)].A(s\to s')=\min\left[1, \frac{e^{-\beta E(s')}q_\theta(s)} {e^{-\beta E(s)}q_\theta(s')}\right].

    The normalization ZZ cancels. Detailed balance follows because either direction has equilibrium flow min⁡[p(s)q(s′),p(s′)q(s)]\min[p(s)q(s'),p(s')q(s)]. The normalization of qq is independently checked by exhaustive summation, and random state pairs verify the balance identity. The acceptance rule is the one in Albergo, Kanwar and Shanahan, §II.1, Eq. (6); their actual learned representation and field-theory target are different.

    The trained proposal has forward relative entropy DKL(p∥q)=0.003201D_{\rm KL}(p\Vert q)=0.003201. It is close, but its exact uncorrected means are ⟨e⟩q=−1.75222934\langle e\rangle_q=-1.75222934 and ⟨m2⟩q=0.86637067\langle m^2\rangle_q=0.86637067. More independent uncorrected samples would converge to those biased values. The corrected chain's measured acceptance is 0.96930.9693.

    Enumeration also gives a worst-case mixing check for this independent proposal. Write w=p/qw=p/q and M=max⁡sw(s)≃1.31205M=\max_s w(s)\simeq1.31205. The probability of proposing and accepting yy from xx is p(y)/max⁡(w(x),w(y))≥p(y)/Mp(y)/\max(w(x),w(y))\ge p(y)/M. Rejection adds extra probability to stay at xx. Each step therefore contains an equilibrium draw of weight at least 1/M1/M, irrespective of the initial state. After five steps the total-variation distance to pp is at most (1−1/M)5<0.00077(1-1/M)^5<0.00077. Evaluating MM used the whole finite state space. The acceptance rate by itself would not give this bound.

    Compare at the same action and with observable-specific errors

    We run 3232 independent replicas, each for 40964096 recorded steps. One learned step is one whole-configuration proposal; one local step is a sweep of 1616 random-site Metropolis proposals. Both methods begin from exact target-distributed states, intentionally removing burn-in from this finite efficiency experiment. This does not test how either method equilibrates an arbitrary initial state.

    Standard errors are estimated from the dispersion of the 3232 independent replica means, rather than treating correlated configurations as independent. They include within-replica correlation through those means, but their own precision is limited by the number of replicas.

    MethodMean energy per siteMean m2m^2Standard error of mm
    Corrected learned−1.75413±0.00120-1.75413\pm0.001200.86832±0.000710.86832\pm0.000710.00286
    Local Metropolis−1.75444±0.00195-1.75444\pm0.001950.86862±0.001160.86862\pm0.001160.04827

    All displayed means are consistent with the exact target at this precision. Local updates estimate energy reasonably while crossing between magnetization sectors much more slowly. The variance-equivalent sample count, defined as exact target variance divided by the estimated variance of the overall mean, is about 105 000105\,000 versus 40 00040\,000 for energy, but 106 000106\,000 versus 373373 for magnetization. One acceptance fraction or one effective sample count cannot characterize all observables.

    Include training and the comparison's limitations

    In the retained single-CPU run, enumeration took 0.00730.0073 seconds, training 0.8270.827 seconds, learned production 0.1520.152 seconds and local production 1.7881.788 seconds. Proposal generation, action evaluation and density evaluation are included in learned production. These are implementation-dependent timings, not portable speedup factors; the conventional comparison is random-site Metropolis, not an optimized cluster algorithm.

    Let cOc_O be production time per variance-equivalent sample for observable OO, and let T0T_0 include learned setup. A projected crossover satisfies

    Neff∗=T0cOlocal−cOlearned,N_{\rm eff}^{*}=\frac{T_0}{c_O^{\rm local}-c_O^{\rm learned}},

    when the denominator is positive and the measured cost–variance scaling remains valid. For energy, the retained values suggest a crossover near 1.9×1041.9\times10^4 effective samples. It is a conditional projection from this finite run, not a measured large-volume scaling law. Enumeration itself is exponentially costly, so this training procedure cannot establish an asymptotic advantage. Indeed, at this size enumeration already provides the answer; its role is to audit the algorithms.

    Current work also shows why constant acceptance should not be confused with constant total cost. Kanwar and Vega's 2026 diffusion/annealing study separates the number of intermediate updates, target refresh time and cost per lattice update, and measures their behavior toward the continuum. Its §V.4 is a useful template for a scaling claim, while its algorithm and models are not implemented here. arXiv:2610.35792v1.

    A useful next experiment replaces the exact training oracle with a declared finite training set, repeats training seeds and costs, and includes a cluster baseline. Increase volume along a fixed physical scaling trajectory while monitoring both magnetization sectors. Full support proves eventual correctness; it does not guarantee affordable exploration of rare important configurations.

    References

    Extract the Ising sampler, trained proposal and replica results (ZIP) and run python3 examples/research/matter-computation/sampling.py. The model, fitting residuals, exact expectations, all replica means and timings are retained. The inspected Library autoregressive density and ancestral-sampling kernels are reused with sixteen spins; its nine-spin target is not reused.

    Scrollable formula. Use Left and Right arrow keys to reveal hidden content.

    Scrollable table. Use Left and Right arrow keys to reveal hidden columns.

    Scrollable figure. Use Left and Right arrow keys to reveal hidden content.