Flow Matching and Conditional Vector Fields
How to train a continuous-time generative model by regressing a velocity field without ever simulating an ODE, and why conditioning on a single data point makes an intractable target tractable.
Continuous normalising flows had the right idea and an impossible training loop: to compute a likelihood you had to integrate an ODE through the network, and to get gradients you had to backpropagate through the integration. Training was slow and numerically delicate, and the approach stayed a curiosity. Flow matching (Lipman et al., 2023, Flow Matching for Generative Modeling, arXiv:2210.02747) removed the simulation entirely by finding a regression target that can be written down in closed form, and it is now the training objective behind a large fraction of frontier image, video and audio systems.
The setup
Define a path of distributions \(p_t\) that interpolates from a simple noise distribution \(p_0\) to the data distribution \(p_1\). If a time-dependent velocity field \(u_t(x)\) generates that path, then integrating \(\mathrm{d}x/\mathrm{d}t = u_t(x)\) from \(t=0\) to \(t=1\) transports noise samples to data samples. Training a network \(v_\theta(x,t)\) to match \(u_t\) would be a simple regression:
The problem is that \(u_t(x)\) is defined by a marginal over the whole dataset and cannot be evaluated.
The conditional trick
Condition the path on a single data point \(x_1\). Now the interpolation is trivially known: the straight-line path
is a valid conditional path with a constant, closed-form velocity. The central theorem of flow matching is that regressing against this conditional target yields the same gradients as regressing against the intractable marginal target:
The intuition is the same one that makes diffusion training work: the network cannot tell which \(x_1\) produced a given \(x_t\), so the L2-optimal prediction at \(x_t\) is the average of the conditional velocities over all data points that could have produced it, which is exactly the marginal velocity. Averaging happens in the optimum rather than in the loss.
A training step is now: sample noise, sample data, sample \(t \sim U[0,1]\), interpolate, and regress the network output against \(x_1 - x_0\). No ODE solve, no divergence estimate, no likelihood evaluation.
Relation to diffusion
Diffusion with a variance-preserving schedule is a particular choice of probability path, one whose interpolation is curved. Flow matching with the straight-line path is a different, simpler choice, and both are trained by the same style of conditional regression. The practical consequence of straightness is fewer sampling steps: a straight trajectory is integrated exactly by a single Euler step, so the closer the learned field is to straight, the more aggressively the step count can be cut. This is the argument behind rectified flow, and it is why several systems that once shipped a diffusion schedule now ship a flow-matching one with no change to the backbone.
Flow matching also removes the noise-schedule design problem. There is no \(\beta_t\), no cosine-versus-linear argument, and no terminal-SNR bug, because the path is specified directly rather than through a variance sequence.
When it breaks
Straight conditional paths do not make the marginal field straight. Because \(x_0\) and \(x_1\) are sampled independently, the straight lines connecting them cross, and the marginal velocity field the network learns is curved wherever paths intersect. This is exactly why one Euler step is not enough for a naively trained flow-matching model, and it is the problem reflow procedures are designed to remove.
The optimal transport coupling helps and costs. Pairing each noise sample with a nearby data sample within the minibatch, rather than at random, reduces path crossing and straightens the learned field. It also introduces a batch-size-dependent bias, since the coupling is computed only within the batch, and the benefit shrinks as dimension grows because nearest neighbours become less meaningful.
Guidance transfers but its scale does not. Classifier-free guidance works on flow-matching models, applied to the velocity rather than the noise prediction, but a guidance scale tuned on a diffusion model produces either weak conditioning or heavy artefacts when carried over.
Exact likelihood returns only if you pay for it. Flow matching trains without a likelihood, and evaluating one still requires integrating the ODE and its divergence. The training simplification did not give you a cheap density; it gave you a cheap way to fit the field.
12 flashcards for this concept
Click a card to reveal the answer.