Density Evolution

Chapter 20 Dynamics & diffusion

Chapter 20: ODE, SDE, and Continuous Limits of Algorithms — Probability Flow ODE & Continuity Equation

From the book

Chapter 20: ODE, SDE, and Continuous Limits of Algorithms. In the chapter mind map this icon labels Probability Flow ODE & Continuity Equation. The discussion below is excerpted and lightly edited from § Probability Flow ODE in Mathematics for AI and Machine Learning.

Let the forward SDE be @eq:sde-definition-recap with state-independent diffusion $\mathbf{G}(t)$ and marginal densities $p_t(\mathbf{x})$, and let $\mathbf{a}(t) = \mathbf{G}(t)\mathbf{G}(t)^\top$. Its probability flow ODE is

It has no noise term, its solution from each starting point is unique, and its marginals are those of the SDE. More generally, for every $\lambda \ge 0$ the process $d\mathbf{X}_t = \big(\mathbf{f} - \frac{1-\lambda^2}{2}\mathbf{a}\nabla\log p_t\big)dt + \lambda\mathbf{G}\,d\mathbf{W}_t$ has the same marginals, since its extra diffusion $\frac{\lambda^2}{2}\nabla\cdot(\mathbf{a}\nabla p_t)$ cancels its extra drift; $\lambda = 1$ is the SDE and $\lambda = 0$ the ODE. To see this, require that the ODE and the SDE produce the same equation for $p_t$. The Fokker–Planck equation of the SDE,

can be rewritten in continuity equation form $\partial_t p_t + \nabla \cdot \mathbf{J}_t = 0$, where $\mathbf{J}_t$ is the probability current. For an ODE $\frac{d\mathbf{X}_t}{dt} = \mathbf{v}(\mathbf{X}_t, t)$ the continuity equation is $\partial_t p_t + \nabla \cdot (p_t \mathbf{v}) = 0$. Matching the two forms gives $\mathbf{v}$. For state-independent $\mathbf{a}$, $\frac{1}{2}\nabla \cdot \nabla(\mathbf{a}p_t) = \frac{1}{2}\nabla \cdot (\mathbf{a}\nabla p_t) = \nabla \cdot \big(\tfrac{1}{2}p_t\,\mathbf{a}\nabla\log p_t\big)$, because $\nabla p_t = p_t\nabla\log p_t$, so the Fokker–Planck equation is $\partial_t p_t + \nabla \cdot \big(p_t(\mathbf{f} - \frac{1}{2}\mathbf{a}\nabla\log p_t)\big) = 0$, a continuity equation with velocity $\mathbf{v} = \mathbf{f} - \frac{1}{2}\mathbf{a}\nabla\log p_t$.

The score function enters through the correction $-\frac{1}{2}\mathbf{a}(t)\nabla_{\mathbf{x}}\log p_t(\mathbf{X}_t)$, which replaces the diffusion of the SDE. It points against the score, down the density gradient, and moves probability mass outward deterministically at the rate the noise would have spread it: for $d\mathbf X_t = d\mathbf W_t$ started from $\mathcal N(\mathbf 0, s_0^2 I)$, the ODE $\frac{d\mathbf x}{dt} = \frac{\mathbf x}{2(s_0^2+t)}$ scales $\mathbf x_t$ to variance $s_0^2+t$, exactly as the diffusion does. In reverse time (generation), the same term moves mass uphill toward the modes.

In fluid terms, the SDE moves probability by advection with the drift $\mathbf{f}$ plus diffusion, while the ODE uses advection alone, with the extra velocity $-\frac12\mathbf{a}\nabla\log p_t$ in place of the diffusion. the book figure shows the score field $\nabla \log p$ pointing toward the modes; the forward correction reverses these arrows.

What this drawing shows

What you see. Shows a probability density $p(x,t)$ spreading and flattening under Fokker–Planck diffusion from $t_0$ to $t_1$.

In the mind map. Chapter 20 — Probability Flow ODE & Continuity Equation. See From the book above for definitions, figures, and worked examples.

Where to read next

Open Chapter 20 companion →

Read the full definitions, figures, and worked examples in Chapter 20: ODE, SDE, and Continuous Limits of Algorithms — see the mind-map node Probability Flow ODE & Continuity Equation.

PNG Icons

Textless (256×256 px)
PNG 256×256 px Copy PNG URL
Textless (64×64 px)
PNG 64×64 px Copy PNG URL
Textless (32×32 px)
PNG 32×32 px Copy PNG URL

Animated GIFs

Animated GIF (256×256 px)
GIF 256×256 px Copy GIF URL
Animated GIF (128×128 px)
GIF 128×128 px Copy GIF URL
Animated GIF (64×64 px)
GIF 64×64 px Copy GIF URL