Mapping Free-Energy Surfaces with Neural Samplers and Gradient-Aware Gaussian Processes

Physicists and chemists often need the free energy of a system as a function of its parameters, not just at one setting. Examples are the coupling constants of a lattice model, the temperature and field of a magnet, or the dozens of parameters of a coarse-grained force field. The free energy is minus the logarithm of the partition function, which is the normalizing constant of the Boltzmann distribution. Today the usual approach is to run an expensive sampler at a hand-picked grid of parameter values and estimate each point separately. In more than two or three parameters this breaks down, because a grid of independent estimates grows exponentially with the number of parameters. Near phase transitions it gets worse, because samplers there slow down sharply.

The proposal starts from one observation. Every run of a modern neural sampler at a parameter setting returns more than one noisy number. A normalizing flow, which is an invertible neural network with an exact, computable density, gives an importance-sampling estimate of the absolute free energy. The same reweighted samples also give, at no extra simulation cost, the free energy's gradient with respect to every parameter, through a standard thermodynamic identity. We propose to feed both kinds of information into a single Gaussian process over parameter space, which is a probabilistic regression model that returns a mean and an error bar at every point. Each observation carries the variance the sampler itself reports. The model then decides where to spend the next sampler run by trading expected error reduction against the local cost of sampling, and that cost rises near critical points. The result is a calibrated free-energy surface across tens of parameters. The same machinery gives a built-in check for one known way neural samplers fail.

Core Claim

Let $\theta \in \mathbb{R}^D$ be the parameters of an energy $U_\theta(x)$, and let $F(\theta) = -\beta^{-1}\ln Z(\theta)$ be the free energy at inverse temperature $\beta$. The identity we rely on is

$$\frac{\partial F}{\partial \theta_i} = \Big\langle \frac{\partial U_\theta(x)}{\partial \theta_i} \Big\rangle_\theta ,$$

where the angle brackets denote the Boltzmann average at $\theta$. Classical thermodynamic integration integrates this quantity along a one-dimensional path. A neural importance sampler at $\theta$ estimates both $F(\theta)$ and this average without bias in the limit of many samples. Asymptotically unbiased estimation of physical observables with neural samplers proves that property for free energies and observables and derives variance estimators for them. One sampler run therefore yields $D+1$ noisy observations with estimated noise levels.

A Gaussian process that conditions jointly on values and gradients is a multivariate, probabilistic form of thermodynamic integration. It integrates gradients along every direction at once and anchors the result with occasional absolute estimates. The claim has three parts. First, in coupling spaces of 5 to 40 dimensions, this fusion should reach a given accuracy over the whole surface with several times less sampler compute than independent estimates, path-based integration, or value-only Gaussian processes. Second, an acquisition rule that divides information gain by a learned cost surface (effective samples per GPU-second) will automatically avoid wasting compute near critical regions, and will spend there only what the error bars require. Third, mismatch between the absolute estimates and the integrated gradients flags the case where a flow has missed a whole region of probability mass (mode collapse), and does so without running a slow local Markov chain.

Research Program

Source of observations. The first component sets up the sampler as the source of observations. On lattice systems we use flows of the kind introduced by Flow-based generative models for Markov chain Monte Carlo in lattice field theory. That work showed flows can remove the growth of autocorrelation time with lattice size in 2D $\phi^4$ theory. We supply the method's evaluator from that line of work and from the importance-sampling estimators of Nicoli et al. To avoid retraining from scratch at every query, we condition the flow on $\theta$ and fine-tune it briefly at each new query. On molecular systems we use the stochastic-transport estimator of FEAT, which avoids Jacobian determinants and has a public implementation, jiajunhe98/FEAT. We extend it to return parameter gradients. Each run reports the free-energy estimate, the gradient estimate, their noise covariance (from effective sample size), and its wall-clock cost.

Surrogate model. The second component is a Gaussian process with derivative observations. Its covariance between a value and a gradient is the kernel's derivative, so it needs a once-differentiable kernel. The same restriction appears in ACTS, which samples posterior gradients for candidate generation. That paper uses gradients of the surrogate; we observe gradients of the target, which is a different and stronger source of information.

