Chapter 26

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 Δt\sqrt{\Delta t} 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 ∇log⁡pt\nabla \log p_t (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.

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.

Table 26.1. Notation for the dynamics chapter.
SymbolMeaningFirst used in
x(t)∈Rd\mathbf x(t)\in\mathbb R^d, x˙\dot{\mathbf x}state, its time derivativeSection 26.1
x0\mathbf x_0state at t=0t=0: the start of a trajectory; for a noising process, a data pointSection 26.1
f(x,t)\mathbf f(\mathbf x,t)vector field of an ODE; drift of an SDESection 26.1; Section 26.4
Φt\Phi_t; Φs→t\Phi_{s\to t}flow map, Φt(x0)=x(t)\Phi_t(\mathbf x_0)=\mathbf x(t); the map from the state at time ss to the state at time ttSection 26.1
LLLipschitz constant of f\mathbf fSection 26.1
TTfinal time (horizon)Section 26.1
A\mathbf A; λj=aj+i bj\lambda_j=a_j+\mathrm i\,b_j; V\mathbf V, Λ\boldsymbol\Lambdamatrix of a linear field x˙=Ax\dot{\mathbf x}=\mathbf A\mathbf x; its eigenvalues; matrix of eigenvectors, diagonal matrix of eigenvaluesSection 26.1
λ\lambdaan eigenvalue of A\mathbf A or of a Jacobian; for the reverse-time samplers, the multiple λg\lambda g of the noise amplitude that they injectSection 26.1; Section 26.5
K\mathbf Kmatrix (0−110)\left(\begin{smallmatrix}0&-1\\1&0\end{smallmatrix}\right) of the rotation x˙=Kx\dot{\mathbf x}=\mathbf K\mathbf xSection 26.1
J\mathbf JJacobian of f\mathbf fSection 26.1
x⋆\mathbf x^\starfixed point of a field, f(x⋆)=0\mathbf f(\mathbf x^\star)=\mathbf 0; for a gradient flow, a critical point of the lossSection 26.1
u(t)\mathbf u(t), B\mathbf Ban input and its matrix, in x˙=Ax+Bu(t)\dot{\mathbf x}=\mathbf A\mathbf x+\mathbf B\mathbf u(t)Section 26.1
hh, tn=nht_n=nh, xn\mathbf x_nstep size (written Δt\Delta t in Section 26.4 and Section 26.5), time grid, state at tnt_n (exact, or a solver's iterate)Section 26.1; Section 26.2
Aˉ\bar{\mathbf A}, Bˉ\bar{\mathbf B}exact step with the input held over hh, xn+1=Aˉxn+Bˉun\mathbf x_{n+1}=\bar{\mathbf A}\mathbf x_n+\bar{\mathbf B}\mathbf u_nSection 26.1
R(z)R(z), z=hλz=h\lambdastability function of a solverSection 26.2
εn\varepsilon_nglobal error ∥xn−x(tn)∥\lVert\mathbf x_n-\mathbf x(t_n)\rVertSection 26.2
L\mathcal L, η\eta, H\mathbf Hloss, learning rate, HessianSection 26.1; Section 26.2
NNnumber of steps to the final time: solver steps n=1,…,Nn=1,\ldots,N with Nh=TNh=T (the first two sections write nn for this number as well); in Section 26.6 also the noise levels t=1,…,Nt=1,\ldots,N of DDPMSection 26.3
θ\boldsymbol\thetanetwork parametersSection 26.3
a(t)\mathbf a(t)adjoint stateSection 26.3
ptp_tdensity of the state at time ttSection 26.3
ϵ\boldsymbol\epsilonin Section 26.3, the random probe of the trace estimator; from Section 26.4 on, standard Gaussian noise, as in xt=αtx0+σtϵ\mathbf x_t=\alpha_t\mathbf x_0+\sigma_t\boldsymbol\epsilon, which Section 26.7 also writes x1\mathbf x_1, the noise endpointSection 26.3; Section 26.4
Xt\mathbf X_t (XtX_t in one dimension)state of a stochastic process at time tt, a random variable; x\mathbf x is a value it takesSection 26.4
Wt\mathbf W_tBrownian motionSection 26.4
gg, g(t)g(t); G\mathbf Gnoise amplitude of an SDE (its diffusion coefficient), constant or varying in time; noise matrixSection 26.4
θ\thetarate of the OU process dX=−θX dt+g dWdX=-\theta X\,dt+g\,dW; in the scalar example of Section 26.3, the parameter of x˙=θx\dot x=\theta xSection 26.3; Section 26.4
αt\alpha_t, σt\sigma_tmean factor and standard deviation of Xt\mathbf X_t given X0\mathbf X_0; σt\sigma_t is the noise levelSection 26.4
ϕ\phia 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
ψ\psia smooth scalar field, in the vector-calculus preliminariesSection 26.5
st=∇log⁡pt\mathbf s_t=\nabla\log p_t; sθ\mathbf s_{\boldsymbol\theta}score; learned scoreSection 26.5; Section 26.6
ut\mathbf u_t; uθ\mathbf u_{\boldsymbol\theta}velocity that transports ptp_t (the probability-flow velocity), unrelated to the input u(t)\mathbf u(t); learned velocitySection 26.5; Section 26.7
j\mathbf jprobability currentSection 26.5
tˉ=T−t\bar t=T-treversed clockSection 26.5
wkw_k, rk(x)r_k(\mathbf x), vkv_kmixture weights, responsibilities, component variancesSection 26.5
β(t)\beta(t); βt\beta_t, αˉt\bar\alpha_trate of the variance-preserving SDE; noise schedule of DDPM, about β(t)\beta(t) times the step (written βk\beta_k in Section 26.4), and its running product αˉt=∏s≤t(1−βs)\bar\alpha_t=\prod_{s\le t}(1-\beta_s), which is our αt2\alpha_t^2Section 26.4; Section 26.6
xˉt\bar{\mathbf x}_t, σˉt\bar\sigma_tDDIM coordinates: the rescaled point xt/αˉt\mathbf x_t/\sqrt{\bar\alpha_t} and its ratio of noise to signal (1−αˉt)/αˉt\sqrt{(1-\bar\alpha_t)/\bar\alpha_t}Section 26.6
w(t)w(t); γ\gammaweight of noise level tt in the loss; guidance scaleSection 26.6
π\picoupling: a joint law of pairs of data and noise, also called a pairingSection 26.7
i\mathrm i, I\mathbf Iimaginary unit (upright), identity matrixthroughout