betaFeedback

WorksComputer Science

A Finite-Rate Selection Law for Annealed Gibbs Sampling

Abstract

Annealed Gibbs sampling samples a multimodal model by redrawing one variable at a time from its conditional distribution as the temperature falls from a high value, where the distribution is broad, to the target temperature. Each run ends in a single mode, and unbiased Monte Carlo estimates require the runs to end in each mode in proportion to its probability under the model. At a finite cooling rate this can fail. We measure the error by cc, the fraction of the model's log-odds between two modes that the samples retain. In the Curie–Weiss model, where a weak external field favors one of two modes, each run selects its mode near the transition at which the modes form, and rarely switches once they have separated. Near the transition, the random fluctuations of the Gibbs updates still outweigh the weak field, which therefore biases the choice of mode only slightly. Building on the selection probability of Kondepudi and coworkers, we derive a law for cc that agrees with an exact computation to within 2%2\% on nine linear cooling ramps. For the Hopfield model, whose modes are stored patterns and their negatives, we derive a factor by which competition among patterns raises cc. The cc measured over random pattern sets lies within 33–6%6\% of its prediction, but single pattern sets depart from it, contrary to its derivation.

Code and results: github.com/ali-izhar/finite-rate-selection-law

© I. Ali, M.H. Khan & S. Ahmad.

Introduction

Sampling from a distribution with several well-separated modes is hard, because a Markov chain started in one mode can take a very long time to leave it [5, 8]. Annealing is meant to avoid this: the chain starts at a high temperature, where the distribution is broad, and is cooled to the target temperature. Each run then ends in one of the modes. For Monte Carlo estimates to be unbiased, the runs must end in each mode in proportion to its probability, and Neal [9] noted that there is no reason to expect annealing to achieve this. We ask how far annealed samples miss these proportions, and why. The question also applies to diffusion models, which commit to one class partway through generation [4]. We answer it for annealed Gibbs sampling in an exactly solvable model.

The answer depends on when a run chooses its mode. At high temperature the distribution has a single broad peak. The modes appear as the temperature crosses a transition, and soon afterwards a run rarely crosses between them in the time that remains (Figure 1a). The choice is therefore made mainly near the transition. There, if the model favors one mode only through a weak bias, this preference is still small compared with the random fluctuations of the sampler’s updates. The choice is then only slightly better than a coin toss, even if the model at the target temperature strongly prefers one mode (Figure 1b), and the samples keep only a fraction cc of the model’s log-odds between the two modes: with c=0.2c = 0.2, the model’s odds of four to one become 40.2≈1.324^{0.2} \approx1.32 to one in the samples.

Figure 1. Where the samples lose the model’s preference. (a) The magnetization mm of the CW model, the mean of its binary variables, cooled from high temperature (left) without a field (drift-and-noise approximation). Runs split into the ++ and −- modes at the transition, β=1\beta= 1 (band: scale of the selection window). (b) The early amplitude: the imbalance built up by field and noise around the transition; its sign decides the run’s mode. A weak field toward ++ shifts its distribution by a fifth of its spread: 58% of runs end in ++, which the model gives 97%. (c) The fraction cc of the model’s log-odds kept by the samples against cooling time: exact (markers), our law (lines); sixteen times longer cooling only doubles cc.

We make this quantitative for the Curie–Weiss (CW) model, in which binary variables all interact and tend to agree, and a weak external field favors one of its two modes. Kondepudi and Nelson [7] showed that such a choice can be very sensitive to a small bias, and Kondepudi and Gao [6] computed the probability that a system driven at a finite rate through a symmetry-breaking transition ends on the favored side [see also 10]. We turn this probability into a law for cc that agrees with an exact computation of the sampler’s distribution to within 2% on nine linear cooling ramps. The law explains why slower cooling helps little: for a weak field, cc grows only as the fourth root of the cooling time, so cooling sixteen times more slowly only doubles cc (Figure 1c).

Many models have more than two modes, so we also ask what competition among several modes does to cc. In a Hopfield model the modes are stored patterns and their negatives. If a run ends in the pattern toward which its imbalance is largest when the modes form, competition should raise cc: the winning imbalance is large, and the sign of a large imbalance follows the field more reliably than that of a small one. We derive the factor by which competition raises cc, assuming that the patterns of a set are statistically alike. The cc measured over many random pattern sets lies within 3–6% of its prediction, but in a post hoc analysis single pattern sets are not alike and depart from it (§ 4). The factor therefore describes at most an average over pattern sets.

Background

Modes and their proportions. Many distributions of interest put most of their probability in a few separated regions of configuration space, their modes, with little probability in between. For two modes A and B, let qq be the probability of A given that a configuration lies in A or B. Its log-odds, logit⁡q=log⁡[q/(1−q)]\operatorname{logit} q = \log[q/(1-q)], are zero for equally probable modes and grow in magnitude as one mode dominates.

Temperature, Gibbs sampling and annealing. Such distributions are often written as πβ(x)∝e−βE(x)\pi_{\beta}(x) \propto e^{-\beta E(x)}, with an energy EE and an inverse temperature β\beta. At small β\beta, high temperature, πβ\pi_{\beta} is broad; at large β\beta, low temperature, it concentrates on configurations of low energy, where modes form.

Gibbs sampling picks one variable uniformly at random, redraws it from its conditional distribution given all the others, and repeats. At fixed β\beta this Markov chain converges to πβ\pi_\beta, its equilibrium distribution. Convergence is slow when πβ\pi_\beta has separated modes, because the chain must pass through improbable configurations between them: in the CW model below, without a field and for β>1\beta> 1, this time grows exponentially with the number NN of variables [5, 8]. Annealing starts at a small β\beta, where the chain moves freely, and raises β\beta gradually. We use linear ramps, on which β\beta rises by the cooling rate γ\gamma per sweep of NN updates, one update per variable on average. The final configuration of a run is its sample. If β\beta rose infinitely slowly at fixed NN, the chain would stay in equilibrium and the samples would have the equilibrium proportions. At a finite cooling rate they need not.

