- Home
- Library
- Computational Quantum Field Theory
- Learning to Sample Field Configurations
- Autoregressive Field Models
Autoregressive Field Models
An autoregressive sampler can generate independent configurations and evaluate their normalized probabilities without knowing a partition function. The independence is a property of the fitted model. It does not make that model equal to the physical Gibbs measure. A nine-spin example lets us train the distribution, enumerate its remaining bias, and check exactly what a subsequent Metropolis correction changes.
Preparation: Finite Gibbs measures and the exact Ising example, likelihoods and training objectives, and corrected learned proposals.
Generate a configuration one conditional at a time
Choose an ordering of spins . The probability chain rule suggests
Each factor is normalized over its own spin for every earlier assignment. Summing over first removes the final factor; summing successively over proves . This construction is the central ingredient in Wu–Wang–Zhang, main Eq. (4), Appendix A, Eqs. (6)–(11).
A small trainable choice is a triangular logistic model,
Thus and . The logarithm of the joint density is
A stable log-sum-exp evaluates this expression without exponentiating a large logit. For finite parameters every configuration has positive probability. This is a restricted family of conditionals: exact conditionals obtained by summing over future interacting spins need not have logits linear in the earlier spins.
To sample, draw from its Bernoulli law, evaluate using that realized value, draw , and continue. New independent random numbers give a new independent model configuration. Dependence among spins within a configuration is intended. Sampling a complete configuration is sequential in this ordering, although evaluating the density of an already known configuration can calculate all logits together. A dense triangular model uses coefficients and arithmetic; neither its ordering nor its matrix automatically respects lattice translations.
Normalized-looking local factors are insufficient if they depend cyclically on future variables. For example, set and . Then
The nested normalization proof no longer applies. Our deliberate control reproduces this failure, while the actual model excludes every future-spin weight.
Train a finite physical distribution
Use the periodic ferromagnetic Ising model with coupling one and zero external field,
Each positive-coordinate bond is counted once. There are spins and configurations. Row-major site order fixes the triangular model, with nine biases and lower-triangular weights: real parameters. We use and . These are two finite systems; the calculation does not locate a thermodynamic critical point.
The exact enumeration supplies , all target moments and all model expectations. An independently assembled row-transfer matrix checks , and explicit bond loops check the energy. Full enumeration also makes training deterministic. It is exponentially expensive in and is used here to expose the approximation, not presented as a scalable replacement for simulation.
Two losses ask different approximation questions. The forward divergence is
Its parameter-dependent part is the target-weighted cross entropy . For the triangular logistic architecture this is a sum of convex logistic-regression losses. It requires the exact target weights in this example.
The reverse divergence instead satisfies
Define and . Then
The expectation is a variational upper bound. A finite Monte Carlo estimate of that expectation can fluctuate below ; the inequality is not a deterministic bound on every sample average. The variational formulation and reverse score gradient appear in Wu–Wang–Zhang, Eqs. (2)–(5) and Appendix B. Here the expectation is summed over every state.
Differentiate the distribution as well as its log likelihood
Let . Differentiation gives the local logit score
Multiplying it by or a preceding spin supplies the bias or weight score. Forward-loss differentiation weights the negative score by .
For the reverse loss, itself depends on the parameters. With ,
because . Any state-independent baseline can therefore be subtracted:
The code uses the exact finite-sum baseline. A same-batch random estimate needs more care, as Exercise 2 shows. Differentiating only the sampled while treating the sampled states as fixed would omit the changing-distribution term.
The implementation compares scalar-loop and vectorized likelihoods, checks the mean score, and finite-differences both losses along five declared directions at two fixed parameter vectors. Every direction reaches scaled error below on the retained step scan. This tests the implemented derivative; it does not establish that a nonconvex optimizer reaches a global minimum.
What the actual fits learn
At each temperature, train two reverse-loss starts and one forward-loss start. All parameters lie in , with independent initial values of SD . The fixed L-BFGS-B budget is iterations, function evaluations, relative objective tolerance and projected-gradient tolerance . The companion records the exact seeds and every stopping status.
All six runs stop by the relative objective-change test. Their final maximum gradient components range from to , so none meets the separately requested gradient tolerance. No bound is active. The primary reverse fit is start zero; the second start remains a sensitivity result, not a replacement selected after inspecting errors.
The following are exact enumerated diagnostics of the returned models, with no sampling error attached:
| Fitted loss | Total variation | |||
|---|---|---|---|---|
| Reverse, start zero | ||||
| Forward | ||||
| Reverse, start zero | ||||
| Forward |
The forward fit has the smaller forward divergence, while the reverse fit has the smaller reverse divergence, as intended here. These are small but nonzero errors. Similar probabilities for the dominant configurations do not prove that every rare configuration is accurately represented.
For , the exact value is , whereas the primary reverse model gives . At , the corresponding numbers are and . Enumeration identifies these biases without conflating them with sampling noise. The returned bias parameters leave tiny spin-flip defects, at most over all six fits; symmetry was not imposed by hand.
The magnetization probabilities and their differences are summed over all configurations. The reverse curves use the prescribed start zero, and the forward curves use their single fixed start. These are model probabilities, not sampled histograms.
Fresh ancestral sampling uses eight independent replicas of configurations for each displayed model. For the reverse fit, the sampled mean magnetization is with replica SE , although its exact model mean is only . This approximately four-estimated-SE fluctuation is retained; eight replicas provide only seven variance degrees of freedom, and many observables are examined. We neither redraw it nor infer a physical nonzero magnetization. The likelihood and enumeration distinguish a finite sample fluctuation from the model's known bias.
Exact correction creates a different stochastic process
Freeze and propose an independent new configuration. Independence Metropolis accepts it with
For , , and the diagonal includes rejected proposals as well as accepted proposals equal to the current state. Detailed balance follows directly:
Thus is stationary. All entries of our finite proposal are positive, so this finite-state chain is irreducible and aperiodic. That argument identifies its stationary law, not the finite burn-in needed for a large or poorly covered target.
Here the complete transition matrix can be built. Its row, stationary and detailed-balance residuals are below . For a centered observable its stationary lag-one correlation is calculated exactly as
The primary reverse model gives:
| Accepted proposal fraction | Actual state-change fraction | ||
|---|---|---|---|
Acceptance includes a proposal identical to the current state, so it differs from the move probability. Even high acceptance leaves nonzero correlations. In the independent-model draws the observations follow and have no Markov dependence; in the corrected chain the stationary law is and the retained states are correlated. This calculation uses the full matrix rather than adding a second chain experiment. The continuous-field correction example measures finite-chain behavior separately.
A final exact diagnostic is worth distinguishing from a heuristic. If has zero variance under a full-support , it is constant on every configuration. Therefore and normalization gives . A small variance measured on a short sample need not see a missed region. The support condition is indispensable to the argument in Wu–Wang–Zhang, Appendix C.
Summary
Normalized conditional distributions give an exactly normalized model and an ordered sampler. The finite example performs real optimization and still has measurable target bias. Full enumeration separates that bias from random sampling errors, while the complete Metropolis matrix shows how exact stationary correction replaces independent model draws by a correlated target-preserving process.
Exercises
1. Build the exact two-spin autoregressive model
For at inverse temperature , find normalized conditionals in the stated order and derive . Does independence of different generated configurations mean that their two spins are independent?
Solution
Summing the four weights gives . Summing over gives . At fixed ,
Thus , reproduces the exact joint distribution. Summing over first proves normalization. The correlation is
Each spin has mean zero, but their nonzero correlation for shows dependence within a configuration. Repeating the ancestral procedure with independent random numbers produces independent pairs with precisely this internal correlation. Only makes the two spins independent as well.
2. A baseline estimated from the same batch
Let and for independent draws. Assume and write . Is
unbiased? Give a corrected baseline construction.
Solution
For , independence gives . The contribution remains, so
At the estimator is identically zero, despite a generally nonzero true gradient. For , multiply by or use a leave-one-out baseline
Each is independent of , so its expected contribution vanishes. A separate independent baseline batch also works. A known exact expectation, as in the enumerated training above, is state-independent and needs no such correction. These statements concern unbiased gradients at fixed parameters; they do not prove convergence of a stochastic optimizer.
References
- D. Wu, L. Wang and P. Zhang, “Solving Statistical Mechanics Using Variational Autoregressive Networks,” Physical Review Letters 122 (2019), 080602, arXiv:1809.10606v2, main Eqs. (1)–(5), Appendices A–C. The nine-spin fitted benchmark and exact transition-matrix comparison above are calculated here.
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.