AI Glossary / Probabilistic machine learning / Intermediate
Flow matching
Definition
Flow matching is a generative-model training framework that learns a time-dependent vector field for transporting a simple starting distribution toward a data distribution. Training matches predicted movement directions and speeds to targets defined along chosen probability paths. A trained continuous model can generate samples by numerically following its learned field from an initial random sample.
What it means
Imagine a cloud of random points gradually reshaping into the distribution of examples in a dataset. The model learns a rule for how a point should move at each stage. The time variable usually denotes progress along this artificial transformation, not elapsed time in the real world.
Flow matching specifies a training objective rather than a particular neural-network architecture. It is closely connected to continuous normalizing flows and can use several kinds of paths, including paths related to diffusion. Consequently, an architecture name or a claim that a system uses flow matching does not by itself describe the training data, sampling cost or output quality.
How it works
Choose a starting distribution, commonly Gaussian noise, and a family of paths toward data examples. Sample a training time and a point on a chosen conditional path, then calculate its target velocity. A neural network receives the point and time and is trained to reduce squared error against that velocity.
Conditional flow matching makes supervision practical even when the overall distribution's target velocity is unavailable. Under the construction's assumptions, its expected parameter gradients match those of the corresponding marginal objective. The learned field averages appropriate conditional information; it is not supplied with the eventual training example during ordinary unconditional generation.
At generation time, sample an initial point and solve an ordinary differential equation using the network's velocity predictions. Training can avoid simulating the learned flow, but generation still requires numerical integration in this standard formulation. Path choice, coupling, approximation error and solver settings influence the final outcome.
Three practical examples
1. Visual content research: train a generative model over image representations, then decode generated representations into images. Evaluate composition, diversity and artifacts, rather than assuming a lower velocity loss guarantees useful pictures.
2. Audio generation research: model continuous audio representations with a learned flow and suitable conditioning. Check intelligibility, temporal consistency and generation latency on the intended task.
3. Simulation support: generate candidate continuous parameter vectors for a simulator. Enforce or test domain constraints separately, since matching a training distribution does not establish that every generated candidate is valid.
Think of it this way
Think of learning a changing map of currents that carries a cloud of floating markers into a desired arrangement. Each local arrow indicates a direction and speed. The analogy concerns transport of a distribution. The learned current is mathematical, not physical, and a visually simple route for one training pair does not guarantee simple trajectories for the entire learned population.
Worked example
Consider one scalar conditional training path of the form x_t = (1 − 0.9t)x_0 + t x_1. This leaves a residual noise scale of 0.1 at the endpoint. Suppose the sampled noise value is x_0 = −2 and the data example is x_1 = 3.
At t = 0.4, the point is (1 − 0.36) × (−2) + 0.4 × 3 = −1.28 + 1.2 = −0.08. Differentiating this path with respect to t gives target velocity x_1 − 0.9x_0 = 3 + 1.8 = 4.8. If the network predicts 4.3, the scalar squared-error contribution is (4.3 − 4.8) squared = 0.25.
At t = 1, this particular path ends at 0.1 × (−2) + 3 = 2.8, not exactly 3, because residual noise was deliberately retained. This is a single training example. It neither describes the complete marginal field nor proves that a generated sample will follow this same straight line or reach this same endpoint.
Illustrative case study
Fictional case: Willow Studio compares two prototype image generators trained on the same approved asset collection. One uses a flow-matching objective. The developers report both image evaluations and the number of network evaluations required by the sampling solver at selected settings.
The creative team finds that some fast settings introduce visible defects and chooses a more suitable operating point for its review workflow. It also examines repeated compositions and failures on unusual briefs. This fictional case illustrates evaluating the complete generation process rather than treating a training-method label as evidence of quality or speed.
Common misconceptions and mistakes
Simulation-free training does not mean computation-free sampling. Conditional paths do not automatically make the marginal transport globally optimal, even when a conditional path has an optimal-transport interpretation. Nor does using straight conditional paths guarantee straight learned trajectories.
The network predicts a velocity field, not necessarily a clean final sample at every intermediate point. A low average training loss can coexist with failures on rare regions. Deterministic evolution given an initial sample does not remove diversity: different random starting samples can produce different outputs. Numerical solvers introduce approximation error that must be evaluated.
Business use
For a practical assessment, ask which representation is modeled, how conditioning is supplied and how many model evaluations generation requires. Compare quality and latency at the same useful output resolution and task conditions. Include failure cases, memory demands and the expense of training or adaptation.
If outputs must satisfy constraints, test those constraints directly. Record solver settings alongside the model version so comparisons can be reproduced. The framework provides a route to learning generative transport; it does not replace validation of the data, representation, generated content or intended use.
People also ask
Is flow matching the same as diffusion?
The frameworks are related and can share probability paths, but flow matching directly trains a velocity field through its matching objective.
Does sampling always take one step?
No. Standard generation numerically integrates the learned field, often with multiple evaluations.
What does conditional mean here?
It can refer to paths constructed using a particular data example. That is distinct from user-facing conditioning such as a text prompt.
Check your understanding
Why does the worked path end at 2.8 rather than the target example 3?
Answer: Its endpoint retains 0.1 times the sampled noise value, which is −0.2. The chosen conditional endpoint distribution is concentrated around the example rather than collapsing exactly onto it.
Related terms
- Diffusion model
- Optimal transport
- Generative model
- Continuous normalizing flow
- vector field
- conditional flow matching
- ordinary differential equation
- numerical integration
Learn next
Plot a simple conditional path and its velocity, then compare it with the learned marginal field for multiple examples. Next study how changing residual noise and solver tolerances affects endpoint distributions and sampling error.
More in Probabilistic machine learning
- Exponential family factor analysis - Exponential family factor analysis is a latent-variable approach that explains many observed measurements using fewer hidden factors while allowing...
- Extended Kalman smoother - An extended Kalman smoother estimates past hidden states of a nonlinear dynamic system using observations collected both before and after those states.
- f-divergence - An f-divergence is a measure of difference between probability distributions generated by a chosen convex function f.
- Forney factor graph - A Forney factor graph is a graphical representation of a factorized function in which nodes represent factors and edges represent variables.
- Forward filtering backward sampling - Forward filtering backward sampling (FFBS) is a method for drawing complete hidden-state sequences from their posterior distribution given observed data.
- Forward-mode automatic differentiation - Forward-mode automatic differentiation computes derivatives by carrying derivative information alongside values as a program evaluates a function.
Sources
Lipman and colleagues, Flow Matching for Generative Modeling, objectives and conditional Gaussian paths: https://arxiv.org/html/2210.02747v2
Independent review verified the primary formulation. The scalar path, loss calculation and fictional cases are original illustrations; no claim is made that they reproduce the paper's experiments.
Previous: Flow-based programming Next: Flow sampling