The Curie–Weiss model. A configuration of the CW model is a vector x=(x1,…,xN)\boldsymbol{x}=(x_1,\ldots,x_N) of NN binary variables xi∈{−1,+1}x_i\in\{-1,+1\}, called spins. Every pair of spins interacts equally, and configurations whose spins agree are more probable:

πβ,G(x)∝exp⁡[β2(N−1)∑i≠jxixj+βG∑ixi](1)\pi_{\beta,G}(x) \propto\exp\left[\frac{\beta}{2(N-1)}\sum_{i\ne j}x_i x_j+\beta G\sum_i x_i\right] \tag*{(1)}

The field G>0G>0 favors positive spins. We summarize a configuration by its magnetization m=N−1∑ixim=N^{-1}\sum_i x_i, the mean spin. Without a field, as N→∞N\to\infty, the equilibrium mm concentrates at 0 for β<1\beta<1 and at two opposite values for β>1\beta>1. Configurations near either value form the two modes, which appear at the transition, β=1\beta=1. A weak field, of order 1/N1/N as in our experiments, leaves both modes in place but gives the positive one more probability, and the log-odds between the modes grow as β\beta rises. The field on each spin is small (NG=1.25NG=1.25 at every size, so G≈0.0006G\approx0.0006 at N=2048N=2048) but acts on all NN spins. At β=1.6\beta=1.6, where our ramps end, the equilibrium log-odds are 3.57, so the positive mode is e3.57≈36e^{3.57}\approx36 times as probable as the negative one and holds 97% of the probability.

The sampler of the CW model can be computed exactly. In equilibrium, a configuration’s probability depends only on its number kk of positive spins, so for N=4N=4 the six configurations with two positive spins, such as + + − −+\ +\ -\ - and + − + −+\ -\ +\ -, are equally probable. With uniformly chosen updates, they also change kk at the same rates. A run is therefore described by kk alone [8]. The exact chain evolves the N+1N+1 probabilities of kk, instead of those of the 2N2^N configurations, and gives the samples’ exact distribution.

What we measure. Let qchainq_{\mathrm{chain}} be the probability that a sample has m>0m>0, and qeqq_{\mathrm{eq}} the probability of m>0m>0 in equilibrium at the final β\beta, both conditioned on m≠0m\ne0, which belongs to neither mode. For qeq≠1/2q_{\mathrm{eq}}\ne1/2, the samples keep the fraction

c=\frac{\logit q_{\mathrm{chain}}}{\logit q_{\mathrm{eq}}} \tag*{(2)}

of the model’s log-odds. Equivalently, the samples’ odds are the model’s odds raised to the power cc. A value c=1c=1 reproduces the equilibrium proportions, and c=0c=0 gives equal proportions.

Several modes: the Hopfield model. In the Hopfield model, the coupling of Eq. (1) is built from p≪Np\ll N stored patterns ξμ∈{−1,+1}N\xi^\mu\in\{-1,+1\}^N: xixjx_i x_j becomes ∑μξiμξjμxixj\sum_\mu\xi_i^\mu\xi_j^\mu x_i x_j. At the temperatures we use (β≤1.6\beta\le1.6), the modes are the patterns and their negatives [1], so a run chooses among 2p2p modes. The overlap mμ=N−1∑iξiμxim^\mu=N^{-1}\sum_i\xi_i^\mu x_i measures how close a configuration is to pattern μ\mu; it is +1+1 at the pattern and −1-1 at its negative. We draw the pattern entries independently, each +1+1 or −1-1 with equal probability, and call one draw of the pp patterns a pattern set. The field acts along pattern 1: the field term of Eq. (1) becomes βG∑iξi1xi\beta G\sum_i \xi_i^1 x_i. Pattern μ\mu wins a run when ∣mμ∣|m^\mu| is the largest overlap magnitude in its sample. The field favors pattern 1 over its negative, so we define cc for this pair. Among the runs that pattern 1 wins, qchainq_{\mathrm{chain}} is the probability that m1>0m^1 > 0, and qeqq_{\mathrm{eq}} is its equilibrium counterpart, taken from the CW model. This cc concerns the sign of pattern 1, not how often it wins.

The selection law

We now derive the probability that a run selects the favored mode, and from it the fraction cc. We follow the magnetization m(t)m(t) of one run, where tt is the time in sweeps measured from the moment β\beta crosses 1. Near this moment mm is small and β≈1\beta\approx1, and to leading order it obeys the stochastic differential equation (Appendix § 6)

dm=[(β(t)−1)m+G]dt+2NdWt,(3)\mathrm{d}m = \left[(\beta(t)-1)m+G\right]\mathrm{d}t+\sqrt{\frac{2}{N}}\mathrm{d}W_t, \tag*{(3)}

where WW is a standard Brownian motion. The last term is the noise: the random choices of the updates add a variance of about 2/N2/N per sweep. On a linear ramp, β(t)−1=γt\beta(t)-1=\gamma t.

Three phases. The coefficient γt=β−1\gamma t=\beta-1 of mm in Eq. (3) combines two parts of the drift: +βm+\beta m from the coupling, which aligns each spin with the majority, and −m-m from the redraws, which reset it. It is negative before the transition and positive after it. Without field and noise, Eq. (3) reduces to the ordinary differential equation dm/dt=γtm\mathrm{d}m/\mathrm{d}t=\gamma t m, whose solution is m(t)=m(0)eγt2/2m(t)=m(0)e^{\gamma t^2/2}. The exponent depends on t2t^2, which gives three phases. Before the transition (t<0t<0), t2t^2 falls toward zero, so ∣m∣|m| decreases: from a start at t0t_0, the initial imbalance is multiplied by e−γt02/2e^{-\gamma t_0^2/2}. In the selection window, ∣t∣≤T=γ−1/2|t|\le T=\gamma^{-1/2} sweeps, the exponent is at most 1/21/2, so the drift changes ∣m∣|m| by at most a factor e1/2e^{1/2}, and the sign of mm is set mainly by the field and the noise. After the window (t>Tt>T), the exponent grows as t2t^2, so ∣m∣|m| grows faster than exponentially, the field and the noise matter less and less, and the drift carries mm into a mode, which the run rarely leaves once the modes have separated.

