Vision & Multimodal advanced 9 min read 12 flashcards

Flow Matching and Rectified Flow

Why regressing a velocity field along straight noise-to-data paths replaced score matching in frontier image models, and what the straight-line claim does and does not guarantee.

Diffusion models sample by numerically integrating a stochastic or ordinary differential equation backward from noise, and the path they follow is curved. Curvature is what forces many small solver steps: 50 network evaluations for a decent sample, hundreds for a great one. Flow matching asks a blunt question. If sampling is just solving an ODE, why not train the ODE's velocity field directly, and why not choose the straightest possible path between noise and data?

Both frontier text-to-image systems released in 2024, and the first generation of flow-based robot policies, answer the same way.

The objective

A continuous normalising flow transports a simple distribution \(p_0\) to the data distribution \(p_1\) by integrating

\[\frac{\mathrm{d}x_t}{\mathrm{d}t} = v_\theta(x_t, t)\]

Training such a model by maximum likelihood requires simulating the ODE inside the training loop, which is why CNFs were an elegant idea that did not scale. Flow matching removes the simulation: regress \(v_\theta\) onto the velocity of a conditional probability path whose closed form is known (Lipman et al., 2022, arXiv:2210.02747). Take the linear interpolation between a noise sample \(x_0\) and a data sample \(x_1\),

\[x_t = (1-t)\, x_0 + t\, x_1, \qquad \frac{\mathrm{d}x_t}{\mathrm{d}t} = x_1 - x_0\]

and minimise

\[\mathcal{L}_{\text{CFM}} = \mathbb{E}_{t, x_0, x_1} \left\lVert v_\theta(x_t, t) - (x_1 - x_0) \right\rVert^2\]

The remarkable part is that this per-sample objective has the same gradient as the intractable marginal one. The target is a plain regression label, computable from two samples and a scalar, with no score function, no noise schedule and no simulation. Rectified flow arrives at the same linear-interpolation construction from a transport perspective and adds a reflow procedure that iteratively re-couples noise and data pairs to straighten the marginal trajectories further (Liu, Gong and Liu, 2022, arXiv:2209.03003).

Why straightness is worth paying for

If the true velocity along a trajectory were constant, one Euler step of size 1 would be exact. Real marginal paths are not constant, but the closer they are, the fewer function evaluations a solver needs for a given error. That is the whole efficiency argument, and it is a claim about solver steps, not about model quality per step.

Stable Diffusion 3 built on rectified flow with two changes worth knowing: a timestep sampling distribution that concentrates on the middle of the path where the regression target is hardest, and MMDiT, a transformer that gives text and image tokens separate weights while allowing bidirectional attention between them. The paper reports predictable scaling, with lower validation loss tracking better synthesis quality (Esser et al., 2024, arXiv:2403.03206).

The same machinery generalises past images. A robot policy that must emit a continuous action chunk at high frequency has the same problem as an image generator, a multimodal continuous output that categorical cross-entropy handles badly, and flow matching is now a standard answer there too (Black et al., 2024, arXiv:2410.24164).

What the straight-line story leaves out

Conditional straightness is not marginal straightness. Each training pair is joined by a straight segment, but the learned field averages over all pairs consistent with a given \(x_t\), and that average is curved. Reflow exists precisely because the first-pass marginal is not straight, and each reflow iteration costs a full generation pass over the dataset plus retraining.

Few-step sampling still needs distillation. One or two step generation comes from consistency-style or adversarial distillation applied on top, not from the flow objective alone. Quoting "straight paths" as if it delivered single-step sampling overstates the result.

Diffusion is not a different family. Gaussian diffusion is recoverable as one choice of conditional path within the flow-matching framework, so the comparison is between path schedules and parameterisations rather than between rival theories. The practical wins reported in the flow-matching literature come from that choice plus training details, and clean matched-compute comparisons remain scarce.

Check yourself

12 flashcards for this concept

Click a card to reveal the answer.

Drill the whole track