The Nightly Build.
The Paper

Flow Matching Trades the Score for a Velocity Field

Lipman and colleagues prove that regressing a network onto a closed-form conditional velocity field has the same gradient as the intractable objective it stands in for, which is how a state-of-the-art image generator gets trained with nothing harder than mean-squared error.

Flow Matching for Generative Modeling

Yaron Lipman, Ricky T. Q. Chen, Heli Ben-Hamu, Maximilian Nickel, Matt Le · arXiv:2210.02747 · ICLR 2023

Read the paper
We introduce a new paradigm for generative modeling built on Continuous Normalizing Flows (CNFs), allowing us to train CNFs at unprecedented scale. Specifically, we present the notion of Flow Matching (FM), a simulation-free approach for training CNFs based on regressing vector fields of fixed conditional probability paths. Flow Matching is compatible with a general family of Gaussian probability paths for transforming between noise and data samples — which subsumes existing diffusion paths as specific instances. Interestingly, we find that employing FM with diffusion paths results in a more robust and stable alternative for training diffusion models. Furthermore, Flow Matching opens the door to training CNFs with other, non-diffusion probability paths. An instance of particular interest is using Optimal Transport (OT) displacement interpolation to define the conditional probability paths. These paths are more efficient than diffusion paths, provide faster training and sampling, and result in better generalization. Training CNFs using Flow Matching on ImageNet leads to consistently better performance than alternative diffusion-based methods in terms of both likelihood and sample quality, and allows fast and reliable sample generation using off-the-shelf numerical ODE solvers.1

The bill the score route runs up

To build a continuous generative model the diffusion way, you pay in advance. You fix a stochastic differential equation that drips noise into data over time, you derive the score of the resulting densities, and you train a network to match that score at every noise level. Each of those is a design decision that constrains the next, and none of them hands you a direct grip on the object you actually want at sampling time: a trajectory that carries a noise sample to a data sample. The score is a means. The path is the end, and the score route reaches it only indirectly.

Flow Matching pays a different bill. It names the end object directly as a time-dependent velocity field, the thing whose integral is the trajectory, and then trains a network to regress onto that field with a plain squared-error loss. No stochastic differential equation to design, no score to estimate, and no need to simulate the trajectory while training.1 The reframing was in the air: a month before this paper, Liu, Gong, and Liu reached the same linear-interpolation-and-regression construction from a different group and called it rectified flow.2 The idea that follows is best read as convergent rather than as one lab's invention.

A velocity field, and the path it carries

Start with the object being learned. A time-dependent velocity field v_t(x) assigns a direction and speed to every point in space at every time t in [0, 1]. Drop a particle at x and let it ride the field, and you get a flow φ_t defined by the ordinary differential equation dφ_t(x)/dt = v_t(φ_t(x)) with φ_0(x) = x. The flow moves points; what a generative model cares about is how it moves a whole distribution. Push a starting density p_0 through the flow and you get a new density at each time, p_t = [φ_t]_* p_0, the push-forward.

The sequence of densities p_t is a probability path: a continuous morph from the noise distribution at t = 0 to the data distribution at t = 1. A single identity ties the field to the path it produces, the continuity equation,

  ∂p_t(x)/∂t  +  div( p_t(x) v_t(x) )  =  0 .

It is necessary and sufficient: a field v_t generates a path p_t exactly when the two satisfy it.1 Learning a generative model is now learning a field, and a field is just a function from (x, t) to a vector, the native diet of a neural network.

Velocity field vs. score The score points uphill on the log-density at a fixed noise level. The velocity field points along the trajectory that transports noise into data. Flow Matching learns the second directly, so the field it fits is the sampler it will run.

The field you cannot write down

Suppose you already knew the right field. Then training would be a one-line regression: pick a time, pick a point on the path, and push the network's output toward the target. That is the Flow Matching objective exactly,

  L_FM(θ)  =  E_{t, p_t(x)}  ‖ v_t(x) − u_t(x) ‖² ,

with t drawn uniformly on [0, 1] and x drawn from the path density p_t. Here u_t is the true field that generates the path you want, and v_t is the network. The trouble is the target. For a path that ends on real data you have no formula for u_t.

We generally don't have access to a closed form u_t that generates the desired p_t.1
§3 · Flow Matching The objective everyone wants is not directly computable. The claim is narrow: no formula for the field is at hand, not that the field is unknowable.

It is fair to ask what makes any of this trainable at all. The loss regresses onto a target that has no closed form and cannot be sampled. Written as it stands, L_FM is a definition of the goal, not a procedure. The paper's move is to replace the intractable target with one that is trivial to compute, and to prove that the swap costs nothing the optimizer can feel.

Conditioning on where the sample lands