The early amplitude. To find the sign that the window leaves, we divide out the growth factor, Y(t)=e−γt2/2m(t)Y(t)=e^{-\gamma t^2/2}m(t). The factor is deterministic, so the product rule applies to Eq. (3), and the term γtm dt\gamma t m\,\mathrm{d}t cancels:

dY=e−γt2/2(G dt+2N dWt)\mathrm{d}Y=e^{-\gamma t^2/2}\left(G\,\mathrm{d}t+\sqrt{\frac{2}{N}}\,\mathrm{d}W_t\right)

Only the field and the noise change YY, each with the weight e−γt2/2=e−t2/2T2e^{-\gamma t^2/2}=e^{-t^2/2T^2}, a Gaussian in tt of width TT. YY therefore settles within a few TT of the transition, and since m=eγt2/2Ym=e^{\gamma t^2/2}Y with a positive factor, its final value, the early amplitude, has the sign of the run’s mode. YY sums the field and independent Gaussian noise increments, so it is Gaussian across runs; for a ramp that starts well before the window, its mean sums the weights and its variance sums their squares:

E[Y]=G∫−∞∞e−γt2/2dt=G2πγ,Var⁡[Y]=2N∫−∞∞e−γt2dt=2Nπγ.\mathbb{E}[Y]=G\int_{-\infty}^{\infty}e^{-\gamma t^2/2}\mathrm{d}t=G\sqrt{\frac{2\pi}{\gamma}},\qquad\operatorname{Var}[Y]=\frac{2}{N}\int_{-\infty}^{\infty}e^{-\gamma t^2}\mathrm{d}t=\frac{2}{N}\sqrt{\frac{\pi}{\gamma}}.

Both grow in proportion to TT: the mean because the field pushes in one direction throughout the window, the variance because the noise increments are independent. The standard deviation therefore grows only as T1/2T^{1/2}. In units of it, U=Y/Var⁡[Y]∼N(a,1)U=Y/\sqrt{\operatorname{Var}[Y]}\sim\mathcal{N}(a,1), and a run ends with m>0m>0 when U>0U>0, which gives the classical selection probability [6, 7]

qsel=Φ(a),a=E[Y]Var⁡[Y]=GN(πγ)1/4,(4)q_{\mathrm{sel}}=\Phi(a),\qquad a=\frac{\mathbb{E}[Y]}{\sqrt{\operatorname{Var}[Y]}}=G\sqrt{N}\left(\frac{\pi}{\gamma}\right)^{1/4}, \tag*{(4)}

where Φ\Phi is the standard Gaussian CDF. Since a∝T1/2=γ−1/4a \propto T^{1/2} = \gamma^{-1/4}, a slower ramp raises aa only as the fourth root of its length [3].

The selection law. If each run ends with the sign of its early amplitude, qchain=qselq_{\mathrm{chain}} = q_{\mathrm{sel}}, and Eq. (2) gives the selection law, csel=logit⁡Φ(a)/logit⁡qeqc_{\mathrm{sel}} = \operatorname{logit}\Phi(a)/\operatorname{logit}q_{\mathrm{eq}}. For a weak field both log-odds are proportional to GG. In the numerator, Φ(a)≃12+a2π\Phi(a) \simeq\frac{1}{2} + \frac{a}{\sqrt{2\pi}} for ∣a∣≪1|a| \ll1, and logit⁡q≃4(q−12)\operatorname{logit}q \simeq4(q-\frac{1}{2}) near q=12q = \frac{1}{2}. In the denominator, the field adds βfNGm\beta_fNGm to the log weight of Eq. (1), so the two modes, mirror images at m=±mˉfm = \pm\bar{m}_f, differ in log weight by 2βfNGmˉf2\beta_fNG\bar{m}_f (Appendix § 6):

logit⁡Φ(a)≃4a2π,logit⁡qeq≃2βfNGmˉf,\operatorname{logit}\Phi(a) \simeq\frac{4a}{\sqrt{2\pi}}, \qquad\operatorname{logit}q_{\mathrm{eq}} \simeq2\beta_fNG\bar{m}_f,

where βf\beta_f is the final inverse temperature and mˉf≈0.89\bar{m}_f \approx0.89 at βf=1.6\beta_f = 1.6. The field cancels in their ratio:

c≃2π1/4βfmˉf(N2γ)−1/4.(5)c \simeq\frac{\sqrt{2}}{\pi^{1/4}\beta_f\bar{m}_f}(N^2\gamma)^{-1/4}. \tag*{(5)}

For a weak field the law thus predicts that cc does not depend on the field, that a sixteen times slower ramp doubles cc, and that a fourfold larger NN halves it. On nine linear ramps, the exact chain of § 2 exceeds cselc_{\mathrm{sel}}, without the weak-field approximations, by only 0.23–1.81% (Table 1).

NNγ=0.004\gamma=0.004γ=0.001\gamma=0.001γ=0.00025\gamma=0.00025
10240.09370 (0.93%)0.13393 (1.81%)0.18868 (1.03%)
20480.06587 (0.46%)0.09372 (0.97%)0.13314 (1.23%)
40960.04645 (0.23%)0.06589 (0.49%)0.09361 (0.86%)

Table 1. Exact cc on the nine linear ramps of § 3 and, in parentheses, its percentage excess over the selection law cselc_{\mathrm{sel}}.

