Rectified Flow: Straightening Trajectories to Buy Few-Step Sampling
Published:
The simplest path you can write down
Flow matching leaves the probability path as a design choice. Rectified flow makes the least imaginative choice available: draw noise \(x_0 \sim \mathcal{N}(\mathbf{0},\mathbf{I})\), draw data \(x_1 \sim q\), and interpolate linearly.
The velocity target does not depend on \(t\) at all. Training is one line — sample a pair, sample a time, sample the point on the segment between them, and regress:
No noise schedule, no \(\bar{\alpha}_t\), no signal-to-noise weighting to tune. Compare the score-based SDE view, where the drift and diffusion coefficients carry all that machinery.
Why straightness is the whole game
Any ODE sampler approximates \(x_1 = x_0 + \int_0^1 v_\theta(x_t,t)\,dt\). Euler with \(N\) steps freezes the velocity across each interval of length \(1/N\). If the velocity along the trajectory is genuinely constant, freezing it costs nothing — one step of size 1 is exact, not approximate. All discretisation error comes from the velocity changing as you move, which is the definition of curvature.
Take the one-dimensional pair \(x_0 = -1\), \(x_1 = 2\). Under the straight path the velocity is \(3\) everywhere, so a single Euler step gives \(-1 + 3 = 2\): exact. Under a variance-preserving path \(x_t = \cos(\tfrac{\pi t}{2})x_0 + \sin(\tfrac{\pi t}{2})x_1\), the initial velocity is \(\tfrac{\pi}{2}x_1 = \pi\), and one Euler step gives \(-1 + \pi \approx 2.1416\) — an error of \(0.1416\), about 4.7% of the total displacement of \(3\), from a single well-behaved curve. Stack that error across dimensions and across a bent trajectory and you get the familiar need for tens of steps.
The catch: straight conditionals, curved marginals
Here is the part that is easy to miss. The linear interpolation makes each conditional path straight, but the network learns the marginal field, and that field is an average over every data point that could have produced the current position. Two training segments that intersect in space demand different velocities at the crossing point, and the regression returns their average. The resulting integral curves bend.
So a freshly trained rectified flow is not actually straight. It is trained on straight targets, which is a different claim.
Reflow
Concretely, with a trained field \(v^{k}\):
- Sample \(x_0 \sim \mathcal{N}(\mathbf{0},\mathbf{I})\).
- Integrate \(dx/dt = v^{k}(x,t)\) accurately from \(t=0\) to \(t=1\) to get \(z_1\).
- Train \(v^{k+1}\) with the same objective, but on the coupled pairs \((x_0, z_1)\) instead of independently drawn \((x_0, x_1)\).
Liu et al. prove two things about this operation. The marginal at \(t=1\) is preserved — reflow rewires which noise maps to which sample without changing the distribution of samples — and no convex transport cost increases, so the new coupling is at least as cheap as the old one. Iterating, the straightness of the best of the first \(K\) rectified flows decays as \(O(1/K)\).
What reflow costs
Step 2 is the problem. From the second round onwards the model is trained on its own outputs, so anything the ODE solver got wrong, and anything the previous model got wrong, is baked into the targets as ground truth. Two error sources compound:
| Round | Trained on | Straightness | Distribution |
|---|---|---|---|
| 1-rectified | real data, independent pairs | poor | matches data as well as the fit allows |
| 2-rectified | model samples, coupled pairs | much better | inherits round-1 error |
| 3-rectified | round-2 samples | better still | inherits rounds 1 and 2 |
In practice two rounds is the usual stopping point: the first reflow buys most of the straightening, and later rounds trade visible sample quality for diminishing gains. The theoretical guarantee that marginals are preserved holds for an exact ODE solve and an exact regression fit; neither is available, and the gap is exactly where the drift enters.
Where it landed
Reflow alone moves sampling into the few-step regime. Reaching a single step still needs distillation — train a network to map \(x_0\) straight to \(z_1\) — but after reflow the map it must imitate is close to linear, which is why distilling a 2-rectified flow is so much easier than distilling a raw diffusion model. The formulation also scaled: Stable Diffusion 3 (Esser et al., 2024) uses the rectified-flow interpolant as its forward process and samples \(t\) from a logit-normal distribution, concentrating training on the intermediate times where prediction is hardest.
The broader lesson is that sampling cost was never really about the number of denoising steps. It was about how bent the path from noise to data is — something you choose when you design the probability path, not something you discover afterwards and patch with a better solver. DDIM attacked the same cost from the solver side and reached tens of steps; changing the path reaches single digits. For the two formulations side by side, see diffusion vs flow matching, and for the corruption-based starting point, the diffusion overview.
References
- Liu, X., Gong, C., & Liu, Q. Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified Flow. ICLR 2023.
- Lipman, Y., Chen, R. T. Q., Ben-Hamu, H., Nickel, M., & Le, M. Flow Matching for Generative Modeling. ICLR 2023.
- Albergo, M. S., & Vanden-Eijnden, E. Building Normalizing Flows with Stochastic Interpolants. ICLR 2023.
- Esser, P., Kulal, S., Blattmann, A., Entezari, R., Müller, J., Saini, H., et al. Scaling Rectified Flow Transformers for High-Resolution Image Synthesis. ICML 2024.
- Song, J., Meng, C., & Ermon, S. Denoising Diffusion Implicit Models. ICLR 2021.
