38  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 \(\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 38.2), while straighter transport paths enable few-step generation (Section 38.7.2). Along the way, driven linear ODEs yield the recurrence of state space models (Section 38.1.2.3, Section 12.4), and deep residual networks (Section 7.4) pass to neural ODEs and continuous normalizing flows (Section 38.3). Second, stochastic calculus repairs the chain rule (Section 38.4) and tracks cloud densities through the Fokker–Planck equation, showing that time reversal requires only the score \(\nabla \log p_t\) (Section 38.5). Third, least-squares regression on noisy or interpolated pairs learns the score or marginal velocity directly without ground-truth field labels (Section 38.6, Section 38.7).

Readers headed straight for Chapter 17 may skip the continuous adjoint method (Section 38.3.2) and optimal transport (Section 38.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 33.3), Jacobians (Section 34.4.1), and Gaussian conditioning, without measure theory.

Notation

Table 38.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 38.1: Notation for the dynamics chapter.
Symbol Meaning First used in
\(\mathbf x(t)\in\mathbb R^d\), \(\dot{\mathbf x}\) state, its time derivative Section 38.1
\(\mathbf x_0\) state at \(t=0\): the start of a trajectory; for a noising process, a data point Section 38.1
\(\mathbf f(\mathbf x,t)\) vector field of an ODE; drift of an SDE Section 38.1; Section 38.4
\(\Phi_t\); \(\Phi_{s\to t}\) flow map, \(\Phi_t(\mathbf x_0)=\mathbf x(t)\); the map from the state at time \(s\) to the state at time \(t\) Section 38.1
\(L\) Lipschitz constant of \(\mathbf f\) Section 38.1
\(T\) final time (horizon) Section 38.1
\(\mathbf A\); \(\lambda_j=a_j+\mathrm i\,b_j\); \(\mathbf V\), \(\boldsymbol\Lambda\) matrix of a linear field \(\dot{\mathbf x}=\mathbf A\mathbf x\); its eigenvalues; matrix of eigenvectors, diagonal matrix of eigenvalues Section 38.1
\(\lambda\) an eigenvalue of \(\mathbf A\) or of a Jacobian; for the reverse-time samplers, the multiple \(\lambda g\) of the noise amplitude that they inject Section 38.1; Section 38.5
\(\mathbf K\) matrix \(\left(\begin{smallmatrix}0&-1\\1&0\end{smallmatrix}\right)\) of the rotation \(\dot{\mathbf x}=\mathbf K\mathbf x\) Section 38.1
\(\mathbf J\) Jacobian of \(\mathbf f\) Section 38.1
\(\mathbf x^\star\) fixed point of a field, \(\mathbf f(\mathbf x^\star)=\mathbf 0\); for a gradient flow, a critical point of the loss Section 38.1
\(\mathbf u(t)\), \(\mathbf B\) an input and its matrix, in \(\dot{\mathbf x}=\mathbf A\mathbf x+\mathbf B\mathbf u(t)\) Section 38.1
\(h\), \(t_n=nh\), \(\mathbf x_n\) step size (written \(\Delta t\) in Section 38.4 and Section 38.5), time grid, state at \(t_n\) (exact, or a solver’s iterate) Section 38.1; Section 38.2
\(\bar{\mathbf A}\), \(\bar{\mathbf B}\) exact step with the input held over \(h\), \(\mathbf x_{n+1}=\bar{\mathbf A}\mathbf x_n+\bar{\mathbf B}\mathbf u_n\) Section 38.1
\(R(z)\), \(z=h\lambda\) stability function of a solver Section 38.2
\(\varepsilon_n\) global error \(\lVert\mathbf x_n-\mathbf x(t_n)\rVert\) Section 38.2
\(\mathcal L\), \(\eta\), \(\mathbf H\) loss, learning rate, Hessian Section 38.1; Section 38.2
\(N\) number of steps to the final time: solver steps \(n=1,\ldots,N\) with \(Nh=T\) (the first two sections write \(n\) for this number as well); in Section 38.6 also the noise levels \(t=1,\ldots,N\) of DDPM Section 38.3
\(\boldsymbol\theta\) network parameters Section 38.3
\(\mathbf a(t)\) adjoint state Section 38.3
\(p_t\) density of the state at time \(t\) Section 38.3
\(\boldsymbol\epsilon\) in Section 38.3, the random probe of the trace estimator; from Section 38.4 on, standard Gaussian noise, as in \(\mathbf x_t=\alpha_t\mathbf x_0+\sigma_t\boldsymbol\epsilon\), which Section 38.7 also writes \(\mathbf x_1\), the noise endpoint Section 38.3; Section 38.4
\(\mathbf X_t\) (\(X_t\) in one dimension) state of a stochastic process at time \(t\), a random variable; \(\mathbf x\) is a value it takes Section 38.4
\(\mathbf W_t\) Brownian motion Section 38.4
\(g\), \(g(t)\); \(\mathbf G\) noise amplitude of an SDE (its diffusion coefficient), constant or varying in time; noise matrix Section 38.4
\(\theta\) rate of the OU process \(dX=-\theta X\,dt+g\,dW\); in the scalar example of Section 38.3, the parameter of \(\dot x=\theta x\) Section 38.3; Section 38.4
\(\alpha_t\), \(\sigma_t\) mean factor and standard deviation of \(\mathbf X_t\) given \(\mathbf X_0\); \(\sigma_t\) is the noise level Section 38.4
\(\phi\) 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 38.4
\(\psi\) a smooth scalar field, in the vector-calculus preliminaries Section 38.5
\(\mathbf s_t=\nabla\log p_t\); \(\mathbf s_{\boldsymbol\theta}\) score; learned score Section 38.5; Section 38.6
\(\mathbf u_t\); \(\mathbf u_{\boldsymbol\theta}\) velocity that transports \(p_t\) (the probability-flow velocity), unrelated to the input \(\mathbf u(t)\); learned velocity Section 38.5; Section 38.7
\(\mathbf j\) probability current Section 38.5
\(\bar t=T-t\) reversed clock Section 38.5
\(w_k\), \(r_k(\mathbf x)\), \(v_k\) mixture weights, responsibilities, component variances Section 38.5
\(\beta(t)\); \(\beta_t\), \(\bar\alpha_t\) rate of the variance-preserving SDE; noise schedule of DDPM, about \(\beta(t)\) times the step (written \(\beta_k\) in Section 38.4), and its running product \(\bar\alpha_t=\prod_{s\le t}(1-\beta_s)\), which is our \(\alpha_t^2\) Section 38.4; Section 38.6
\(\bar{\mathbf x}_t\), \(\bar\sigma_t\) DDIM coordinates: the rescaled point \(\mathbf x_t/\sqrt{\bar\alpha_t}\) and its ratio of noise to signal \(\sqrt{(1-\bar\alpha_t)/\bar\alpha_t}\) Section 38.6
\(w(t)\); \(\gamma\) weight of noise level \(t\) in the loss; guidance scale Section 38.6
\(\pi\) coupling: a joint law of pairs of data and noise, also called a pairing Section 38.7
\(\mathrm i\), \(\mathbf I\) imaginary unit (upright), identity matrix throughout