The derivation assumes a slow ramp (γ≪1\gamma\ll1) that starts well below β=1\beta= 1, a drift that Nγ≫1N\gamma\gg1 keeps nearly linear in the window without a field [3], and little switching once the modes have separated, which is far slower than our ramps. The law holds even where they are strained (Appendix § 6).

Competition among several modes

We now ask how competition among the 2p2p modes of the Hopfield model (§ 2) changes cc.

Prediction. Each overlap mμm^\mu follows an equation like Eq. (3), so each has an early amplitude YμY^\mu. We assume that the YμY^\mu are independent Gaussians of common variance σ2\sigma^2, that the field shifts only the mean of Y1Y^1, by δ\delta, and that the growth after the window carries the run to the pattern whose amplitude is largest in magnitude, with that amplitude’s sign. Two facts then determine cc. First, a large amplitude follows the field more reliably than a small one: at magnitude rr, the odds that Y1Y^1 is positive are the ratio of its density ff at +r+r and −r-r, f(r)/f(−r)=e2rδ/σ2f(r)/f(-r) = e^{2r\delta/\sigma^2}, so for a weak field the probability of a positive sign is 12+rδ2σ2\frac{1}{2} + \frac{r\delta}{2\sigma^2}, linear in rr. Second, which pattern wins depends only on the magnitudes, and the winner’s magnitude is the largest of pp, so it is larger on average than that of a single amplitude (Figure 2a). Because the probability is linear in rr, averaging it over the winner’s magnitude rather than a single magnitude multiplies the log-odds that m1m^1 has the field’s sign, among the runs that pattern 1 wins, by the ratio of the two mean magnitudes (Appendix § 7):

Figure 2. Competition among patterns. (a) Densities of the magnitude of one Gaussian amplitude and of the largest of three: the winner is larger on average, by a factor A3=1.662A_3 = 1.662 (dotted: means). (b) Measured over predicted cc, pooled over 50 random pattern sets, with 95% intervals (dark: exact chain and two-block predictions; purple: ApcCWA_p c_{\mathrm{CW}}). (c) The same ratio for each set with p≥3p \ge3, against pp times pattern 1’s win share; alike patterns would put every set at (1, 1) (bar: median 95% interval of a four-pattern set).

Ap=Emax⁡1≤μ≤p∣Zμ∣E∣Z∣,cpred=ApcCW,(6)A_p = \frac{\mathbb{E}\max_{1\leq\mu\leq p}|Z_\mu|}{\mathbb{E}|Z|}, \qquad c_{\mathrm{pred}} = A_p c_{\mathrm{CW}}, \tag*{(6)}

where ZZ and the ZμZ_\mu are independent standard Gaussians, so A2=2A_2 = \sqrt{2}, A3=1.662A_3 = 1.662 and A4=1.836A_4 = 1.836. Here cCWc_{\mathrm{CW}} is the exact CW fraction on the same ramp; cpredc_{\mathrm{pred}} also assumes that other patterns change neither δ/σ\delta/\sigma nor the equilibrium log-odds.

Test. We simulated Gibbs runs on the fastest of the nine ramps of § 3 (γ=0.004\gamma= 0.004), where NγN\gamma is largest, with p=3p = 3 at N=1024N = 1024, 2048 and 4096 and p=4p = 4 at N=2048N = 2048, each over 50 random pattern sets (Appendix § 8). Runs with one pattern, whose cc is known exactly, and with two, whose cc follows from two exactly computed blocks (Appendix § 7), reproduced it to within 1.6% (Figure 2b). Pooled over the pattern sets, the measured cc was within 3% of A3cCWA_3c_{\mathrm{CW}} for three patterns at all three sizes, and 6% below A4cCWA_4c_{\mathrm{CW}} for four (point estimates). Single pattern sets, however, depart from the prediction (Figure 2c): with four patterns, pattern 1 wins between 9% and 71% of the runs of a set rather than a quarter, and the cc of a set falls as this share rises. Weighted equally (post hoc), the sets match the prediction on average (measured over predicted cc is 0.99–1.01). The factor ApA_p thus describes averages over pattern sets but not a single set, whose patterns are not alike as its derivation assumes, so the test does not support the derivation.

Limitations and related work

Why single pattern sets differ is open. One candidate is the chance correlation between random patterns, of order N−1/2N^{-1/2}: it makes the amplitudes’ variances unequal unless p/(Nγ)≪1p/(N\gamma) \ll1 (Appendix § 7), whereas p/(Nγ)p/(N\gamma) is 0.18–0.73 here, and a pattern whose amplitude varies more would win more often and have lower sign log-odds, as in Figure 2c. Runs at several cooling rates could test it. Both models are fully connected. The check of the law covers linear ramps, one value of NGNG and α≤0.42\alpha\le0.42, so it does not test the law’s prediction that cc is independent of the field. The Hopfield test covers one cooling rate, and its ratios do not test the equilibrium log-odds, which enter both sides.

Related work. Diffusion models with an exact score reverse a noising process rather than cool a Gibbs chain, so our calculation does not cover them [4]; there, too few uniform steps of a variance-preserving process get the mode probabilities of a Gaussian mixture wrong, and schedules that slow down near the transition recover them, also for a two-mode CW distribution [2]. Annealed importance sampling corrects annealed estimates with importance weights [9], and a cooling study of Ising chains [11] measures defects and excess energy, not mode probabilities.

Conclusion. In the CW model, annealed Gibbs samples keep only a fraction cc of the model’s log-odds. A law built on the selection of each run’s mode near the transition, where the random fluctuations of the updates outweigh a weak field, gives cc to within 2% on nine linear ramps. With several modes, the competition factor matches averages over pattern sets but not single sets. A theory for single sets and the extension to diffusion models remain open.

Derivation of the selection law

