Generative Vision Atlas

landmark

Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified Flow

Xingchao Liu, Chengyue Gong, Qiang Liu · UT Austin · 2022-09 · arXiv:2209.03003

Why it matters

Independently derives the same straight-path ODE idea as flow matching, and adds 'reflow': iteratively re-coupling noise/data pairs along the learned ODE to make paths even straighter, enabling near-one-step sampling. The 'rectified' in 'rectified flow transformer' (SD3, FLUX) traces back here.

What this paper does

read: full text

Before this

Score-based and DDPM diffusion models generated data by simulating a learned stochastic differential equation, which needs many discretization steps to integrate accurately. Continuous normalizing flows and optimal transport gave alternative ODE-based formulations, but exact optimal-transport solvers do not scale to high-dimensional image data, and the authors note that faithfully finding optimal transport maps does not necessarily give better generative performance.

The problem

Build an ODE-based generative model whose learned paths from noise to data are close enough to straight lines that they can be simulated accurately with very few Euler steps, ideally a single one, without sacrificing sample quality.

The idea

Train a velocity field to follow the straight-line interpolation between paired samples drawn from the two distributions being connected. Straight paths are the shortest paths, so a well-trained straight-path ODE can in principle be simulated exactly with one step, and repeatedly re-coupling the learned pairs and retraining, called reflow, drives the paths progressively straighter.

How it works

Given X0 drawn from a source distribution pi_0, Gaussian noise for generative modeling, and X1 drawn from the target data distribution pi_1, the paper defines the linear interpolation X_t equal to t times X1 plus one minus t times X0, and trains a network v_theta(X_t, t) with a least-squares objective that integrates the expected squared error between X1 minus X0 and v_theta(X_t, t) over t from 0 to 1. The regression target is therefore the straight-line displacement between the paired endpoints, not noise and not a score function, and its optimal solution is the conditional expectation of X1 minus X0 given X_t equals x. At inference an image is generated by drawing Z0 from pi_0 and solving dZ_t equal to v(Z_t, t) dt forward from t equals 0 to t equals 1, in principle with a single Euler step if the learned paths are straight. The CIFAR-10 image experiments run directly in raw 32 by 32 pixel space with no autoencoder or latent space anywhere in the setup. Reflow is applied after an initial rectified flow is trained. New Z0, Z1 pairs are generated by running the current learned ODE forward, and a new rectified flow is trained on this new coupling. The paper proves this procedure is provably non-increasing in a path-straightness measure at rate O(1/K) after K reflow iterations, and states that a single reflow already gives paths straight enough for good one-step results.

Evidence

The paper reports a state-of-the-art result for one-step fast diffusion and flow models of FID 4.85 and recall 0.51 on unconditional CIFAR-10, obtained from a 2-rectified flow model, meaning one reflow iteration on top of the initial rectified flow, followed by a final distillation stage that collapses the model to a single Euler step. Separately, they report that a first rectified flow already gives good samples with as few as two discretization steps, while the second rectified flow after one reflow produces nearly straight trajectories that give good results even at a single step, without the added distillation stage.

Limitations

The authors concede that in two or more dimensions, different convex transport costs do not in general share a common optimal coupling, so a straight coupling is not guaranteed to be optimal under an arbitrary cost function, even though it is provably non-increasing in transport cost under any convex cost. They advise against applying too many reflow iterations, since repeated reflow can accumulate estimation error rather than continuing to straighten paths. The strongest reported one-step CIFAR-10 number is not from rectified flow or reflow alone; it requires an added final distillation stage on top of a reflow-trained model.

Why it matters

The same simple least-squares regression toward straight-line paths, provably non-increasing in transport cost, works both as a general-purpose generative model and as a domain-transfer method, unifying two tasks previously served by separate machinery. Reflow's use of a model's own learned coupling as new training data is the naming origin and mechanism behind rectified flow transformers such as Stable Diffusion 3 and FLUX.

Abstract, in the authors' own words

We present rectified flow, a surprisingly simple approach to learning (neural) ordinary differential equation (ODE) models to transport between two empirically observed distributions π_0 and π_1, hence providing a unified solution to generative modeling and domain transfer, among various other tasks involving distribution transport. The idea of rectified flow is to learn the ODE to follow the straight paths connecting the points drawn from π_0 and π_1 as much as possible. This is achieved by solving a straightforward nonlinear least squares optimization problem, which can be easily scaled to large models without introducing extra parameters beyond standard supervised learning. The straight paths are special and preferred because they are the shortest paths between two points, and can be simulated exactly without time discretization and hence yield computationally efficient models. We show that the procedure of learning a rectified flow from data, called rectification, turns an arbitrary coupling of π_0 and π_1 to a new deterministic coupling with provably non-increasing convex transport costs. In addition, recursively applying rectification allows us to obtain a sequence of flows with increasingly straight paths, which can be simulated accurately with coarse time discretization in the inference phase. In empirical studies, we show that rectified flow performs superbly on image generation, image-to-image translation, and domain adaptation. In particular, on image generation and translation, our method yields nearly straight flows that give high quality results even with a single Euler discretization step.

Research line

Flow matching and rectified flowdominant

Design-axis choices

Method note — the shared flow-matching interpolation

Every flow-matching / rectified-flow paper in this atlas trains toward a straight-line path between a noise sample x₀ and a data sample x₁:

xt=(1t)x0+tx1,vθ(xt,t)x1x0x_t = (1-t)\,x_0 + t\,x_1, \qquad v_\theta(x_t, t) \approx x_1 - x_0

Builds on

Nothing recorded yet.

Built on by

Challenges / competes with