Overview
Master the conceptual foundation of flow matching and continuous normalizing flows. Understand how to learn a trajectory from noise to data by training a vector field.
Goal: Build intuition for the ODE perspective on generative modeling and understand why flow matching is often simpler than diffusion.
Key Concepts
📋 Concepts
The ODE Trajectory Mental Model
Core idea: Generative modeling as learning a continuous path from noise to data .
Define an ODE:
Where is a learned vector field.
Forward process: (noise to data)
Sampling: Solve ODE forward from to get
Intuition: Instead of learning to denoise (diffusion), learn the velocity at each point along the path.
Flow Matching Objective
Goal: Train to match the true vector field .
Conditional flow matching loss:
Where:
- : Real data sample
- : Interpolated sample at time
- : Target vector field (analytically computable!)
Key insight: Unlike diffusion (which requires score matching), flow matching has a simple regression objective.
Flow Matching vs Diffusion Models
| Aspect | Diffusion Models | Flow Matching |
|---|---|---|
| Forward process | Stochastic (SDE) | Deterministic (ODE) |
| Training objective | Score matching (Γêç log p) | Vector field regression |
| Sampling | SDE/ODE solvers | ODE solvers only |
| Simplicity | More complex | Simpler math |
| Flexibility | Fixed noise schedule | Flexible paths |
When to use flow matching:
- You want a simpler training objective
- You want to design custom interpolation paths
- You prefer deterministic generation
When to use diffusion:
- You want stochasticity for diversity
- You’re using existing diffusion codebases (Stable Diffusion, etc.)
ODE Solvers for Sampling
Euler method (simplest):
Runge-Kutta 4 (RK4) (more accurate, fewer steps): More complex multi-stage method, but allows larger .
DPM-Solver (optimized for generative models): Exploits structure of learned vector fields for fast sampling.
Trade-off: Accuracy vs speed. Euler needs ~100 steps, RK4 ~50 steps, DPM-Solver ~20 steps.
Training Flow Matching Models
Algorithm
- Sample data
- Sample noise
- Sample time
- Interpolate:
- Compute target:
- Loss:
Key: The target is analytically known (no score estimation needed).
Interpolation Schedule
Linear interpolation:
Variance-preserving (VP):
Choice matters: Affects sample quality and training stability.
Key Resources
📚 Essential Reading
Flow Matching for Generative Modeling (arXiv:2510.21890)
https://www.arxiv.org/abs/2510.21890
Comprehensive tutorial on flow matching for diffusion modeling. Explains the connection between diffusion and flows, and why flow matching often leads to simpler training. Start here.
MIT Diffusion Course 2025
https://diffusion.csail.mit.edu/2025/
MIT course covering diffusion models and flow matching with lectures, notes, and code. Excellent for structured learning.
Learning Path
Phase 1: Theory (5 hours)
- Read flow matching arXiv paper (2510.21890)
- Work through ODE trajectory derivations
- Compare to diffusion formulation
Phase 2: Implementation (5 hours)
- Implement flow matching on 2D toy data (moons, circles)
- Visualize learned vector fields
- Experiment with different interpolation schedules
- Compare Euler vs RK4 sampling
Phase 3: Deep Dive (2 hours)
- Watch MIT Diffusion Course lectures on flow matching
- Read original Conditional Flow Matching paper (Lipman et al.)
- Understand Rectified Flow (next node prerequisite)
Common Pitfalls
❌ Confusing forward/backward: Sampling goes forward in time (0to1), not backward like diffusion.
❌ Wrong target vector: Make sure to use the conditional target (u_t(z_t | z_1)), not the marginal.
❌ Too few sampling steps: Euler method needs ~100 steps. Use adaptive solvers for faster sampling.
❌ Ignoring interpolation schedule: Linear interpolation works but VP schedules often train faster.
Next Steps
- to Rectified Flow / Consistency Toolkit: Modern training and distillation methods
- to Conditioning & Control: Add T2V, I2V, camera control to flow models
Assessment Criteria
✅ You understand this node when you can:
- Explain the ODE trajectory view of generative modeling
- Derive the flow matching loss from scratch
- Implement flow matching on toy datasets
- Articulate the difference from diffusion models
- Choose appropriate ODE solvers for sampling