Drift and noise of mm. By Eq. (1), a Gibbs update redraws spin ii with mean tanh⁡ℓi\tanh\ell_i, where ℓi=β(N−1)−1∑j≠ixj+βG\ell_i = \beta(N - 1)^{-1}\sum_{j\ne i} x_j + \beta G. The sum differs from mm by terms of order 1/N1/N, so for large NN this mean is tanh⁡(βm+βG)\tanh(\beta m + \beta G). An update changes mm by the new value minus the old value of the chosen spin, divided by NN. The spin is chosen uniformly, so its old value has mean mm, and the NN updates of a sweep give

m˙=−m+tanh⁡(βm+βG).\dot{m} = -m + \tanh(\beta m + \beta G).

Expanding tanh⁡u=u−u3/3+⋯\tanh u=u-u^3/3+\cdots for small mm and GG gives (β−1)m+βG−β3m3/3(\beta-1)m+\beta G-\beta^3m^3/3; near β=1\beta=1, βG≃G\beta G\simeq G, and −m3/3-m^3/3 is the leading term that Eq. (3) omits. Near m=0m=0, the redrawn value is ±1\pm1 with probability about one half each, independently of the old value, so an update flips its spin with probability about one half, and a flip changes mm by 2/N2/N. The NN updates of a sweep therefore add a variance of about N×12×(2/N)2=2/NN\times\frac{1}{2}\times(2/N)^2=2/N, which we treat as Gaussian noise.

Start of the ramp. From a start at t0<0t_0<0, YY starts at Y(t0)=e−γt02/2m(t0)Y(t_0)=e^{-\gamma t_0^2/2}m(t_0), so the initial imbalance enters the early amplitude with weight e−γt02/2e^{-\gamma t_0^2/2}. Our ramps start at β=0.7\beta=0.7, that is, t0=−0.3/γt_0=-0.3/\gamma, so γt02/2=0.045/γ≥11\gamma t_0^2/2=0.045/\gamma\ge11 and this weight is below e−11e^{-11}; the integrals of § 3 can then run over the whole line.

Weak-field log-odds. Let K(s)=log⁡E+[esm]K(s)=\log\mathbb{E}_{+}[e^{sm}] be the cumulant generating function of mm in the positive mode at zero field. The negative mode is its mirror image, so with s=βfNGs=\beta_fNG, logit⁡qeq=K(s)−K(−s)\operatorname{logit}q_{\mathrm{eq}}=K(s)-K(-s). The even cumulants cancel, and

logit⁡qeq=2(κ1s+κ3s3/6+⋯ ),\operatorname{logit}q_{\mathrm{eq}}=2\left(\kappa_1s+\kappa_3s^3/6+\cdots\right),

where κ1=mˉf\kappa_1=\bar m_f is the mean magnetization of the positive mode, close to the positive solution of m=tanh⁡(βfm)m=\tanh(\beta_fm), and κ3\kappa_3, the third cumulant of a mean of NN spins, is of order 1/N21/N^2. Since ss is of order one, the correction to the leading term of § 3 is smaller by a factor of order 1/N21/N^2.

When the law holds. The derivation needs the drift to stay linear until the sign is set. At the edge of the window, γt=γ\gamma t=\sqrt{\gamma}, and the omitted cubic term m3/3m^3/3 matches the linear term γ m\sqrt{\gamma}\,m once m2∼γm^2\sim\sqrt{\gamma}, that is, ∣m∣∼γ1/4\lvert m\rvert\sim\gamma^{1/4}. There, by § 3, the noise gives mm a standard deviation of order (T/N)1/2=N−1/2γ−1/4(T/N)^{1/2}=N^{-1/2}\gamma^{-1/4}, a fraction (Nγ)−1/2(N\gamma)^{-1/2} of this scale, and for aa of order one the field’s contribution is of the same order. So Nγ≫1N\gamma\gg1 keeps the drift nearly linear up to the edge of the window; Berglund and Gentz [3] prove this for the pitchfork without a field. Since β−1=γt\beta-1=\gamma t, the window ∣t∣≤T\lvert t\rvert\le T is ∣β−1∣≤γ\lvert\beta-1\rvert\le\sqrt{\gamma}, and the same condition makes it wider than the finite-size critical window ∣β−1∣∼N−1/2\lvert\beta-1\rvert\sim N^{-1/2}.

Where the assumptions are strained. The law holds even where these conditions are strained, for reasons we did not derive: NγN\gamma ranges from 0.26 to 16 on the nine ramps, and on the slowest ramp at N=1024N=1024, 12% of runs end with the sign of mm opposite to its sign at β=1.05\beta=1.05, just after t=3Tt=3T, yet the law matches the final cc to 1%. Switching would restore equilibrium on a much slower ramp, but at N=2048N=2048 and β=1.1\beta=1.1 a zero-field switch takes about 5×1075\times10^7 sweeps (5×1045\times10^4 at N=1024N=1024), while our ramps last at most 3600. These times are mean passage times of the exact chain between the centers of the two modes, at fixed β\beta and zero field.

Exact chain. Updates arrive at rate NN per sweep, so the number kk of positive spins is a continuous-time Markov chain. It rises or falls by one at a rate equal to the number of eligible spins (N−kN-k negative or kk positive) times their redraw probability:

Wk+=N−k2[1+tanh⁡(β2k−N+1N−1+βG)],Wk−=k2[1−tanh⁡(β2k−N−1N−1+βG)],W_k^+=\frac{N-k}{2}\left[1+\tanh\left(\beta\frac{2k-N+1}{N-1}+\beta G\right)\right],\qquad W_k^-=\frac{k}{2}\left[1-\tanh\left(\beta\frac{2k-N-1}{N-1}+\beta G\right)\right],