The cost of this design is scalability. With $n$ queries in $D$ dimensions the joint covariance matrix has side $n(D+1)$, so exact inference is cubic in that size. That is already about 80,000 for $n=2000$ and $D=40$. Here we borrow from the scalability literature reviewed in Scaling Gaussian Processes Beyond Cubic Complexity. We use iterative solvers of the sketch-and-project type from Turbocharging Gaussian Process Inference with Approximate Sketch-and-Project for moderate sizes. Beyond that, we use inducing points that summarize the data, placed by a utility-weighted variational objective. Approximation-Aware Bayesian Optimization introduced such an objective (EULBO) to focus a sparse model on regions near an optimum. We replace its improvement-based utility with integrated posterior variance of $F$ over the region of interest, because our goal is to map the surface rather than maximize it. A cheaper ablation keeps only the projection of each gradient onto a few learned directions. This is in the spirit of low-effective-dimension methods such as High-Dimensional Gaussian Process Bandits, and it cuts the matrix size from $n(D+1)$ to $n(k+1)$ for $k$ retained directions.

Acquisition rule. The third component chooses the next query. A second, cheap Gaussian process models the log cost $c(\theta)$, meaning GPU-seconds per effective sample. The next query maximizes

$$\alpha(\theta) = \frac{\int \big[\sigma_n^2(\theta') - \sigma_{n+1}^2(\theta' \mid \theta)\big]\, d\theta'}{c(\theta)},$$

where $\sigma_n^2$ is the current posterior variance of $F$ and $\sigma_{n+1}^2(\cdot\mid\theta)$ is the variance after a hypothetical run at $\theta$ with its predicted noise. Critical slowing down enters here as a measured, learned cost rather than as a failure the user must anticipate. To keep the method from being lost in empty space in high dimensions (the "flat terrain" failure described in High-Dimensional Bayesian Optimization), candidates are drawn in an expanding trust region around already-observed points. The gradient observations are the main defense: each run constrains $D$ directions instead of one.

Consistency check for mode collapse. The fourth component tests for missing mass. Machine Learning of Thermodynamic Observables in the Presence of Mode Collapse showed that flows trained on their own samples, in the broken-symmetry phase of $\phi^4$, capture one of the two vacua and give a biased absolute free energy. It used forward Markov chain sampling to diagnose this, which reintroduces slow sampling.

The diagnostic rests on a symmetry argument. When the two vacua are related by symmetry, energy-derivative averages computed within one vacuum are still correct. The absolute estimate, however, is off by roughly $\beta^{-1}\ln 2$. The Gaussian process therefore sees value observations that are systematically inconsistent with gradients integrated in from the symmetric phase. We add a per-observation bias term with a sparse prior and flag runs where its posterior moves away from zero.

This argument is specific to symmetric collapse. When the missed mode is not a symmetric copy, the gradients are biased too, and the check may fail. We will measure how often that happens rather than assume it away.

Baselines

The naive reference runs the same flow sampler independently at query points drawn by a space-filling design, then interpolates with a value-only Gaussian process. It uses the same total GPU budget, the same flow architecture, and the same per-run training schedule. Beating it shows that gradients and active allocation matter at all.

The strongest classical competitor is multi-state reweighting of the multistate Bennett acceptance ratio (MBAR) kind, together with path-based thermodynamic integration. Each run uses neighbouring parameter states, connected along lines between design points, and draws its samples from the same neural sampler. This is the established way to turn gradient-like information into free-energy differences, and it is the method a physicist would actually use. To keep the comparison fair, it receives the same sampler runs at the same total compute, and its paths are chosen by the same space-filling design. Beating it means lower held-out error in $F$ over the whole parameter box at equal compute, or equal error at a measurably smaller compute budget. The criterion is at least a factor of two at $D \ge 5$.

The strongest learned competitor is an amortized flow conditioned on $\theta$ and evaluated directly at test points, with no surrogate. We train it with the same total GPU-hours. The paper closest in spirit is Conditional Normalizing Flows for Active Learning of Coarse-Grained Molecular Representations, which uses ensemble disagreement to target energy evaluations over one or two collective variables. On Müller-Brown it reports being "10 times more accurate than all-atom Monte Carlo simulations while requiring 10 times fewer energy evaluations". On alanine dipeptide it reports speedups of 15.9x to 216.2x over molecular dynamics. We run its ensemble-disagreement acquisition as a baseline in our coupling-space setting.

No reported result was found on Lacuna for error in mapping a multi-parameter free-energy surface. The comparison numbers will therefore be produced inside this study. As anchors, Asymptotically unbiased estimation of physical observables with neural samplers reports, on a 16×16 Ising lattice at criticality, an integrated autocorrelation time of 4.04 for Metropolis versus 0.83 for neural Markov chain Monte Carlo. FEAT reports 320.02 versus a reference of 320.19 on Chignolin. These numbers tell us whether our single-point evaluator matches the literature before any surface-level comparison.

Three ablations isolate the key ingredient. The first drops gradient observations. The second drops the cost model, using variance reduction alone. The third replaces utility-calibrated inducing points with standard variational ones. If the value-only, cost-unaware model performs about as well, the central claim fails.

Why not just…?

Why not just do thermodynamic integration or multi-state reweighting, which already uses these gradients? In one or two parameters this is a real threat and may tie our method. Path-based integration needs a route between every pair of points of interest. Reweighting needs overlap between neighbouring states, which shrinks quickly as dimensions are added and as the system grows; the importance-weight collapse documented by Nicoli et al. is the same phenomenon. The Gaussian process uses every gradient in every direction and reports error bars where no path was run. The comparison above, swept over $D \in \{2, 5, 10, 20, 40\}$, will show where the crossover lies. If no crossover appears by $D=10$, the proposal reduces to a convenient interface around a classical method, and we will report it that way.

Why not just train one flow conditioned on the parameters and read off the free energy anywhere? We do use such a flow as the sampler. On its own, though, its error at an untrained parameter value is unknown and uncorrected. Its importance-sampling variance still differs across parameter space, and it gives no rule for where extra compute should go. A conditioned flow that is wrong in one region is also exactly the case where its own estimates cannot reveal the problem. The amortized baseline at equal GPU-hours tests whether the surrogate adds anything. If it matches us on held-out error and calibration, the surrogate is unnecessary for accuracy and survives only as a mode-collapse check.

Why not just use cluster algorithms such as Wolff, which already defeat critical slowing down on Ising? Multilevel Generative Samplers for Investigating Critical Phenomena concedes that Wolff remains slightly more efficient than their neural sampler on the 2D Ising model. Cluster algorithms do not compete with our method; they feed it. They give fast, accurate energy averages, which are gradients, but no absolute partition function. Where they apply, we plug them in as gradient sources and anchor with occasional flow estimates. One experiment does exactly this on Ising. The method itself is indifferent to which sampler produces the observations.

Why not just run gradient descent or CMA-ES when the downstream goal is fitting parameters? If the goal is a single best fit to target averages, the thermodynamic gradient makes plain stochastic gradient descent the natural tool. LassoBench shows CMA-ES beating complex surrogate methods in very high dimensions, reaching mean squared error 0.015 on the 7,129-dimensional Leukemia task. We do not claim to beat these on point optimization. Our target is the whole surface with error bars: phase boundaries, all-pairs free-energy differences, and objectives that depend nonlinearly on $F$ at many parameter settings. Point optimizers do not return these.

Proposed Experiments

Ising with exact answers. The first testbed is the 2D Ising model on a 16×16 torus. Parameters are inverse temperature and field, extended to $D$ up to 10 with anisotropic and next-nearest-neighbour couplings. At zero field and nearest-neighbour coupling, exact finite-lattice partition functions give ground truth on a slice. Elsewhere, ground truth comes from long cluster or reweighting runs. Metrics are root-mean-square error of $F$ on 1,000 held-out parameter points, coverage of 95% intervals, and error as a function of cumulative GPU-hours. The decisive check is whether the learned cost surface peaks at the critical line, and whether the method beats the space-filling and reweighting baselines in total compute at equal error.

$\phi^4$ and the mode-collapse check. The second testbed is 2D $\phi^4$ theory over mass, quartic coupling, and added couplings up to $D=20$. It uses lattice sizes from the original flow study and the 16×8 broken-phase setting of the mode-collapse study. Here the decisive check is the diagnostic. We deliberately train collapsed flows in the broken phase and measure how often the bias term flags them, compared with forward-chain diagnosis at matched compute. We also run asymmetric variants, where the symmetry argument does not hold, to find where the check stops working.

Molecular systems. The third testbed uses FEAT's alanine dipeptide and Lennard-Jones (LJ-55) setups, perturbing up to 40 force-field parameters: torsion scalings, Lennard-Jones well depths and radii. We check single-point agreement with FEAT's published behaviour, then compare surface error against the reweighting and amortized baselines. If these hold, a stretch goal follows the 41-parameter coarse-grained polymer setting of Bayesian Optimization for High-Dimensional Coarse-Grained Model Parameterization, which used forward molecular dynamics for every evaluation. We would ask how many direct free-energy evaluations replace those runs for the free-energy-dependent part of its objective.

Outcome criterion. The proposal succeeds if three things hold. Gradient fusion must beat reweighting and amortized flows by at least a factor of two in compute at $D \ge 10$. The cost-aware rule must spend measurably less near critical regions without losing calibration. The consistency check must catch symmetric mode collapse that the flow's own estimates hide.