Skip to content
QFT.org

Search QFT.org

Enter a word or phrase.

    You can also browse the main navigation and chapter contents.

    Rare Events, Tempering, and Umbrella Sampling

    A simulation can measure the shape of the dominant phase accurately while almost never visiting a suppressed phase. The probability of that rare sector then has a large relative error. We can deliberately sample auxiliary ensembles that visit the suppressed region and reconstruct the physical probability, provided the ensembles overlap enough to determine their relative normalizations.

    We will do this for a tilted double well. Quadrature gives an independent answer, so both the benefit and the remaining statistical error can be measured.

    Preparation: Importance sampling and reweighting and invariant Markov kernels. Actions below are dimensionless Euclidean functions on the whole real line.

    A sector with probability below one in a thousand

    Define

    S(x)=(x2−4)24−hx,h=2,π(x)=Z−1e−S(x).S(x)=\frac{(x^2-4)^2}{4}-hx,\qquad h=2, \qquad \pi(x)=Z^{-1}e^{-S(x)}.

    The source favors positive xx. Our observable is the indicator I−(x)=1I_-(x)=1 for x<0x\lt0 and zero otherwise. Its mean is

    p−=∫−∞0e−S(x) dx∫−∞∞e−S(x) dx=0.0007084265813p_-=\frac{\int_{-\infty}^{0}e^{-S(x)}\,\mathrm dx} {\int_{-\infty}^{\infty}e^{-S(x)}\,\mathrm dx} =0.0007084265813

    by adaptive quadrature. The partition integral in the denominator is approximately 53.83892065.

    Even independent target samples have indicator variance p−(1−p−)p_-(1-p_-). With N=5120N=5120, the expected negative count is only 3.63 and the standard deviation of the estimated probability is 0.000371840.00037184, about 52% of the answer. A Markov chain trapped in one well can do much worse. The independent binomial baseline already shows why a large-looking total sample count is not enough.

    Make overlapping windows

    Add harmonic bias potentials

    Bi(x)=κ2(x−ci)2,ui(x)=S(x)+Bi(x),B_i(x)=\frac\kappa2(x-c_i)^2,\qquad u_i(x)=S(x)+B_i(x),

    with κ=8\kappa=8 and ci=−2,−1,0,1,2c_i=-2,-1,0,1,2. Window ii samples

    πi(x)=e−ui(x)Zi.\pi_i(x)=\frac{e^{-u_i(x)}}{Z_i}.

    These are auxiliary distributions. They do not change the desired target π\pi; their biases must be removed in the final estimator. The central windows connect the suppressed and dominant regions so that their relative statistical weights can be inferred.

    For this example ui′′(x)=3x2+4≥4u_i''(x)=3x^2+4\ge4, so every window is strictly convex. Its minimum aia_i solves

    ai3+4ai−8ci−2=0.a_i^3+4a_i-8c_i-2=0.

    Strong convexity gives ui(x)≥ui(ai)+2(x−ai)2u_i(x)\ge u_i(a_i)+2(x-a_i)^2. We can therefore draw an exact independent window sample by proposing x∼N(ai,1/4)x\sim N(a_i,1/4) and accepting with

    exp⁡[−ui(x)+ui(ai)+2(x−ai)2]≤1.\exp\left[-u_i(x)+u_i(a_i)+2(x-a_i)^2\right]\le1.

    This special sampler removes within-window mixing as a confounding factor in the experiment. In a field theory one would usually need a Markov sampler and an autocorrelation analysis within each window.

    Log-density plot of the tilted double-well target and five overlapping harmonic umbrella windows, with the negative sector shaded.

    The target and each biased window are separately normalized by quadrature. A logarithmic vertical scale reveals the suppressed negative sector. The curves show the overlap of the analytic window densities across the barrier.

    Determine the relative normalizations

    Pool NiN_i samples from each window, labeled xnx_n. Put fi=−log⁡Zif_i=-\log Z_i. If the fif_i were known, the pooled sampling density would be proportional to

    D(x)=∑jNjefj−uj(x).D(x)=\sum_j N_j e^{f_j-u_j(x)}.

    The same samples can estimate each normalizer, giving the self-consistency equations

    e−fi=∑ne−ui(xn)D(xn).e^{-f_i}=\sum_n\frac{e^{-u_i(x_n)}}{D(x_n)}.

    All fif_i can be shifted by one common constant without changing any relative prediction. Fix f0=0f_0=0 and solve the equations numerically using logarithms and log-sum-exp arithmetic. These are the multistate Bennett acceptance ratio, or MBAR, equations; see Shirts and Chodera, §III and Appendix C.

    To recover the physical target, assign normalized weights

    wn=e−S(xn)/D(xn)∑me−S(xm)/D(xm),p^−=∑nwnI−(xn).w_n=\frac{e^{-S(x_n)}/D(x_n)} {\sum_m e^{-S(x_m)}/D(x_m)}, \qquad \widehat p_- =\sum_n w_n I_-(x_n).

    Both the fitted normalizers and this ratio fluctuate. Removing the bias potential does not make a finite-data ratio estimator exactly unbiased. Under the usual integrability, overlap and sampling assumptions it is consistent as the number of effective samples grows. The target reweighting formulas are discussed in Shirts and Chodera, §IV.

    For a single window the identity simplifies to

    ⟨O⟩π=⟨OeBi⟩πi⟨eBi⟩πi,\langle O\rangle_\pi =\frac{\langle O e^{B_i}\rangle_{\pi_i}} {\langle e^{B_i}\rangle_{\pi_i}},

    when the required expectations exist. Multiple windows reduce reliance on a single distribution's poorly sampled tails. They cannot recover a region absent from every sample merely by solving the equations more accurately.

    Test overlap and the recovered probability

    The example draws 1,024 independent samples per window and repeats the complete fit 64 times. The mean recovered probability is 0.000717730.00071773, with standard deviation 0.000122790.00012279 across repetitions. The mean differs from quadrature by 0.61 standard errors of that repeated-run mean.

    At the same total of 5,120 accepted samples, the measured variance is about 9.17 times smaller than the ideal independent-target binomial variance. Sampling the windows consumed 664,570 proposals across all repetitions, about 2.03 proposals per accepted point, and the normalization fit has an additional cost. Thus 9.17 is a sample-efficiency comparison, not an end-to-end speedup. The comparison is not made artificially favorable by using a trapped target chain as its baseline.

    A useful overlap diagnostic follows from

    Wni=efi−ui(xn)D(xn),Oij=Nj∑nWniWnj.W_{ni}=\frac{e^{f_i-u_i(x_n)}}{D(x_n)}, \qquad O_{ij}=N_j\sum_n W_{ni}W_{nj}.

    At a converged solution, rows of OO sum to one. In this equal-size experiment its mean adjacent-window entries are approximately 0.161, 0.057, 0.104 and 0.202. The smallest connection is between the second and central windows. A disconnected overlap graph would leave relative normalizations of its components undetermined by the data; tiny connecting weights can make them very uncertain.

    The fixed-point changes reached below 10−1010^{-10}, taking at most 688 iterations. This controls numerical convergence of the fit, not statistical accuracy. The nontrivial accuracy check is the distribution of recovered probabilities over independent repetitions against quadrature. For correlated samples, uncertainty estimation must account for within-window correlations and refit the normalizers in each suitable resample or independent run.

    Tempering moves configurations between ensembles

    Umbrella sampling changes where configurations are collected. Parallel tempering can help them move between difficult regions. For inverse temperatures βi>0\beta_i>0, use the product target

    Π(x1,…,xM)∝∏ie−βiS(xi).\Pi(x_1,\ldots,x_M)\propto \prod_i e^{-\beta_i S(x_i)}.

    Apply target-preserving within-replica updates and propose an exchange of configurations i,ji,j. The Metropolis acceptance is

    min⁡[1,exp⁡((βi−βj)[S(xi)−S(xj)])].\min\left[1, \exp\big((\beta_i-\beta_j)[S(x_i)-S(x_j)]\big)\right].

    This follows by taking the ratio of the product weights before and after the swap. A replica with β=1\beta=1 retains the desired marginal. Smaller positive β\beta can facilitate barrier crossing, but acceptance of neighboring swaps does not prove rapid travel through the full temperature ladder or between all sectors. On the noncompact real line, β=0\beta=0 would give an unnormalizable uniform distribution; it is not an admissible endpoint here.

    Biased windows can also exchange configurations. For general actions ui,uju_i,u_j, replace the exponent by −ui(xj)−uj(xi)+ui(xi)+uj(xj)-u_i(x_j)-u_j(x_i)+u_i(x_i)+u_j(x_j). The benchmark draws independent rejection samples in each window.

    Summary

    Auxiliary ensembles can expose a suppressed sector, but the physical answer requires their relative normalizations and a correct reweighting formula. Overlap, within-ensemble exploration, finite-sample error and solver convergence are distinct checks. The double-well experiment isolates these issues with an independent quadrature answer.

    Exercises

    No rare events observed

    For NN independent target draws, derive the probability of seeing no negative-sector sample. Evaluate it approximately at N=5120N=5120 for the example above. Does zero observed count establish p−=0p_-=0?

    Solution

    The probability is (1−p−)N≃e−Np−≃0.0266(1-p_-)^N\simeq e^{-Np_-}\simeq0.0266. A zero count is therefore quite possible even in a perfectly equilibrated independent sample. It does not establish a zero physical probability, and the naive plug-in standard error based on a zero observed proportion would be misleading. Correlation or trapping can increase the chance of such an outcome further.

    A common energy shift

    Replace every ui(x)u_i(x) and the target S(x)S(x) by the corresponding function plus the same constant aa. What changes in the probabilities and the MBAR fit?

    Solution

    Each partition integral acquires e−ae^{-a}, so every true fif_i increases by aa. The combinations fi−ui(x)f_i-u_i(x) stay unchanged. The target numerator e−S(x)e^{-S(x)} acquires a common factor that cancels on normalizing the weights. All normalized probabilities and relative fi−fjf_i-f_j are unchanged. An arbitrary gauge choice such as f0=0f_0=0 makes explicit that the fit determines relative normalizations only.

    References

    • M. R. Shirts and J. D. Chodera, “Statistically optimal analysis of samples from multiple equilibrium states,” Journal of Chemical Physics 129, 124105 (2008), arXiv:0801.1426, §§III–IV and Appendix C, doi:10.1063/1.2978177.

    Reproducible calculations: examples/computational-qft/monte-carlo-methods/README.md.

    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.