where the ±1\pm1 exclude the updated spin. We integrate the probabilities Pk(t)P_k(t) of the N+1N+1 counts along the ramp with these rates, which gives qchainq_{\mathrm{chain}}; the integrator takes implicit Euler steps of about 0.02 sweeps with Richardson extrapolation and holds β\beta at the midpoint of each interval Δβ=0.005\Delta\beta=0.005 for 0.005/γ0.005/\gamma sweeps. With πk\pi_k the equilibrium distribution of kk at the final β\beta, qeq=∑k>N/2πk/∑k≠N/2πkq_{\mathrm{eq}}=\sum_{k>N/2}\pi_k/\sum_{k\ne N/2}\pi_k. The excluded state m=0m=0 has equilibrium probability below 10−3610^{-36} at βf=1.6\beta_f=1.6 for N≥512N\ge512.

The nine ramps. The ramps of Table 1 run from equilibrium at β=0.7\beta=0.7 to β=1.6\beta=1.6, with G=0.0006125×2048/NG=0.0006125\times2048/N, that is, NG=1.2544NG=1.2544. A fixed NGNG keeps the equilibrium log-odds nearly constant across sizes. At each NN, runs whose final sign differs from their sign just after t=3Tt=3T are most frequent on the slowest ramp; at N=2048N=2048, this occurs in 3% of runs. We take that sign at β=1.05\beta=1.05, the first grid point at or above 1+3γ1+3\sqrt{\gamma}. These percentages do not count runs that cross and return. The discrete-time chain of the Hopfield test (Table 2), which needs no time step, reproduces the γ=0.004\gamma=0.004 column to the printed digits.

RampUpdate nn of M=225NM = 225N uses βn=0.7+0.9(n+12)/M\beta_n = 0.7 + 0.9(n + \frac{1}{2})/M, so the ramp lasts 225 sweeps of NN updates (γ=0.004\gamma= 0.004).
UpdateRedraws one uniformly chosen spin.
StartIndependent unbiased spins, the equilibrium at β=0\beta= 0.
FieldNG=1.2544NG = 1.2544 along pattern 1, half of the runs with each sign; a=0.21a = 0.21, 0.15 and 0.10 at N=1024N = 1024, 2048 and 4096.
Pattern sets50 for each pp and NN, with equal numbers of runs. A set is the first pp of four vectors of independent equiprobable signs, so the sets are nested in pp; set ss comes from NumPy default_rng([20261027, N, s]).
WinnerThe pattern with the largest ∣mμ∣|m^\mu| at β=1.6\beta= 1.6. No run ended in a tie.
Estimator\hat{c} = \logit\hat{q}/\logit q^{\mathrm{CW}}_{\mathrm{eq}}(N), where q^\hat{q} is the fraction of the runs won by pattern 1 whose m1m^1 has the field’s sign, pooled over pattern sets and field signs.
DenominatorExact CW equilibrium log-odds at β=1.6\beta= 1.6: 3.5742, 3.5747 and 3.5749 at N=1024N = 1024, 2048 and 4096.
IntervalsPercentiles of 10,000 cluster-bootstrap resamples of the 50 pattern sets (seed 7).
cCWc_{\mathrm{CW}}Exact for this discrete sampler: the distribution of kk is multiplied by the transition matrix of each update. The blocks of the two-pattern prediction are computed in the same way.

Table 2. Settings of the Hopfield test of § 4.

Settings of Figure 1. (a) Fourteen paths of a drift-and-noise approximation of the sampler, with drift −m+tanh⁡(βm)-m+\tanh(\beta m) and the noise of Eq. (3), at N=1024N=1024, zero field and γ≈0.0003\gamma\approx0.0003; the band marks ∣β−1∣<γ|\beta-1|<\sqrt{\gamma}. (b) N=2048N=2048, γ=0.001\gamma=0.001, NG=1.2544NG=1.2544, so a=0.208a=0.208. (c) The nine ramps of Table 1, whose length is 0.9/γ0.9/\gamma sweeps.

The competition factor

Derivation of ApA_p. § 4 gives the probability 12+rδ2σ2\frac{1}{2}+\frac{r\delta}{2\sigma^2} that Y1Y^1 is positive at magnitude rr. The winner depends only on the magnitudes, so this probability also holds among the runs that pattern 1 wins. It remains to find the distribution of the winner’s magnitude. Reversing the field reverses the sign of Y1Y^1 and leaves the magnitudes unchanged in distribution, so this distribution is an even function of δ\delta. An even function has no first-order term, so to first order in δ\delta the distribution is the one at δ=0\delta=0, where the patterns are alike: that of σMp\sigma M_p, with Mp=max⁡1≤μ≤p∣Zμ∣M_p=\max_{1\le\mu\le p}|Z_\mu|. Averaging the sign probability over it, and using logit⁡q≅4(q−12)\operatorname{logit}q\cong4(q-\frac{1}{2}), gives

qchain≅12+δ2σEMp,logit⁡qchain≅2δσEMp,EMp=∫0∞[1−(2Φ(x)−1)p] dx.q_{\mathrm{chain}}\cong\frac{1}{2}+\frac{\delta}{2\sigma}\mathbb{E}M_p,\qquad\operatorname{logit}q_{\mathrm{chain}}\cong\frac{2\delta}{\sigma}\mathbb{E}M_p,\qquad\mathbb{E}M_p=\int_0^\infty\left[1-\left(2\Phi(x)-1\right)^p\right]\,dx.

The last form is EMp=∫0∞Pr⁡(Mp>x) dx\mathbb{E}M_p=\int_0^\infty\Pr(M_p>x)\,dx, since Mp≤xM_p\le x exactly when all pp magnitudes are at most xx. With one pattern, M1=∣Z∣M_1=|Z| and this is the weak-field result of § 3. The ratio of the two log-odds is ApA_p.

One pattern. With yi=ξi1xiy_i=\xi_i^1x_i, the Hopfield update of xix_i is the CW update of yiy_i. The updated spin is chosen independently of the state, so the one-pattern sampler is the CW sampler for every NN and every pattern, and its cc is the exact-chain value.

