- Home
- Library
- Computational Quantum Field Theory
- Learning to Sample Field Configurations
- Diffusion and Score-Based Field Models
Diffusion and Score-Based Field Models
Can adding noise make a field easier to sample? For a finite Gaussian field the answer can be demonstrated exactly: noise gradually removes its correlations, and a known score reverses that process. For an interacting field, however, a small denoising loss does not establish that the generated configurations have the right distribution. The score must be learned, the reverse equation must be integrated, and the terminal noise distribution must be specified.
We will keep those errors separate. A two-site Euclidean scalar provides an exact Gaussian control and an interacting target with independent reference integrals. One fitted score produces useful but visibly biased samples. Refining its deterministic transport almost eliminates the integration error while leaving the observable bias.
Preparation: Multivariate Gaussian conditioning, Itô diffusion, and the finite scalar measure in learning a field observable. All times below parameterize a sampling procedure; they are not physical real or Euclidean time.
A finite field with an independent reference
Take two periodic sites, lattice spacing one, and the positive Euclidean action
Both kinetic summands are present. The orthonormal coordinates and have unit absolute Jacobian. For ,
The normalized measure is . We fix and . These are finite-regulator inputs, with no continuum or volume extrapolation. Setting gives the Gaussian control
The interacting target also has a simple exact reference sampler. Draw from and accept with probability
Then is proportional to . The acceptance is , where . Moreover, Gaussian moments give , so Jensen's inequality gives acceptance at least . The normalizing constant is unnecessary for accepting samples.
The numerical example reuses checked quadrature from the preceding chapter:
Orders through , an adaptive integration and an omitted-tail bound were already checked for this same action. New rejection draws supply training and testing fields. They are independent target draws, not configurations from a chain whose mixing must be assumed.
Noising and the score
Use the Ornstein–Uhlenbeck process
where is independent of . The marginal tends to the standard Gaussian as . At a finite terminal time , it generally is not exactly that Gaussian.
The score is . Differentiating the convolution defining yields
The Gaussian conditional score inside the expectation is known for each noisy training pair. It is not itself the marginal score: many clean fields can produce the same noisy field. Conditional expectation is the reason denoising score matching works.
For the free field, the convolution remains Gaussian:
No training is needed to test a reverse solver against this control. The general noising and denoising-score construction is developed by Song et al., §§3.1–3.3, Eqs. (5)–(7).
Reverse stochastic evolution and probability flow
Write , so increases while noise is removed. The reverse stochastic equation and the deterministic probability-flow equation are
The different coefficients of the score are essential. The forward Fokker–Planck equation is
Thus the forward deterministic velocity is ; changing to gives the second line of (9). The reverse diffusion retains a noise term and requires twice that score contribution. With the exact compatible score and the actual terminal law , the two equations have the same time marginals, although their individual trajectories differ. See Song et al., §3.2 and Appendix D.1, Eqs. (35)–(37).
For the diagonal Gaussian control, the deterministic map is explicit:
If , the output has covariance . If we initialize with instead, its covariance is . The stochastic process responds differently. Its linear propagation of initial conditions is , giving
For , the wrong-terminal deterministic output has variances ; the stochastic output has . Both differ from despite using the exact score. At those errors are much smaller. This is a terminal-law effect, not a discretization or fitting error.
The companion checks the exact conditional Gaussian reverse kernels, Euler covariance recursion and RK4 propagation over fixed refinements. It also removes the noise while retaining the stochastic drift as a negative control. That incorrect ODE compresses the distribution toward zero; reducing its step size cannot repair the missing factor of one half.
A trained score that remains globally well defined
For the interacting example fix and use
The are Legendre polynomials. There are real fitted coefficients. This is a finite feature model, not a neural network. Its potential is even separately in and , so its score respects those symmetries.
The bounded nonlinear features have another purpose. Their gradients and Hessians are bounded, making the learned ODE globally Lipschitz and its drift bounded; the learned SDE has a linear confining part plus a bounded correction. Both evolutions are globally well posed on the finite interval. An unrestricted polynomial score could instead produce finite-time escape in a reverse ODE, invalidating a claimed global density map.
At every time, (13) is the gradient of a normalizable Gaussian potential plus a bounded correction. That fact does not make its time-dependent potentials compatible with the OU equation. Consequently its learned stochastic and deterministic samplers need not have the same marginals. Its bounded correction also cannot reproduce the cubic clean-field score throughout all tails.
Train once on independent clean fields, independent uniform times in , and independent Gaussian noises. Minimize
This objective is quadratic in . The implementation forms the weighted response , avoiding division by a small noise scale, and solves the augmented ridge problem by an SVD. The fit uses no exact interacting score values. A separate -pair set measures held-out denoising loss.
The unregularized design has condition number ; the augmented design has condition number . The recomputed scaled gradient is , below the prescribed target. Nevertheless, the held-out weighted loss hides a substantial clean-field error. Independent conditional Gaussian quadrature gives componentwise score RMSE at , at , and at . Comparing with the exact at gives RMSE . The fixed quadrature refinement changes the reference scores by at most on the tested points.
Near , the weight becomes small. A well-solved weighted regression therefore need not give a highly accurate endpoint score. This numerical fit illustrates that distinction without changing the model after inspecting its error.
Measure the generated fields
The frozen model generates independent trajectories per setting from a standard Gaussian terminal law. Euler uses reverse steps. RK4 uses steps, matching the three budgets of score evaluations per trajectory. Initial Gaussian vectors are shared, and nested Brownian increments couple the stochastic refinements. The errors below are iid standard errors conditional on this one fitted model, not uncertainty from repeated training.
| Transport | Score evaluations | ||
|---|---|---|---|
| Exact target | — | ||
| Euler SDE | |||
| Euler SDE | |||
| Euler SDE | |||
| RK4 ODE | |||
| RK4 ODE |
The deterministic sample means are stable under refinement, but their bias remains. The stochastic means still move with the step size and also remain above the target. Neither observation licenses an extrapolation that all remaining bias is purely score error.
The prespecified fourth moment makes the tail limitation more visible. At the finest grids, is for the ODE and for the SDE, against the reference . These are finite-sample diagnostics, not precision determinations of the far-tail density. They nevertheless expose a failure that the low weighted denoising loss and the small ODE integration error did not detect.
The Gaussian panel isolates a terminal-law error without sampling or fitting. The interacting panels show uncorrected bias with one standard error from generated fields, conditional on the frozen score fit. Small deterministic step error does not remove the model's observable bias.
A final paired control starts the finest transports with the actual interacting terminal law, generated as from independent exact target fields. Its shifts in are for the SDE and for the ODE, all unresolved against their paired standard errors. Initialization is not the dominant resolved problem at this .
These are uncorrected samples. A continuous ODE can supply its own density through a Jacobian equation, but numerical density error must be assessed. A stochastic trajectory supplies transition densities; multiplying them gives a path density, not its endpoint marginal. The next page, continuous and stochastic normalizing flows, derives these distinctions and a valid extended-path ratio.
The companion files under examples/computational-qft/generative-models/ retain the fitted coefficients in score-model.json, fit checks in score-training-results.json, and endpoint comparisons in diffusion-results.json. They include fixed seeds, moment covariance matrices, rejection counts and all prescribed refinements. Exact rejection is already efficient for this teaching target; no high-dimensional speed or continuum claim follows.
Summary
Noising provides a tractable conditional distribution and hence a trainable score objective. Exact reverse recovery additionally needs a compatible score, the correct terminal law and adequate integration. The Gaussian control separates these requirements. The interacting calculation shows why optimizer convergence and a small weighted loss cannot replace measurements of the generated physical observables.
Exercises
1. A wrong terminal covariance
For one Gaussian mode, let . Derive the deterministic map, the conditional law of given , and the final ODE and reverse-SDE variances when the terminal variance is instead of . Check and for .
Solution
The deterministic reverse velocity is . Since , its solution is . Thus the final variance is .
The joint forward covariance satisfies . Gaussian conditioning gives
Composing the conditional means from to gives . With the correct terminal variance, the exact reverse SDE ends at . Changing only the initial variance adds , so
At both answers equal , as no transport occurs. For and , both approach . Their leading terminal errors differ: the ODE correction is of order , while the SDE correction is of order . Equality of the two marginals cannot be inferred after replacing the prescribed terminal law by another one.
2. What does the denoising loss learn?
Let for . Show that minimizing over all square-integrable functions gives the marginal score. Explain why weighting by , restricting the feature family and imposing symmetry do not prove exact reverse recovery.
Solution
Condition on . Differentiating its positive Gaussian convolution gives . Orthogonality of conditional expectation yields
The second term is independent of , so the unconstrained minimum is attained by . A positive time weight leaves this pointwise optimum unchanged, but changes how a restricted family compromises among times. Here multiplying by gives the linear response and design columns ; the ridge penalty further changes the optimum.
Exact symmetry constrains allowed functions without determining their values. A conservative vector field may be a score of some normalized density at each time while those densities fail the forward Fokker–Planck equation. Reverse recovery requires the actual compatible marginal scores and terminal distribution, not only a gradient representation, symmetry or a small empirical weighted loss.
References
- Song, Yang, Jascha Sohl-Dickstein, Diederik P. Kingma, Abhishek Kumar, Stefano Ermon and Ben Poole. “Score-Based Generative Modeling through Stochastic Differential Equations.” arXiv:2011.13456v2, HTML (2021), §§3.1–3.4 and 4.3; Appendix D.1, Eqs. (35)–(37). The increasing reverse-time convention in (9) is translated explicitly above.
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.