Rectified Flows & Reflow
Straightening flow trajectories for one-step generation: the rectification procedure, reflow iterations, distillation to one step, consistency distillation connection, and achieving near-diffusion quality in a single forward pass.
Prerequisites
Table of Contents
- Learning Objectives
- Notation
- Core Intuition
- Why Straight Paths Matter
- Rectified Flow Definition
- The Reflow Procedure
- One-Step Distillation
- Analysis of Straightness
- Connection to Consistency Models
- Practical Results
- Common Pitfalls
- Summary
- Exercises
Learning Objectives
- Explain why straight trajectories enable few-step generation.
- Derive the rectified flow objective and its geometric interpretation.
- Describe the reflow procedure for iterative trajectory straightening.
- Connect rectified flows to consistency distillation.
- Analyze the quality-steps Pareto frontier.
Notation
- — coupling between noise and data
- — linear interpolation
- — learned velocity field
- — trajectory straightness metric
Core Intuition
A flow that follows straight lines from noise to data can be integrated in ONE Euler step: . But with random noise-data pairing, trajectories cross and the learned velocity must be curved to avoid collisions. Rectified flow iteratively improves the coupling so that trajectories become progressively straighter, approaching one-step generation.
Rectified Flows
Why Straight Paths Matter
Euler discretization error: For an ODE with step size :
For straight paths: along each trajectory → → zero discretization error. One Euler step is exact.
For curved paths: Need many steps to follow the curvature. A path with curvature requires steps for error .
Goal: Make the velocity field as constant as possible along trajectories.
Rectified Flow Definition
Given coupling over :
Interpretation: Train the velocity field to predict the direction from noise to data along the linear interpolation. The target is the straight-line velocity.
Initial coupling (Rectified Flow 1): (independent). Random pairing → crossing paths → curved learned velocity.
The Reflow Procedure
Key idea: Use the trained model to create a BETTER coupling, then retrain.
Algorithm:
- RF-1: Train on random coupling .
- Generate pairs: For each , solve ODE to get .
- New coupling: — now the pairs are connected by the flow.
- RF-2: Train on coupling .
- Repeat: , etc.
Why it helps: After RF-1, the coupling has non-crossing paths (they were generated by an ODE). Training on non-crossing paths yields straighter velocity fields.
Convergence: 2-3 iterations typically sufficient. Diminishing returns after that.
One-Step Distillation
After reflow, the flow is nearly straight. Distill to exactly one step:
where is generated by the multi-step teacher.
Alternative: self-consistency loss. Enforce that the one-step prediction equals the multi-step result:
Analysis of Straightness
Straightness metric: For a trajectory :
- Straightness = 1: perfectly straight (constant-speed straight line).
- Straightness less than 1: curved path (longer than straight-line distance).
After each reflow:
- RF-1: Straightness – (significant curvature).
- RF-2: Straightness –.
- RF-3: Straightness –.
Connection to Consistency Models
Consistency models (Song et al., 2023): Train a model that maps ANY point on a trajectory to the endpoint:
Connection: A perfectly straight rectified flow satisfies:
So the one-step prediction from ANY time equals . Straight rectified flows ARE consistency models.
Difference: Consistency models enforce this property directly; rectified flows achieve it by straightening trajectories.
Practical Results
Image generation (CIFAR-10, ImageNet):
- 1-step rectified flow (after reflow): FID 4-6.
- 2-step: FID 2-3.
- 50-step diffusion: FID 2.
Used in production:
- Stable Diffusion 3: Flow matching + reflow-style distillation.
- SDXL Turbo: Adversarial distillation of flow to 1-4 steps.
Speed: 1-step generation is 25-50x faster than 50-step diffusion. Real-time generation on consumer GPUs.
Common Pitfalls
Pitfall 1. Expecting RF-1 to produce one-step quality. The first rectified flow still has significant curvature; reflow is essential for few-step generation.
Pitfall 2. Generating too few coupling pairs for reflow. Need diverse pairs (100K+) covering the full distribution. Undercoverage leads to mode collapse.
Pitfall 3. Using high-order ODE solvers during reflow generation. This is correct but expensive. The whole point of reflow is to eventually avoid ODE solving — but the reflow process itself requires it.
Summary
- Straight paths → zero Euler discretization error → one-step generation.
- Rectified flow: Linear interpolation objective with noise-data coupling.
- Reflow: Iteratively improve coupling using trained model; 2-3 iterations for near-straight paths.
- Straightness converges: 0.7 → 0.9 → 0.95+ across reflow iterations.
- Equivalent to consistency models when perfectly straight.
- Enables real-time generation (1-4 steps) with near-diffusion quality.
Exercises
Exercise 1. Prove that non-crossing paths must exist for an ODE-generated coupling (hint: uniqueness of ODE solutions).
Exercise 2. Compute the Euler discretization error for a circular trajectory vs a straight trajectory with the same endpoints.
Exercise 3. For a 2D Gaussian mixture: visualize the trajectories of RF-1 vs RF-2 and measure straightness.
Exercise 4. Derive the relationship between the number of Euler steps and FID for a flow with straightness (estimate error scaling).
Exercise 5. Compare the training cost of 3 rounds of reflow vs consistency distillation for achieving 1-step generation.