Two patterns. In the variables yiy_i, the coupling of yiy_i and yjy_j is (1+ηiηj)/(N−1)(1+\eta_i\eta_j)/(N-1), with ηi=ξi1ξi2\eta_i=\xi_i^1\xi_i^2. It vanishes between the spins on which the two patterns agree and those on which they differ, and equals 2/(N−1)2/(N-1) within each group. The model therefore consists of two non-interacting CW blocks (944–1104 spins in our pattern sets), each with the field GG; a block of nn spins has its transition at β≃N/(2n)\beta\simeq N/(2n), within 0.09 of β=1\beta=1. With SAS_A and SBS_B the block sums of the yiy_i, Nm1=SA+SBNm^1=S_A+S_B and Nm2=SA−SBNm^2=S_A-S_B, so pattern 1 wins exactly when SAS_A and SBS_B have the same sign, which is then the sign of m1m^1. We compute each block’s distribution exactly and treat the blocks as independent, which they are up to the shared number of updates. The odds that both sums are positive rather than both negative are then the product of the blocks’ odds, and with pooling over pattern sets as the estimator does, this gives cpred=0.09363c_{\mathrm{pred}}=0.09363 at N=2048N=2048. By Eq. (4), the sampled log-odds of a block grow as the square root of its size, and the log-odds of the two blocks add, so two blocks of about N/2N/2 spins give 21/2=22\sqrt{1/2}=\sqrt{2} times those of one block of NN. This recovers A2=2A_2=\sqrt{2}, and A2CCW=0.09316A_{2\mathrm{CCW}}=0.09316 lies 0.5% below the two-block value.

When random patterns violate the assumptions. Let Cμν=N−1∑iξiμξiνC_{\mu\nu}=N^{-1}\sum_i\xi_i^\mu\xi_i^\nu be the correlation of patterns μ\mu and ν\nu. At zero field and for small overlaps, averaging the expected Gibbs redraw over spins, weighted by ξiμ\xi_i^\mu, gives to leading order in 1/N1/N

m˙μ≃−mμ+β∑νCμνmν.\dot{m}^{\mu}\simeq-m^{\mu}+\beta\sum_{\nu}C_{\mu\nu}m^{\nu}.

The component of (m1,…,mp)(m^1,\ldots,m^p) along an eigenvector of CC with eigenvalue λ\lambda therefore begins to grow at β=1/λ\beta=1/\lambda and not at β=1\beta=1. An off-diagonal entry of CC averages NN independent signs and has standard deviation N−1/2N^{-1/2}, and the eigenvalues of a p×pp\times p symmetric matrix with independent entries of this size spread over a range of order (p/N)1/2(p/N)^{1/2}. The selection window spans a β\beta range of order γ\sqrt{\gamma}. As an order-of-magnitude condition, the components start to grow at nearly the same point of the window only when

(p/N)1/2≪γ,that is,p/(Nγ)≪1.(p/N)^{1/2}\ll\sqrt{\gamma},\qquad\text{that is,}\qquad p/(N\gamma)\ll1.

Otherwise the components grow by unequal factors, and since each overlap mixes the components, the amplitudes of the patterns can then have unequal variances.

The Hopfield test

Tables 2 and 3 give the settings and the results of the test of § 4.

Checks on the settings. For the exact CW chain at N=2048N=2048, the independent-spin start of Table 2 and the equilibrium at β=0.7\beta=0.7 give the same cc to six digits. The CW denominator equals the Hopfield equilibrium log-odds at p=1p=1, and is within 1.3% of them by the exact two-block calculation at p=2p=2 (N=2048N=2048) and by exact enumeration at p=3p=3 (N=512N=512 and 1024); we did not compute the Hopfield value at p=4p=4. The same denominator enters cpredc_{\mathrm{pred}}, so it cancels in the ratios of Table 3, which compare sampled log-odds only. Each pattern set with p≥3p\geq3 received 10,800 to 29,200 runs, half with each field sign.

Results. For three patterns, the pooled cc falls as N−0.50N^{-0.50} (interval [0.47, 0.53]), as Eq. (5) predicts at a fixed rate; the exact CW chain gives 0.506. The exponent is 12log⁡2[c^(1024)/c^(4096)]\frac{1}{2}\log_2[\hat{c}(1024)/\hat{c}(4096)], and its interval comes from independent bootstraps of the two sizes. The three-pattern intervals contain the prediction but allow deficits of up to 6%, and the four-pattern ratio interval is [0.884, 1.00].

ppNNpredictioncpredc_{\mathrm{pred}}measured cc [95% interval]ratiorunswon
11024exact chain0.09370.0928 [0.0909, 0.0947]0.990320,000320,000
12048exact chain0.06590.0659 [0.0647, 0.0672]1.001640,000640,000
14096exact chain0.04640.0472 [0.0464, 0.0480]1.0151,260,0001,260,000
22048two-block0.09360.0946 [0.0928, 0.0965]1.011640,000321,598
31024A3cCWA_{3}c_{\mathrm{CW}}0.15580.1518 [0.1463, 0.1571]0.975540,000181,324
32048A3cCWA_{3}c_{\mathrm{CW}}0.10950.1090 [0.1059, 0.1123]0.995820,000274,222
34096A3cCWA_{3}c_{\mathrm{CW}}0.07720.0758 [0.0734, 0.0782]0.9821,460,000504,568
42048A4cCWA_{4}c_{\mathrm{CW}}0.12090.1137 [0.1069, 0.1210]0.940940,000254,495

Table 3. Results of the Hopfield test. Ratio: measured over predicted cc. Won: runs won by pattern 1, which alone enter the estimate.

