26 Dynamics: Differential Equations and Generative Flows
A residual network adds a small update to its input at every layer, gradient descent nudges weights downhill step by step, and a diffusion model turns noise into an image along a learned vector field. All three discretize differential equations—rules specifying how fast a state changes. Two practical questions follow immediately: how few steps can a sampler take, and how can we learn the velocity or score direction from example images alone?
Adding noise gradually to training images answers the second question from the reverse end. Although each noisy particle wanders unpredictably, the density of the whole cloud evolves deterministically, and reversing that evolution turns Gaussian noise back into data. Earlier chapters stop short of this machinery: backpropagation differentiates a fixed computation graph rather than an ODE solution, static probability does not track moving densities, and Brownian increments of order break the ordinary chain rule.
The chapter unfolds in three stages. First, deterministic ODEs move single states exactly and numerically: the fastest decaying mode caps the step size of gradient descent and every explicit Runge–Kutta solver (Section 26.2), while straighter transport paths enable few-step generation (Section 26.7.2). Along the way, driven linear ODEs yield the recurrence of state space models (Section 26.1.2.3, Section 12.4), and deep residual networks (Section 7.4) pass to neural ODEs and continuous normalizing flows (Section 26.3). Second, stochastic calculus repairs the chain rule (Section 26.4) and tracks cloud densities through the Fokker–Planck equation, showing that time reversal requires only the score (Section 26.5). Third, least-squares regression on noisy or interpolated pairs learns the score or marginal velocity directly without ground-truth field labels (Section 26.6, Section 26.7).
Readers headed straight for Chapter 17 may skip the continuous adjoint method (Section 26.3.2) and optimal transport (Section 26.7.3) on a first pass. Most experiments here test samplers on closed-form vector fields so discretization errors can be isolated cleanly. We assume eigendecompositions (Section 21.3), Jacobians (Section 22.4.1), and Gaussian conditioning, without measure theory.
- 26.1 Ordinary Differential Equations
- 26.2 Numerical Solvers
- 26.3 Neural ODEs, Adjoints, and Continuous Flows
- 26.4 Stochastic Differential Equations
- 26.5 The Fokker--Planck Equation and Probability Flow
- 26.6 Score Matching and Diffusion Models
- 26.7 Flow Matching and Optimal Transport
- 26.8 Further Reading
Notation#
Table 26.1 lists the symbols that recur from one section to the next. Each section restates the ones it needs and defines the letters it uses only once. Where a letter in the table carries two meanings, its row says where each one holds.
| Symbol | Meaning | First used in |
|---|---|---|
| , | state, its time derivative | Section 26.1 |
| state at : the start of a trajectory; for a noising process, a data point | Section 26.1 | |
| vector field of an ODE; drift of an SDE | Section 26.1; Section 26.4 | |
| ; | flow map, ; the map from the state at time to the state at time | Section 26.1 |
| Lipschitz constant of | Section 26.1 | |
| final time (horizon) | Section 26.1 | |
| ; ; , | matrix of a linear field ; its eigenvalues; matrix of eigenvectors, diagonal matrix of eigenvalues | Section 26.1 |
| an eigenvalue of or of a Jacobian; for the reverse-time samplers, the multiple of the noise amplitude that they inject | Section 26.1; Section 26.5 | |
| matrix of the rotation | Section 26.1 | |
| Jacobian of | Section 26.1 | |
| fixed point of a field, ; for a gradient flow, a critical point of the loss | Section 26.1 | |
| , | an input and its matrix, in | Section 26.1 |
| , , | step size (written in Section 26.4 and Section 26.5), time grid, state at (exact, or a solver's iterate) | Section 26.1; Section 26.2 |
| , | exact step with the input held over , | Section 26.1 |
| , | stability function of a solver | Section 26.2 |
| global error | Section 26.2 | |
| , , | loss, learning rate, Hessian | Section 26.1; Section 26.2 |
| number of steps to the final time: solver steps with (the first two sections write for this number as well); in Section 26.6 also the noise levels of DDPM | Section 26.3 | |
| network parameters | Section 26.3 | |
| adjoint state | Section 26.3 | |
| density of the state at time | Section 26.3 | |
| in Section 26.3, the random probe of the trace estimator; from Section 26.4 on, standard Gaussian noise, as in , which Section 26.7 also writes , the noise endpoint | Section 26.3; Section 26.4 | |
| ( in one dimension) | state of a stochastic process at time , a random variable; is a value it takes | Section 26.4 |
| Brownian motion | Section 26.4 | |
| , ; | noise amplitude of an SDE (its diffusion coefficient), constant or varying in time; noise matrix | Section 26.4 |
| rate of the OU process ; in the scalar example of Section 26.3, the parameter of | Section 26.3; Section 26.4 | |
| , | mean factor and standard deviation of given ; is the noise level | Section 26.4 |
| a smooth function of the state: the function in Itô's lemma and the test function behind the Fokker--Planck equation (elsewhere an angle) | Section 26.4 | |
| a smooth scalar field, in the vector-calculus preliminaries | Section 26.5 | |
| ; | score; learned score | Section 26.5; Section 26.6 |
| ; | velocity that transports (the probability-flow velocity), unrelated to the input ; learned velocity | Section 26.5; Section 26.7 |
| probability current | Section 26.5 | |
| reversed clock | Section 26.5 | |
| , , | mixture weights, responsibilities, component variances | Section 26.5 |
| ; , | rate of the variance-preserving SDE; noise schedule of DDPM, about times the step (written in Section 26.4), and its running product , which is our | Section 26.4; Section 26.6 |
| , | DDIM coordinates: the rescaled point and its ratio of noise to signal | Section 26.6 |
| ; | weight of noise level in the loss; guidance scale | Section 26.6 |
| coupling: a joint law of pairs of data and noise, also called a pairing | Section 26.7 | |
| , | imaginary unit (upright), identity matrix | throughout |