Flow Matching
11 memberslucid.models.generative.flow_matchingFlow Matching family — Lipman et al., 2023 (simulation-free CNF training).
Lipman, Yaron, et al. "Flow Matching for Generative Modeling." International Conference on Learning Representations, 2023.
A continuous normalizing flow is defined by a vector field: push samples of a simple distribution along and read off what arrives. Training one by maximum likelihood, as Neural ODE does, means solving that ODE on every gradient step — the cost that kept continuous flows off the scale diffusion models reached.
Flow Matching removes the solve. Suppose a probability path interpolating noise and data were known, together with the field that generates it; then a regression would suffice,
Neither nor is available in closed form. The paper's key result — Theorem 2 — is that they need not be. Build the path per data point, as a mixture of conditional paths each generated by a tractable , and regress against the conditional field instead:
The two objectives differ by a constant, so . Training is now a regression against a target with a closed form: simulation-free.
For Gaussian conditional paths , Theorem 3 names the unique generating field,
so a path is fully specified by two scalar schedules and their derivatives. Two instances matter. The diffusion path recovers the variance-preserving process score-based models use — the probability path they were already implicitly training, now reachable by regression. The optimal-transport path takes the schedules straight,
which makes each conditional flow a constant-speed straight line between a noise sample and a data point, and collapses the regression target to something that does not depend on at all:
Diffusion paths bend; these do not, and the particles never overshoot the target they are heading for. Straighter trajectories are cheaper for a solver to follow, which is why sampling needs fewer function evaluations and why the same solver reaches a better FID.
Time runs from noise to data: and . Sampling integrates from to ; likelihood integrates the same field backwards while accumulating , exactly as any continuous flow does.
Classes
Functions
flow_matching_cifar→ FlowMatchingModelFlow Matching velocity field for the CIFAR-10 setup.
flow_matching_cifar_gen→ FlowMatchingForImageGenerationFlow Matching generator for CIFAR-10 32 x 32.
flow_matching_imagenet32→ FlowMatchingModelFlow Matching velocity field for ImageNet 32 x 32.
flow_matching_imagenet32_gen→ FlowMatchingForImageGenerationFlow Matching generator for ImageNet 32 x 32.
flow_matching_imagenet64→ FlowMatchingModelFlow Matching velocity field for ImageNet 64 x 64.
flow_matching_imagenet64_gen→ FlowMatchingForImageGenerationFlow Matching generator for ImageNet 64 x 64.
flow_matching_imagenet128→ FlowMatchingModelFlow Matching velocity field for ImageNet 128 x 128.
flow_matching_imagenet128_gen→ FlowMatchingForImageGenerationFlow Matching generator for ImageNet 128 x 128.