Paper commentary
Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified Flow
- Problem Continuous-time ODE and SDE transport models produce good samples but need many network calls at inference, while one-step GAN and likelihood-based models are unstable or hard to train. The question is whether an ODE can be learned so that a coarse solver is already accurate.
- Method Fits an ODE velocity field by least squares on linear-interpolation displacements, then reflows the learned flow and distills it into a one-step network.
- Results Full RK45 simulation of 1-RectFlow reaches FID 2.58 and recall 0.57 on CIFAR10, and the distilled 2-RectFlow one-step model reaches FID 4.85.
Why transport needs a faster route
Generative modeling and domain transfer are often handled by separate machinery, yet both amount to finding a map that carries samples from one empirical distribution to another. This paper treats them as one transport mapping problem and answers it with rectified flow, an ODE model trained by least squares.
GANs can produce good samples, but their minimax training is prone to instability and mode collapse, and maximum likelihood training needs approximate inference or restricted architectures to keep the likelihood tractable. Continuous-time models avoid some of these problems by learning the drift of an ODE or SDE, yet every sample needs a numerical solver that calls the neural drift many times.
The gap the paper targets is inference cost: one-step models are fast, continuous-time models are slow, and the open question is whether an ODE can be trained so that a coarse solver already gives accurate samples.
Fitting the velocity field to straight displacements
A rectified flow is an ODE on time t in [0,1], dZt = v(Zt,t)dt, that starts from a sample Z0 drawn from π0 and is meant to end at a sample Z1 that follows π1. The velocity field v is not specified directly. It is fit so that the flow moves along the direction of the straight line joining a coupled pair of draws.
The training objective is the following least squares problem, where Xt is the linear interpolation of X0 and X1 at time t. \[ \min_v \int_0^1 \mathbb{E}\left[\left\|(X_1-X_0)-v(X_t,t)\right\|^2\right]dt, \qquad X_t=tX_1+(1-t)X_0 \] The displacement X1 − X0 is the same along each line, so the minimizer at a location and time is the conditional expectation of the displacement of all lines passing through that point.
In practice the expectation is replaced by empirical draws of the coupling, a neural network is trained with a stochastic optimizer, and t is sampled uniformly from [0,1]. Sampling runs the learned ODE forward from π0, and the same field can run backward from π1 by flipping the sign of v and the direction of time, because the objective is unchanged when X0 and X1 are exchanged.
What the regression preserves and changes
Because the ODE has a unique solution, its trajectories cannot cross at the same time and place along different directions before t = 1. Linear interpolation paths have no such property and can intersect, which makes them non-causal, since their update needs the final point. The regression rewires trajectories at those intersections so that the flow traces the same marginal density as the interpolation.
The marginal laws are preserved at every time, so Law(Zt) equals Law(Xt), while the joint law of the whole trajectory generally differs. In that sense the flow turns a stochastic, non-Markov coupling into a deterministic one.
The procedure does not target a particular cost, which separates it from optimal transport solvers that minimize one fixed cost. For the Euclidean norm the argument is a length comparison: the triangle inequality bounds the endpoint distance by the length of the rewired path, which equals the length of the straight paths.
Reflow and the straightness measure
Reflow repeats the procedure: the flow learned from a coupling is simulated to produce a new coupling, and a new rectified flow is fit to that coupling. A flow is straight when Zt equals tZ1 + (1−t)Z0 for all t, so the velocity is constant along each path and a single Euler step gives the exact endpoint. A linear interpolation is also straight, but it cannot be simulated as a flow because it needs both endpoints.
Straightness is measured by S(Z), the integral over t of the expected squared gap between the endpoint displacement and the instantaneous velocity of the path. \[ S(Z)=\int_0^1 \mathbb{E}\left[\left\|(Z_1-Z_0)-\dot Z_t\right\|^2\right]dt \] S(Z) equal to zero means exact straightness.
The theorem bounds the minimum of S(Zk) over k from 0 to K by the expected squared norm of X1 − X0 divided by K, so the best reflow stage becomes straighter at a rate of 1/K. The bound concerns the best stage, not the last one, so the claim is that some reflow stage is nearly straight, with the bound tightening as K grows. The paper does not recommend many reflow stages, because each stage inherits estimation error in the velocity field, and reflow worsens large-step results for that reason.
Distillation into a one-step model
After a k-rectified flow is available, distillation trains a network that maps the start point of the flow directly to its endpoint, skipping simulation. With the parameterization T̂(z0) = z0 + v(z0, 0), the training loss reduces to the velocity regression at t = 0 on the pairs (Zk0, Zk1).
Distillation is fine-tuning rather than another rectification: it keeps the coupling of the k-rectified flow, whereas reflow produces a new coupling with lower transport cost. It is therefore placed at the final stage, once the flow is already nearly straight and only a one-step model is needed. The default simulator is the Euler method with step size 1/N, and the one-step model is exactly one such Euler step.
Where probability flow ODEs fit
The authors generalize the construction to any differentiable curve Xt joining X0 and X1, with the drift fit to its time derivative, and weight each time by a positive sequence wt. \[ \min_v \int_0^1 \mathbb{E}\left[w_t\left\|v(X_t,t)-\dot X_t\right\|^2\right]dt \] With the linear curve and wt = 1 this reduces to the objective in (1).
For a general curve the marginal laws are still preserved, so the endpoints still form a coupling. The convex-cost guarantee and the straightening effect are lost, because the paths are no longer straight.
With Xt = αt X1 + βt ξ and ξ standard Gaussian, the authors show that every variant of PF-ODEs is an instance of the nonlinear objective (6), provided α1 = 1 and β1 = 0. The schedules of the score-based methods do not meet the boundary conditions α0 = 0 and β0 = 1, so the initial distribution is treated as approximately β0 ξ, and the proof uses the SDE relation linking αt, βt and the diffusion coefficient.
Choosing the interpolation schedule
VP ODE and sub-VP ODE share an exponential schedule with default values a = 19.9 and b = 0.1. They differ only in βt: VP uses the square root of 1 − αt squared, and sub-VP uses 1 − αt squared.
The authors argue that these choices of βt give curved paths that reflow cannot straighten, and they suggest βt = 1 − αt to induce straight paths.
The exponential αt also gives non-uniform speed: αt and βt change slowly for t below about 0.5, so most of the movement falls in the later phase. Replacing αt with t gives a uniform speed while keeping the same continuous-time trajectories.
The VE ODE uses αt = 1 and βt = σmin √(r²(1 − t) − 1), with σmin = 0.01 by default, so its paths are straight but its speed is non-uniform. Its initial distribution has a much larger variance than π1, since σmax is set to the largest pairwise distance of the training data.
Toy setup and estimators
The toy velocity field uses a Nadaraya–Watson style estimator built on the Gaussian RBF kernel exp(−‖x − z‖²/2h²). In practice the expectation is replaced by an average over the m nearest neighbours of z among the interpolated points, with bandwidth h = 1 and m = 100 by default. Flows are simulated with Euler steps of size 1/N, using N = 100 unless otherwise specified.
A neural network alternative with two hidden layers of 64 neurons each fits the linear trajectories less exactly, and a larger L2 penalty makes the flow smoother and straighter. Straightness is estimated from simulated trajectories, and the relative transport cost is the average squared endpoint length minus the squared length under the optimal L2 assignment of the start points.
The authors note that the relative cost is only informative in low dimensions, because it tends to be near zero in high dimensions even for a random network. They connect this to an earlier claim that DDIM yields L2 optimal transport, which they call a false hypothesis.
Full simulation results on CIFAR10
FID and inception score measure image quality, the recall score measures diversity, and NFE counts the calls to the main network during inference.
Solved with RK45 using adaptive steps, 1-RectFlow reached FID 2.58 and recall 0.57, with 127 NFE and inception score 9.60. Among the ODE rows of this table it has the lowest FID and the highest recall; 2-RectFlow (FID 3.36, recall 0.54) and 3-RectFlow (FID 3.96, recall 0.53) are worse on those two metrics. The VP ODE row reads 140 NFE, FID 3.93 and recall 0.51, and the sub-VP ODE row reads 146 NFE, FID 3.16 and recall 0.55.
The authors call the recall gain a substantial improvement over the existing ODE methods in this comparison. Under RK45, rectified flows need fewer steps than the VE, VP and sub-VP ODEs, and the fully simulated VP SDE row, at 2000 NFE, reports FID 2.55 and recall 0.58. Table 1(b) lists NCSN++ with VE ODE at 176 NFE, FID 5.38 and recall 0.56, but those results use different networks and are not controlled comparisons.
One-step results after distillation
Reflow improves FID and recall for small step counts, roughly up to N = 80, and worsens large-step results, and distillation then produces the one-step numbers. The distilled 2-RectFlow model reaches FID 4.85 with one Euler step, against 8.91 for TDPM, the best one-step U-Net model cited. Recall is 0.50 for distilled 2-RectFlow and 0.51 for distilled 3-RectFlow, above the 0.49 that StyleGAN2+ADA reports.
The authors claim the best FID among the one-step fast diffusion and flow models they cite. They note that the GAN numbers come from carefully tuned methods such as adaptive discriminator augmentation, while the rectified flow results use a vanilla implementation. They suggest that data augmentation or combining with GAN-type objectives could improve results, but no such combination is reported in the analysed text.
In the same table, the DDIM distillation baseline has FID 9.36 and recall 0.51 at one step. The one-step rows are distillation results on top of a reflowed flow, so they are not the same experiment as the full-simulation rows.
Evidence for straightening
Reflow improves the straightness of the flow on CIFAR10, measured by S across reflow steps and training iterations.
On AFHQ Cat, each point zt is extrapolated to t = 1 by ẑ_t1 = zt + (1 − t) v(zt, t), and on a straight path this value should not change with t. For 2-RectFlow the extrapolated values are almost independent of t, whereas 1-RectFlow is not straight in this sense yet already gives recognizable images at t ≈ 0.1. The sub-VP ODE needs about t ≈ 0.6 to give a clear image from the same extrapolation.
The same 1-RectFlow is applied to 256×256 LSUN Bedroom, LSUN Church, CelebA HQ and AFHQ Cat, and the authors report high quality across these datasets. The excerpt gives no quantitative scores for these datasets. An editing example stitches two images, runs the flow backward to a latent code z0, and modifies z0 to raise its likelihood under N(0, I).
Limitations
In several dimensions, rectification does not give the c-optimal coupling for a given cost, because it does not depend on any particular cost. Even straight couplings need not be optimal, and the authors point to separate work on modifying rectified flow to find c-optimal couplings. The one-dimensional case is the exception: the straight coupling is the unique monotonic one and is optimal for all convex costs when π0 is absolutely continuous.
Too many reflow stages accumulate estimation error in the velocity field, and the straightness metric is informative only in low dimensions. The PF-ODE link relies on approximating X0 by β0 ξ, because the schedules do not meet the boundary conditions exactly.
The analysed text ends at the setup of image-to-image translation, so its quantitative results are outside this commentary. GAN and other one-step comparisons use different architectures and tuned training, so they are not controlled comparisons.
Paper info
- Authors
- Xingchao Liu, Chengyue Gong, Qiang Liu
- Venue
- arXiv · Preprint
- First published
- 2022-9-7
- Added
- 2026-10-20
- Updated
- 2022-9-7
- Version
- v1
- arXiv
- 2209.03003
- Category
- cs.LG
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Xingchao Liu, Chengyue Gong, Qiang Liu (2022). Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified Flow. arXiv:2209.03003v1. https://arxiv.org/abs/2209.03003v1
BibTeX
@misc{liu2022flow,
title = {{Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified Flow}},
author = {Xingchao Liu and Chengyue Gong and Qiang Liu},
year = {2022},
eprint = {2209.03003},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2209.03003v1}
}