The intractable field is intractable because it is a marginal over every possible data point at once. Condition on a single data sample x_1 and everything simplifies. Fix x_1 and you can hand-design a conditional path p_t(x | x_1) that starts as broad noise and ends concentrated on x_1, and write down the conditional field u_t(x | x_1) that generates it in closed form. The marginal path is then just the mixture of these conditional paths over the data,

  p_t(x)  =  ∫ p_t(x | x_1) q(x_1) dx_1 ,

and the marginal field is the corresponding weighted average of the conditional fields,

  u_t(x)  =  ∫ u_t(x | x_1) [ p_t(x | x_1) q(x_1) / p_t(x) ] dx_1
          =  E_{x_1 ~ p_{1|t}(x_1 | x)} [ u_t(x | x_1) ] .

Read the weight as a posterior: given that a particle sits at x at time t, how likely is it that the endpoint was x_1. The intractability lives in that posterior, which you cannot evaluate.3 Theorem 1 confirms the construction is sound: the averaged field really does transport the mixture path, satisfying the continuity equation.1

Now regress onto the conditional target instead of the marginal one,

  L_CFM(θ)  =  E_{t, q(x_1), p_t(x | x_1)}  ‖ v_t(x) − u_t(x | x_1) ‖² .

This one you can run tonight. Sample a datum x_1, sample a point from its conditional path, evaluate the closed-form conditional field, take the squared error. In words: you are performing regression on the velocity field, and the target is the conditional field you designed rather than the marginal field you cannot reach. The reason this is allowed is one theorem.

Assuming that p_t(x) > 0 for all x ∈ ℝ^d and t ∈ [0, 1], then, up to a constant independent of θ, L_CFM and L_FM are equal. Hence, ∇_θ L_FM(θ) = ∇_θ L_CFM(θ).1
Theorem 2 · §3.2 The tractable objective and the intractable one share a gradient. It does not say the two losses are equal, only that θ moves identically under both.

The intractable term drops in plain sight. Expand both squared norms:

  L_FM  =  E ‖v_t(x)‖²  − 2 E⟨ v_t(x), u_t(x) ⟩       + E ‖u_t(x)‖²
  L_CFM =  E ‖v_t(x)‖²  − 2 E⟨ v_t(x), u_t(x|x_1) ⟩   + E ‖u_t(x|x_1)‖²

The first terms agree: averaging ‖v_t(x)‖² over p_t(x) is the same as averaging it over the joint of q(x_1) and p_t(x | x_1), because integrating the conditional path against the data gives back p_t(x). The last terms depend only on the targets, not on θ, so they contribute nothing to the gradient. Everything hinges on the cross term. Take the FM one and substitute the definition of the marginal field, using the single identity that clears the fraction,

  p_t(x) u_t(x)  =  ∫ u_t(x | x_1) p_t(x | x_1) q(x_1) dx_1 .

The p_t(x) supplied by the FM expectation's own measure cancels the 1 / p_t(x) buried in the marginal field, and the cross term collapses onto the conditional one,

  E_{p_t(x)}⟨ v_t, u_t ⟩  =  ∫⟨ v_t(x), p_t(x) u_t(x) ⟩ dx
        =  ∫∫⟨ v_t(x), u_t(x|x_1) ⟩ p_t(x|x_1) q(x_1) dx_1 dx
        =  E_{q, p_t(x|x_1)}⟨ v_t, u_t(x|x_1) ⟩ .

The two objectives differ only by a θ-independent constant, so their gradients are identical. The intractable posterior never had to be evaluated; it cancelled. The Cambridge Machine Learning Group's independent reconstruction of this argument arrives at the same gradient equality, which is good evidence that this is the standard way to teach the trick.3

Diffusion is one Gaussian path among many

The framework is agnostic about which conditional path you pick, so long as it starts as standard noise and ends on the datum. A natural family is Gaussian: keep the conditional density Gaussian at every time,

  p_t(x | x_1)  =  N( x | μ_t(x_1), σ_t(x_1)² I ) ,

