- Home
- Library
- Computational Quantum Field Theory
- Sampling Measures and Estimating Free Energies
- Partition Functions and Free-Energy Differences
Partition Functions and Free-Energy Differences
A normalized Markov chain can estimate an observable without knowing its partition function. That convenience becomes an obstacle when the partition function itself is the quantity of interest. How can we measure the free-energy change when an interaction is turned on?
We will compute a finite scalar integral in two ways: direct reweighting from a Gaussian and integration along a coupling path. Independent quadrature provides the comparison value. The calculation makes the reference normalization, sampling error and path-discretization error explicit.
Preparation: Gaussian integrals, importance sampling, and expectations with positive Euclidean weights. Here is dimensionless; a thermodynamic free energy at temperature would include the factor in units with .
Specify the measure before quoting a partition function
Use four dimensionless real variables, periodic indexing , and the same Lebesgue measure at every coupling. Define
The local quartic normalization is . It does not redefine the interaction convention of any other article. We turn on from 0 to .
The Gaussian matrix has eigenvalues , so
Changing the constant normalization of the common measure changes every by that constant but leaves invariant. Adding a coupling-dependent constant to the action does change the ratio and must be retained. A tractable proposal density supplies a known reference normalizer; it is not the interacting normalizer.
Reweight directly from the Gaussian
Factor the Gaussian integrand out of :
Thus independent draws give an unbiased estimator of the ratio. Taking its negative logarithm produces a finite-sample biased estimator of . Since is convex, its expected bias is nonnegative whenever the needed expectation exists.
For small relative fluctuations of the sample mean , expansion about gives
This expansion requires concentration around nonzero ; it is not a remedy for poor overlap. Here and , so the weights lie in and their variance exists. They can still become overwhelmingly tiny when the deformation or number of field variables is large.
Integrate an expectation along the coupling path
Differentiating under the integral gives
The differentiation is justified for this finite integral: the positive quadratic term and nonnegative quartic coupling dominate the required polynomial moments throughout the interval. If a model's measure or domain depends on , its derivative contributes too.
Two checks follow immediately:
Turning on a positive interaction reduces and increases , but its slope decreases as large fields become suppressed. The initial slope can be computed by Wick's theorem. Since every Gaussian site has variance ,
Concavity therefore bounds . This bound is a useful sign and normalization check before any simulation.
Choose quadrature nodes and positive weights on . The thermodynamic-integration estimator is
If estimates at different nodes are independent, its variance is the sum . Correlated replicas or reused data require cross-covariance terms. Increasing samples reduces sampling variance; increasing path nodes addresses a different error, quadrature bias along .
A calculation with two independent numerical paths
Gaussian-coordinate product quadrature evaluates directly. Increasing from 32 to 40 Gauss–Hermite nodes per independent Gaussian coordinate changes by . The finer value is
These are converged numerical comparisons for the specified finite integral, not rigorous error intervals or continuum QFT results.
A separate path evaluates and integrates it with 8- and 16-node Gauss–Legendre rules. Using 32-node field quadrature to evaluate the integrands, their differences from the endpoint result are respectively and . This comparison isolates the coupling integration and its residual field-quadrature error before introducing random sampling.
For the stochastic path, sample the Gaussian and accept with . The accepted fields are independent draws from the interacting distribution at that node. Use 2,048 accepted fields per node, and repeat the whole experiment 128 times. Direct exponential averaging instead uses 32,768 independent Gaussian draws per repetition.
| Method | Accepted fields per repetition | Average estimate | Standard deviation across repetitions |
|---|---|---|---|
| Thermodynamic integration, 8 nodes | 16,384 | 0.22940955 | 0.003086 |
| Thermodynamic integration, 16 nodes | 32,768 | 0.22921734 | 0.002049 |
| Direct exponential average | 32,768 | 0.22923902 | 0.001633 |
All three repeated-run means agree with quadrature at their measured standard errors. The direct-log mean happens to lie slightly below the exact answer in this finite set of repetitions; this statistical fluctuation does not reverse the nonnegative expectation bias from Jensen's inequality.
In this mild deformation, direct exponential averaging is more precise than the 16-node path at the same accepted-field count. It also avoids rejection sampling and node setup. The latter path used 5,234,375 Gaussian proposals over 128 repetitions, versus 4,194,304 direct Gaussian fields for the exponential average. Both counts exclude quadrature used for validation. Thermodynamic integration earns its extra work when intermediate ensembles solve an overlap problem; it is not intrinsically superior.
Bridge distributions and annealed paths
A bridge can use samples from both endpoint distributions. For actions on the same measure and a suitable function , the identity
follows because the two numerators before normalization contain the same integral . Choose so the relevant expectations are finite and the important bridge region is sampled by both ensembles. Choices depending on the unknown ratio lead to self-consistent equations. Shirts and Chodera, §III give a multistate version; the umbrella example implements that construction.
A sequence also gives the algebraic product
Each factor uses its stated normalized intermediate ensemble. Neighboring distributions can overlap well even when the endpoints do not. Multiplying independently estimated ratios remains unbiased for the product, but its relative variance accumulates; taking a logarithm adds another finite-sample bias. Shared data require their joint error analysis.
In annealed importance sampling, one need not equilibrate every intermediate state independently. Start with an exact draw from , multiply its weight by at each step, and then apply a kernel invariant under . Reweighting converts the current weighted measure to ; invariance preserves it through the transition. Induction shows that the expected final weight is . This argument assumes the initial distribution and transition invariance are correct and the necessary support is present; see Neal, §2. A finite sample of weights can still miss the trajectories carrying most of their expectation.
The numerical table above tests direct reweighting and thermodynamic integration only. It does not report an unperformed bridge or annealed-sampling benchmark.
Summary
Compute a partition ratio relative to a specified measure and known reference. Direct exponential averaging, thermodynamic integration and bridge or annealed paths express the same ratio through different sampled quantities. Their errors depend on overlap, normalization, nonlinear transformations and the cost of intermediate ensembles. Independent finite-integral checks make those distinctions visible before applying them to a large field system.
Exercises
Change only the Gaussian mass
Let and , with positive matrices of the same dimension and the same integration measure. Find and its derivative along a smooth positive-matrix path .
Solution
Gaussian integration gives
Differentiating gives . The expectation of is the same, since .
An additive constant changes the free energy
Replace by . Does the normalized field distribution change? How must both estimators of change?
Solution
The normalized distribution is unchanged because the factor cancels. But becomes , so increases by . Direct reweighting gains the factor inside its ratio, and the thermodynamic integrand becomes . Omitting an action constant is harmless for normalized field averages but not for an absolute free-energy difference.
References
- R. M. Neal, “Annealed importance sampling,” arXiv:physics/9803008, §2.
- 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, 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.