- Home
- Library
- Computational Quantum Field Theory
- Learning to Sample Field Configurations
- Metropolis-Corrected Learned Proposals
Metropolis-Corrected Learned Proposals
A learned proposal can generate fields quickly and still give the wrong expectation values. If its density is known, an independence Metropolis step can restore the desired invariant distribution. That statement concerns the transition kernel. It does not say that a finite chain has escaped its starting well.
We derive the correction, apply it to the trained two-site scalar flows, and compare the resulting histories with local and Hamiltonian proposals. The same experiment contains successful moment recovery and a corrected flow that remains completely trapped.
Preparation: Flow densities, training against an action and basic Markov-chain expectations.
Balance the complete transition
Let be the target and a proposal independent of the current state. Assume is positive wherever is positive. Propose and accept with
The accepted probability flux is
which is symmetric in . Add the rejected probability as a point mass at the current state. The complete kernel then satisfies detailed balance and leaves invariant. The partition function cancels [1, §IV.7.1, equations (22)–(23)].
If , every proposal is accepted and each new state is independent. An imperfect produces rejections and correlations. Deleting rejected steps changes the chain's occupation times and generally its sampled distribution. Our histories retain a repeated state for every rejection.
The proposal density is evaluated with the inverse flow at the initial state, then cached. A proposed point comes with its density from the forward map. On acceptance both the field and cached density change; on rejection both remain. The code compares logarithms, avoiding an unnecessary exponential of a large acceptance ratio.
Freeze learning before sampling
All map parameters are fixed before warmup and production. Thus the same transition kernel is used throughout each chain. Continuing to train from its current states would create an adaptive process for which this fixed-kernel argument is insufficient. Some adaptive algorithms have additional convergence conditions; simply inserting updated network weights into the ratio does not prove those conditions.
Full support also does not give a useful finite mixing time. A proposal that almost never generates a target well can accept many moves within its preferred well while hardly ever transporting probability between wells. A current state in the poorly represented well may instead reject nearly every proposal: the large importance ratio makes it sticky.
Compare three update mechanisms on one target
The dimensionless two-site target is
For each target we run a local sampler, HMC, and independent Metropolis with either the first reverse-trained or the forward-trained flow. Each method has eight separate random streams, 1,024 warmup updates and 8,192 retained updates per stream. Four initial fields are uniform and positive; four are their negatives. Their amplitude is fixed before sampling, and no run is extended because a diagnostic fails.
The local method proposes a uniform displacement in at site zero and then site one. Each update uses its exact local action difference. A sweep is a composition of invariant single-site kernels; the fixed-order sweep need not itself satisfy detailed balance.
HMC introduces unit-normal auxiliary momenta in the orthonormal coordinates. It uses step size and independently chooses six, eight or ten leapfrog steps at every trajectory. The full Hamiltonian difference determines acceptance. Reversibility and unit phase-space volume are the relevant properties, rather than approximate energy conservation alone [2, §§2.3 and 3.2]. These momenta and trajectory times are algorithmic, not real-time field dynamics.
For the learned methods, the proposal is independent but the accepted chain generally is not. The two training objectives produced different fixed maps; they are distinct algorithms in this comparison.
Recovery for the moderate target
At , quadrature gives . The first reverse-trained model, before correction, gives in independent model draws. After Metropolis correction the retained results are:
| Method | Acceptance | Sector changes per replica | |
|---|---|---|---|
| Local sweep | 382–548 | ||
| HMC | 923–1,061 | ||
| Reverse-trained flow | 2,671–2,774 | ||
| Forward-trained flow | 2,807–2,945 |
Local acceptance is per site proposal; the others are per complete proposal. Errors are standard errors from eight replica means, not from treating every stored field as independent. Their finite estimation uncertainty matters: the HMC value is about such errors above the reference. The result and error are retained rather than modifying a seed or run length to obtain a closer match.
Fixed-lag covariance sums and block sizes 256 and 512 provide separate error diagnostics. They do not agree perfectly with the eight-replica estimate. No lag pairs cross replica boundaries. These are the stated fixed-window estimators, not the complete automatic procedure of Wolff [3, §3 and Appendix B].
A correct ratio can still leave the chain trapped
At the target has and . The reverse-trained proposal puts nearly all observable mass in the negative well. Its four positive-start chains remain at their original fields throughout the retained history. Its negative-start chains move within the negative well. The pooled acceptance is , but all eight chains have zero sector changes.
The local and HMC methods also fail this exploration check: seven of their eight replicas never change sector. HMC's acceptance is nevertheless . The forward-trained flow is different: every replica changes sector between 2,483 and 2,728 times, with acceptance . It gives
These errors again come from eight replica means. The block estimate is substantially larger for the even observable; neither estimate is promoted to a rigorous error bound. Frequent transitions and agreement with references support this finite calculation, while their absence invalidates an equilibrium interpretation of the trapped comparisons.
Hard-target histories at . The figure displays replicas zero and four over the first 1,024 retained updates; the reported statistics use all eight replicas and all 8,192 retained updates. Opposite starts expose failures that a balanced pooled mean can conceal.
In fact, pooling four trapped positive chains and four trapped negative chains can produce a mean near zero by construction. It does not demonstrate equilibrium. An even observable can look accurate within either well while the odd field and sector probability remain unresolved. Effective sample size describes a variance under suitable stationarity assumptions; it does not repair this starting-state bias.
The companion retains warmup, rejections, all declared prefixes, start-group differences, sector changes, Hamiltonian errors and numerical-failure counts. Fixed pairwise probability-flux identities check the acceptance implementation independently of the observed means. There is no adaptation or retuning during these chains.
Summary
The known flow density supplies an exact independence-Metropolis ratio and the rejected atom completes the invariant kernel. The finite scalar runs show both substantial bias correction and failure to explore a missing proposal mode. Compare start groups and slow observables before assigning an equilibrium error or a cost per useful sample.
Exercises
1. Omit the proposal ratio
Suppose independent proposals have density , but acceptance is incorrectly set to . Find the invariant density of this wrong kernel when its normalization is finite. Apply the answer to .
Solution
Set . Its accepted flux is proportional to
which is symmetric. Adding rejections therefore preserves , not . For , the exponent of is , so its covariance is . A Gaussian proposal that was already exact has been made incorrect by the omitted ratio. With the correct ratio every such proposal is accepted.
2. High acceptance in the preferred well
For a two-state target , use independent proposals with . Derive the accepted transition matrix and integrated autocorrelation time of the centered sector indicator. Compare the acceptance conditional on the first state with stationary acceptance.
Solution
From the first state, a proposal of the second is accepted with probability one, so the transition probability is . From the second, a proposal of the first is accepted with probability , again giving transition probability . Thus
The centered indicator has eigenvalue , hence stationary correlation and
Acceptance from the preferred first state is one, including proposals that stay there. From the second it is , so stationary acceptance is . Starting in the first state can therefore give nearly perfect observed acceptance while waiting order updates for a transition. At the proposals are exact and . As exploration becomes arbitrarily slow; the zero-probability endpoint itself loses irreducibility.
References
- M. S. Albergo et al., “Introduction to Normalizing Flows for Lattice Field Theory,” arXiv:2101.08176v3 (2021). Full text. §IV.7.1 gives the independence-Metropolis correction and retained-chain construction.
- R. M. Neal, “MCMC Using Hamiltonian Dynamics,” in Handbook of Markov Chain Monte Carlo (2011), pp. 113–162, arXiv:1206.1901v1. Full text. §§2.3 and 3.2 derive leapfrog and the reversible, volume-preserving accepted proposal.
- U. Wolff, “Monte Carlo errors with less errors,” Computer Physics Communications 156 (2004), 143–153; erratum 176 (2007), 383, arXiv:hep-lat/0306017v4. Full text. §3.1 treats within-replica covariance sums; Appendix B treats blocking and its finite-block bias.
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.