with the mean sliding from 0 to x_1 and the spread shrinking from 1 to nearly zero as t runs from 0 to 1. For any such choice there is a unique conditional field that generates it, and the paper writes it down: u_t(x | x_1) = (σ_t'/σ_t)(x − μ_t) + μ_t'.1 Pick the schedule and the target follows by differentiation.

Now set μ_t(x_1) = α_{1−t} x_1 and σ_t(x_1) = sqrt(1 − α_{1−t}²), and the Gaussian path is exactly the variance-preserving diffusion path that standard diffusion models already walk. Diffusion is not a separate theory that Flow Matching imitates; it is one member of this Gaussian family, recovered by one choice of schedule. Training that member with the conditional-regression loss, rather than with a score-matching loss derived from a stochastic differential equation, is what the abstract means by a more robust and stable alternative for training diffusion models.1 The reframing keeps diffusion and drops the machinery around it.

Straight lines, at least toward one target

Once the path is a free choice, the obvious question is which one to choose, and the paper's answer is the shortest one. Take the mean to move linearly and the standard deviation to fall linearly: μ_t(x_1) = t x_1 and σ_t(x_1) = 1 − (1 − σ_min) t. This is the optimal-transport displacement path, and its conditional field is

  u_t(x | x_1)  =  ( x_1 − (1 − σ_min) x ) / ( 1 − (1 − σ_min) t ) .

As σ_min goes to zero this is (x_1 − x) / (1 − t): aim straight at the target, at a speed set by the time remaining. Integrate it and the particle rides a straight line at constant speed from its noise start to x_1.1

[Particles] always move in straight line trajectories and with constant speed.1
§4.1 · Optimal Transport paths True of the per-sample conditional path toward a fixed x_1. It is not yet a claim about the averaged field the sampler actually integrates.

Straightness is what buys cheap sampling. A numerical ODE solver integrates a straight, constant-speed trajectory exactly with a single large step, while a curved one forces many small steps to stay on course. The paper's own figures contrast the diffusion path, which curves and backtracks, with the optimal-transport path, whose conditional field has constant direction in time and is, in its words, simpler to fit.1 If the field the sampler ran were this straight, few-step generation would be free.

The straight paths are the conditional ones

Here is the caveat the clean story tends to swallow. The straight lines are a property of the conditional paths, each aimed at a single fixed x_1. The field you sample from is the marginal one, the posterior-weighted average from Theorem 1. At a point that several data endpoints could plausibly explain, the marginal velocity is a blend of their directions, and a blend of straight lines aimed at different targets is not itself straight. The learned trajectory you integrate at sampling time is generally curved, however straight each conditional path was.

Every conditional path is a straight line. The average of them, which is what you sample, bends.

Three independent accounts land on the same point. The rectified-flow paper builds the identical linear interpolation, then notes that the optimal field is the conditional expectation E[X_1 − X_0 | X_t = x], and that the raw interpolation has crossing trajectories the learned field must causalize; its one-step sampling needs a recursive reflow procedure precisely because a single pass does not straighten the marginal flow.2 The Cambridge reconstruction makes the geometric version of the argument: distinct conditional paths may cross at training time, but marginal ODE trajectories cannot cross at sampling time, so they must bend to avoid each other.3 The straight-path selling point is real, and it is a statement about the regression target, not about the sampler.

What survived a real training run

The idea's second life is where the reconstruction has to stay honest. Rectified flow arrived at the same construction independently, one month earlier, and both landed at the same venue.2 The Cambridge account counts three simultaneous papers introducing conditional flow matching at once.3 Treating Flow Matching as a lone invention gets the history wrong. What settles whether the reframing mattered is a production system, and Stable Diffusion 3 is the test. It adopts the straight rectified-flow path, z_t = (1 − t) x_0 + t ε, but does not trust uniform training on it.

The change that made it win is a timestep schedule. Instead of drawing the training time t uniformly, the team samples it from a logit-normal density that up-weights the middle of the interval, where the velocity target is hardest to predict.4

Fig. 1 · Mean rank across evaluated settings in the Stable Diffusion 3 study (lower is better): plain rectified flow with uniform timesteps, an LDM diffusion baseline, and rectified flow with logit-normal timesteps.4

Plain rectified flow with uniform timesteps ranks 5.67, worse than the diffusion baseline at 2.88; only after the logit-normal reweighting does rectified flow reach 1.54 and pull ahead.4 The abstract's promise that optimal-transport paths give faster and better everything is not wrong, but it is not free either. The clean straight-line theory needed a non-uniform schedule to beat a diffusion model at scale, which is the practical face of the same fact: the marginal flow is not straight, so where along the path the network spends its capacity matters.

Verdict The core result holds and deserves its reputation: conditioning on the endpoint turns an intractable objective into a closed-form regression with the same gradient, and Theorem 2 earns that claim in a few lines of algebra. The subsumption of diffusion as one Gaussian path is exact and clarifying. The part to hold loosely is the marketing around straight paths and few-step sampling. Straightness is a property of the conditional target, not the marginal sampler, and both rectified flow's reflow and Stable Diffusion 3's timestep reweighting exist to buy back the straightness the marginal flow does not inherit for free.1

Sources

  1. arXiv · Lipman, Chen, Ben-Hamu, Nickel, Le, "Flow Matching for Generative Modeling" (ICLR 2023)
  2. arXiv · Liu, Gong, Liu, "Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified Flow" (ICLR 2023)
  3. Cambridge Machine Learning Group · Fjelde, Mathieu, Dutordoir, "An Introduction to Flow Matching"
  4. arXiv · Esser et al., "Scaling Rectified Flow Transformers for High-Resolution Image Synthesis" (Stable Diffusion 3)