The analysis plan. Before the runs, we wrote down the predictions, the estimator, the run counts and three readings of the four ratios c/(ApcCW)c/(A_p c_{\mathrm{CW}}) with p≥3p \ge3. (a) If every 95% interval contains 1, ApA_p holds to within 3%, the planned half-width. (b) If some intervals lie below 1 and the deficits grow with p/(Nγ)p/(N\gamma), ApA_p is the limit Nγ→∞N\gamma\to\infty. (c) If some interval lies above 1, or the deficits are not ordered by p/(Nγ)p/(N\gamma), an assumption other than equal variance fails, and ApA_p is not supported as derived.

The outcome lies between (a) and (c). At the planned bootstrap seed every interval contains 1, but the four-pattern interval only just does: it ends at 1.0005, and below 1 at 139 of the 200 bootstrap seeds 0–199. The point deficits, 2.5%, 0.5% and 1.8% for three patterns at increasing NN and 6% for four, are not ordered by p/(Nγ)p/(N\gamma), which is largest at p=3p = 3, $N = 1024 (rank correlation 0.6), although the four intervals overlap. We report reading (c), the less favorable one. One post hoc comparison does follow the order: the rows with p=3p = 3 and p=4p = 4 at N=2048N = 2048 share their pattern sets, and on these sets the four-pattern ratio is 0.055 lower (paired bootstrap interval [0.008, 0.099], above zero at all 200 seeds).

The plan has limits of its own. It is in the repository (docs/) with all seeds, the pilot and the results, so no external record dates it before the runs. A pilot with a tenth of the planned runs, never pooled with the results, failed both of its one-pattern checks at 95%; four replicates with new seeds and more runs passed (ratios 0.970–1.016). Before any reported run, we doubled all run counts and chose to read the four controls at a joint 95% level; their separate 95% intervals also contain the exact values. Three of the four ratios with p≥3p \ge3 missed the planned half-width of 3%, because the sets varied more than assumed.

Single pattern sets (post hoc). The plan did not include single pattern sets. For each set, with field signs pooled, we compute the share of runs that pattern 1 wins and c^s\hat{c}_s, the estimator applied to that set alone (Table 4). The win shares show that the patterns of a set are not alike, a failure that the plan did not list. The pooled c^\hat{c} weights each set by the runs that pattern 1 won, so it weights most heavily the sets with a large win share and a low c^s\hat{c}_s, which is why it lies below the equal-weight mean. For the controls, the same chi-square test finds no excess spread (P=0.56P = 0.56–0.940.94), so the spread for p≥3p \ge3 does not come from the sampler or the estimator.

ppNNwin sharePPSpearmanexcess SDequal weight
310240.075–0.6922×10−122 \times10^{-12}−0.758.0%1.003
320480.168–0.5662×10−62 \times10^{-6}−0.697.7%1.013
340960.229–0.5222×10−52 \times10^{-5}−0.566.6%0.993
420480.087–0.7135×10−405 \times10^{-40}−0.7213.0%1.002

Table 4. Single pattern sets (50 per row, p≥3p \ge3; post hoc). Win share: range over sets of the share of runs that pattern 1 won. PP: chi-square test that all sets share one q^\hat{q}. Spearman: rank correlation of the per-set c^s\hat{c}_s with the win share. Excess SD: standard deviation of c^s/cpred\hat{c}_s/c_{\mathrm{pred}} beyond sampling error. Equal weight: mean of c^s/cpred\hat{c}_s/c_{\mathrm{pred}} over sets.

References

  1. [1]D. J. Amit, H. Gutfreund, and H. Sompolinsky. Spin-glass models of neural networks. Physical Review A, 32(2):1007–1018, 1985. doi: 10.1103/PhysRevA.32.1007.DOI
  2. [2]S. Aranguri, G. Biroli, M. Mézard, and E. Vanden-Eijnden. Optimizing noise schedules of generative models in high dimensions, 2025. arXiv preprint arXiv:2501.00988.arxiv.org/abs/2501.00988
  3. [3]N. Berglund and B. Gentz. Pathwise description of dynamic pitchfork bifurcations with additive noise. Probability Theory and Related Fields, 122(3):341–388, 2002. doi: 10.1007/s004400100174.DOI
  4. [4]G. Biroli, T. Bonnaire, V. de Bortoli, and M. Mézard. Dynamical regimes of diffusion models. Nature Communications, 15(1):9957, 2024. doi: 10.1038/s41467-024-54281-3.DOI
  5. [5]J. Ding, E. Lubetzky, and Y. Peres. The mixing time evolution of Glauber dynamics for the mean-field Ising model. Communications in Mathematical Physics, 289(2):725–764, 2009. doi: 10.1007/s00220-009-0781-9.DOI
  6. [6]D. K. Kondepudi and M.-J. Gao. Passages through the critical point and the process of state selection in symmetry-breaking transitions. Physical Review A, 35(1):340–348, 1987. doi: 10.1103/PhysRevA.35.340.DOI
  7. [7]D. K. Kondepudi and G. W. Nelson. Chiral symmetry breaking in nonequilibrium systems. Physical Review Letters, 50(14):1023–1026, 1983. doi: 10.1103/PhysRevLett.50.1023.DOI
  8. [8]D. A. Levin, M. J. Luczak, and Y. Peres. Glauber dynamics for the mean-field Ising model: cut-off, critical power law, and metastability. Probability Theory and Related Fields, 146(1-2):223–265, 2010. doi: 10.1007/s00440-008-0189-z.
  9. [9]R. M. Neal. Annealed importance sampling. Statistics and Computing, 11(2):125–139, 2001. doi: 10.1023/A:1008923215028.DOI
  10. [11]S. Suzuki. Cooling dynamics of pure and random Ising chains. Journal of Statistical Mechanics: Theory and Experiment, 2009(03):P03032, 2009. doi: 10.1088/1742-5468/2009/03/P03032.DOI

Paper details

vlnc:W_fs7nfuef
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents