Part 5 of 5

Flows Without Steps

Every flow so far was a stack of discrete layers. Now take the limit: infinitely many, infinitesimally small. The stack becomes a velocity field, the ledger becomes an integral, and the awkward training problem gets a fix so simple it powers today's best image and video generators.

Section 1Taking the limit

From a stack of layers to a field of arrows

A residual-flavored layer nudges each point a little: x ← x + ε·v(x). Stack K of them with ε = 1/K and let K → ∞, and the discrete stack becomes a differential equation. The model is no longer a list of matrices; it is one velocity field v(x, t) — an arrow at every location and every moment — and a point's journey is what you get by following the arrows:

dx(t)dt = v(x(t),t) , x(0)∼pbell

This is a continuous normalizing flow (CNF), introduced with Neural ODEs in 2018. Two of Part 1's house rules now come free rather than by construction. No tearing: solutions of a well-behaved ODE depend continuously on where they started. No folding: two trajectories can never meet, because at a meeting point the field would have to point two ways at once — so invertibility is automatic, and you undo the flow by simply integrating backwards in time. No triangular Jacobians, no masks, no architectural contortions at all: v can be any neural network.

What the limit buys

Discrete flows had to be built from invertible pieces. A continuous flow is invertible because trajectories cannot cross — the constraint moves from the architecture into the mathematics, and the network is finally unconstrained.

Section 2The ledger becomes an integral

Divergence: the receipt rate

If layers dissolve into a field, what happens to the log-det ledger? It becomes an integral of a rate. The instantaneous change-of-variables formula says that as a point rides the field, its log-density falls at exactly the rate at which the field spreads space apart there — the divergence, tr(∂v/∂x):

ddt logp(x(t),t) =− tr (∂v∂x)
A trace, not a determinant. Part 2's O(d³) determinant has become an O(d) sum along the diagonal — and in practice even that is estimated stochastically (Hutchinson's trick), making the cost independent of dimension.

The physical reading is worth pausing on: this is the continuity equation of fluid mechanics, ∂p/∂t + ∇·(pv) = 0 — the statement that probability is a fluid that is transported, never created or destroyed. Part 1's clay has become water, and the whole subject is revealed as transport.

Below is a real continuous flow with an exactly known field: it carries a plain 2-D bell curve into a two-blob mixture, and every arrow, trajectory and density you see is computed from the closed-form velocity — which satisfies the continuity equation to one part in a million. Scrub time, or watch it run.

Interactive · a continuous flow, exactly scrub time · toggle the views

Turn on divergence and watch where the receipts are paid: red where the field pulls space apart (density thinning), blue where it converges (density concentrating). Notice the arrows never cross and the trails never touch — that is invertibility, visible.

Section 3The problem, and the fix

Why nobody could train these — until they could

CNFs were beautiful and nearly unusable. To get one log-likelihood you had to numerically integrate the ODE — dozens to hundreds of network evaluations per sample — and then backpropagate through the solver (or through an adjoint ODE) for every gradient step. Worse, as training sharpened the field, the ODE grew stiff and the solver silently spent more and more steps. Training was measured in GPU-weeks for results discrete flows got in hours.

The fix, arriving around 2022 as flow matching (and rectified flow, and stochastic interpolants — three groups, one idea), is almost embarrassing in hindsight. Stop asking the model to discover a path. Choose the path yourself, then teach the network to name its velocity. Pick a noise sample z and a data sample x, and simply interpolate along the straight line between them:

xt= (1−t)z +tx , loss= ‖ vθ(xt,t) −(x−z) ‖2
A plain regression. No ODE solve, no determinant, no divergence, no trace — during training the network never integrates anything. The target velocity for this pair is the constant x − z.

The magic is in what the regression converges to. Any individual pair's straight line is “wrong” — it ignores every other pair. But the least-squares solution at each point is the conditional average of all the velocities passing through it, and that average field is provably the one whose transport carries noise exactly onto the data distribution. Each training example is a noisy, unbiased hint about the true field; averaging is the whole algorithm.

The old way · maximum likelihood CNF
Integrate the ODE forward, accumulate the divergence, differentiate through the solver. Exact likelihoods, exquisite cost, stiff fields. Every gradient step pays for hundreds of network calls.
The new way · flow matching
Sample a pair, sample a time, regress one velocity. One network call per step. Likelihoods are still available afterward by integrating — you just don't pay for them during training.
Section 4Straightness is speed

Why anyone cares: fewer steps at generation time

Training got cheap; generating still means solving an ODE. Here the choice of interpolation path pays a second dividend. If the learned trajectories are nearly straight, a crude solver with very few steps tracks them well — and straight-line interpolation is exactly what encourages that. Push further with rectified flow: generate pairs from the trained model, retrain on those (now better-aligned) pairs, and the paths straighten further, until a handful of steps — sometimes one — suffices.

Below, the same generative task is solved by a curved field and a straightened one, both integrated with the same crude Euler solver. Drag the step budget down and watch which one survives.

Interactive · curvature vs step budget the case for straight paths
curved paths
straightened (rectified)
exact target (many-step reference) what the solver actually produces

This is the entire reason flow matching took over. Stable Diffusion 3, Flux, Meta's Movie Gen and a growing list of video models are trained this way — not because likelihoods matter to them, but because straight paths mean few-step sampling, and few-step sampling is what makes a model shippable.

Section 5Where this leaves diffusion

One picture, two vocabularies

If you have met diffusion models, everything above should feel familiar — and it should, because they are the same object in different clothes. A diffusion model destroys data with noise and learns to reverse that process; its reverse-time dynamics can be written either as a stochastic differential equation or as a deterministic probability-flow ODE. That ODE is a continuous normalizing flow. Diffusion's “noise prediction” and flow matching's “velocity prediction” are related by a change of variables; the practical differences are the choice of path (diffusion's curved variance-preserving schedule vs flow matching's straight line) and the training objective's parameterization.

FamilyExact likelihoodTraining costSamplingWhere it shines
Discrete flow (RealNVP, Glow)exact, cheaplow1 passDensity estimation, integration, science.
CNF via max-likelihoodexactvery highODE solveHistorically important; largely superseded.
Flow matching / rectifiedavailable, post-hoclowfew stepsToday's images, video, audio, molecules.
Diffusionindirect (via its ODE)lowmany stepsThe incumbent; converging with the row above.

So the arc of this series ends where the field is now. Part 1's demand — invertible maps with exact receipts — bought exactness at the price of architectural contortion. The continuous limit removed the contortion. Flow matching removed the training cost. What remains, in the largest generative models running today, is the picture you have had since the first animation: probability, flowing smoothly from a bell curve onto data.

Section 6Check yourself

Four questions

RecapIf you remember three things
1
Infinitely many tiny layers = a velocity field. Invertibility becomes automatic (trajectories cannot cross) and the log-det becomes an integral of the divergence — a trace, not a determinant.
2
Flow matching removed the bill. Choose the path (a straight line from noise to data), regress the velocity of individual pairs; the conditional average is provably the right field. No solving during training.
3
Straight paths mean few steps. That, not likelihood, is why flow-matched models now sit inside state-of-the-art image and video generators — and why diffusion and flows have converged into one subject.
The end of the tour

Five parts, one idea

You began with clay and a slogan, and end with the transport equation and the training recipe behind modern generative models. The thread was never broken: reshape a simple distribution with smooth, reversible motion, and keep exact account of the stretching. Everything else — Jacobians, coupling layers, KL divergences, divergence integrals, straight-line regression — is engineering in service of that one sentence.