flow_matching
The 2D velocity-field MLP from the official Flow Matching library's synthetic example.
Diffusion and generative · 20 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Parameters
- 791K
- Operations
- 20
- Framework
- PyTorch
- Recurrent
- No
- Published
- ICLR 2023
- Cited by
- 189 (as of 16 October 2026)
- Authors
- Yaron Lipman, Ricky T. Q. Chen, Heli Ben-Hamu and others
- License
- CC-BY-NC-4.0
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m5044
- Graph hash
- 78edea29a9a12e7271cd0133a63565cf22a3f53c561841887abb22c899aec620
- Skeleton hash
- d394281936d444c978fb9436c83ae33b5ec63794fe551656830cdb9750f02668
- Architecture hash
- b1fbefbcc23f40ba886da7222ab5d22dd58611368c8f1e839c5742da5a811bfc
- Diagram SHA-256
- 958ff083ffc2ebd816e4e8bc05397b7223ca7a1501d888738bca3d3287bb2229
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
What it is
Flow Matching is a simulation-free way to train continuous normalizing flows: instead of simulating an ODE during training, a network regresses a vector field that generates a chosen probability path from noise to data. The loss is plain regression: the network's vector field is matched to a target field, and at zero loss the learned flow generates the target distribution. The trick that makes this tractable is the per-example conditional objective, which gives the same gradients without knowing the intractable marginal field.
Diffusion paths are a special case, and using FM with them is a more robust and stable way to train diffusion models. Optimal-transport displacement paths are the paper's favourite: faster to train and sample, with better generalisation. Sampling then means integrating the learned field with an off-the-shelf ODE solver.
The traced member is not an image model but the velocity network from the official library's continuous 2D synthetic example notebook, examples/2d_flow_matching.ipynb. It is a small network standing in for the velocity field, which the guide notes is also called the vector field. The library releases no pre-trained models; every example trains from scratch.
Key idea. A simulation-free regression objective for continuous normalizing flows that subsumes diffusion paths and enables optimal-transport paths.
- flow matching
- flow_matching
- conditional flow matching
- cfm
- continuous normalizing flow
- cnf
- velocity field
- vector field
- optimal transport path
- lipman
- flow matching guide and code
- 2d example
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{lipman2023flowmatchinggenerativemodeling,
title={Flow Matching for Generative Modeling},
author={Yaron Lipman and Ricky T. Q. Chen and Heli Ben-Hamu and Maximilian Nickel and Matt Le},
year={2023},
eprint={2210.02747},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2210.02747},
}