Flow matching is a training method for generative models in which a neural network learns a time-dependent velocity field that transports samples from a simple noise distribution to the data distribution along continuous paths. Generation then means solving an ordinary differential equation: start from random noise and follow the learned velocity until the sample becomes an image, an audio clip or another data point.
In generative AI, flow matching has become one of the main alternatives to classic diffusion training. Its best-known variant, rectified flow, uses straight-line paths between noise and data, and this formulation underlies several current text-to-image and text-to-video systems, including Stable Diffusion 3 and the Flux model family. The method is valued for simulation-free training, stable optimization and the ability to generate good samples with relatively few solver steps.
How flow matching learns a velocity field
Flow matching trains a network to predict the direction and speed in which a partially noisy sample should move at a given time t between 0 and 1. The method defines a probability path, a family of intermediate distributions that begins at pure noise and ends at the data distribution, and asks the network to match the velocity that generates this path.
The key practical idea is conditional flow matching. The true velocity of the whole path is intractable, but for a single pair of a noise sample x0 and a data sample x1 the velocity is known in closed form. Regressing onto these per-pair targets gives the same gradient in expectation as regressing onto the intractable marginal velocity.
- Draw a data sample x1 and a noise sample x0 from a standard Gaussian.
- Draw a time t, often from a uniform or logit-normal distribution.
- Form the interpolated point
x_t = (1 - t) * x0 + t * x1. - Train the network so that its output at x_t and t approximates the target velocity x1 – x0 under a mean squared error loss.
Because the training point is computed directly, no differential equation has to be simulated during training. This simulation-free objective is what separated flow matching from earlier continuous normalizing flows, which required expensive solver calls inside every training step.
Probability paths and main variants
The behavior of a flow matching model is largely decided by the choice of probability path and coupling. The path determines how intermediate samples look, while the coupling determines which noise sample is paired with which data sample.
| Variant | Path or coupling | Main property |
|---|---|---|
| Rectified flow | Straight line, independent pairs | Simple target, widely used in image models |
| Optimal transport path | Linear path with shrinking Gaussian width | Nearly straight trajectories |
| Variance-preserving path | Diffusion-style Gaussian schedule | Recovers a diffusion model as a special case |
| Minibatch OT coupling | Noise and data paired by optimal transport within a batch | Straighter flows, fewer sampling steps |
| Reflow | Retraining on pairs produced by an earlier model | Progressively straighter, few-step generation |
Straight paths matter because a numerical solver follows a straight trajectory almost exactly with large step sizes. Curved trajectories require many small steps; this is the main reason rectified flow models often produce acceptable images in 20 to 30 steps rather than the 50 or more that older diffusion samplers needed.
Flow matching compared with diffusion and related models
Flow matching and diffusion models are closely related rather than opposed. A Gaussian diffusion process defines one particular probability path, and its noise prediction, score and velocity parameterizations can be converted into one another. The practical differences lie in the path, the prediction target and the time weighting.
| Model family | What the network learns | Sampling procedure | Typical trade-off |
|---|---|---|---|
| Flow matching | Velocity field | Deterministic ODE solve | Fast, stable training; several steps |
| Diffusion model (DDPM) | Noise or score | Stochastic or ODE sampler | Mature tooling; often more steps |
| Normalizing flow | Invertible mapping | Single exact pass | Exact likelihood; restricted architectures |
| GAN | Generator against a discriminator | Single pass | Very fast; unstable training, mode collapse |
| Consistency model | Direct map to the clean sample | One to few steps | Fast; usually distilled or harder to train |
Compared with a GAN, flow matching gives stable regression training and good mode coverage at the cost of iterative sampling. Compared with a normalizing flow, it allows any network architecture, such as a diffusion transformer, because the learned map does not have to be invertible layer by layer.
Where flow matching is used
Flow matching is used wherever a team needs a high-quality continuous generative model with predictable training. Most large deployments operate in a compressed latent space produced by a variational autoencoder, exactly as in latent diffusion.
- Text-to-image generation with diffusion transformer backbones and classifier-free guidance.
- Text-to-video and image-to-video models, where fewer solver steps reduce very high inference costs.
- Speech and audio synthesis, including zero-shot voice and sound generation.
- Scientific domains such as protein structure, molecule and material generation, often on non-Euclidean spaces.
Inference settings have a strong effect on output. The table below summarizes the parameters that practitioners adjust most often when sampling from a flow matching model.
| Setting | Typical range | Effect |
|---|---|---|
| Solver steps | 4-50 | More steps improve detail up to a plateau |
| Solver type | Euler, Heun, higher-order | Higher order gives accuracy per step at more cost |
| Timestep shift | 1.0-3.0 or resolution-based | Spends more steps at high noise for large images |
| Guidance scale | About 3-7 | Stronger prompt adherence, less diversity |
| Random seed | Any integer | Fixes the starting noise and the result |
Limitations and common misconceptions
Flow matching is not a one-step generator by default. A model trained with independent noise and data pairs still learns curved marginal trajectories, because many different data points share overlapping noise regions; few-step quality usually requires reflow or distillation.
Other recurring points of confusion are worth stating precisely. Straight conditional paths do not imply straight learned flows, the exact likelihood is available only through costly divergence integration, and quality differences between flow matching and diffusion models often come more from data, scale and timestep weighting than from the formulation itself.
- Timestep sampling matters: uniform sampling can undertrain the hard middle region, which is why logit-normal schemes are popular.
- Deterministic sampling reduces diversity for a fixed seed; stochastic samplers can restore some variation.
- Guidance still adds cost, since classifier-free guidance typically doubles network evaluations per step.
In simple terms
Imagine a cloud of random static and a gallery of real photographs. Flow matching teaches a model which way to push each speck of static, little by little, so that the cloud gradually becomes a believable photograph.
During training, the model sees points partway between noise and real pictures and learns the arrow that leads toward the picture. Later it starts from fresh noise and simply follows those arrows. When the arrows point along nearly straight routes, the model needs only a few moves to arrive, which is why these systems can create images quickly.
A practical example
A design studio runs an open-weight rectified flow image model on a single workstation GPU to produce concept art for a client presentation. The default workflow uses 28 Euler steps at 1024 by 1024 pixels with a guidance scale of 3.5, and each image takes roughly fifteen to twenty seconds.
To review more ideas, the team switches to a distilled version of the same model that runs in 4 steps. Images appear in about three seconds, so an art director can explore around two hundred compositions in an afternoon. Fine texture and small text are noticeably weaker, so the studio keeps a simple rule: fast few-step drafts for exploration, then the full 28-step model with the same prompt and seed for the final selected frames. The result is a faster creative cycle without sacrificing the quality of delivered work.