Flow Matching: Velocity Fields and the Continuity Equation
An interactive live film: transport probability mass from Gaussian noise into target data clusters along straight interpolation paths driven by the learned continuity velocity field.
Narration
Diffusion models corrupt data into noise and learn score functions. Flow matching takes a more direct route: transporting probability mass along deterministic velocity fields.
The continuous transport of probability is governed by the continuity equation: the rate of change of density plus the divergence of flux equals zero. Probability mass is conserved.
Instead of noisy Brownian curves, flow matching connects each noise point to a data point along a straight line, drawn dashed. Time runs upward here, from noise on the floor to data at the top. The target velocity is simply data minus noise.
By averaging target velocities conditioned on location, we obtain a time-dependent vector field. Following this field carries the standard Gaussian cloud smoothly into two separate data clusters.
Because the flow lines are nearly straight, an ordinary differential equation solver can take large steps without veering off course. Here a single Euler step already lands most particles in a cluster.
Your turn. Move the time slider, and pick the number of solver steps. Find the fewest steps that still put nine in ten particles into a cluster.
Flow matching directly learns the velocity of probability mass, turning generative modeling into smooth hydrodynamic transport.
More from Chapter 20
Preview1:28From a Residual Network to a Neural ODEChapter 20
Preview1:27Gradient Flow: Gradient Descent With Infinitely Small StepsChapter 20
Preview1:26Memory by Orthogonal Projection (HiPPO)Chapter 20
Preview1:36Momentum Methods: Second-Order ODEChapter 20
Preview1:34Probability Flow ODE: Deterministic Paths, Identical MarginalsChapter 20
Preview1:40Backward Error Analysis: What Gradient Descent FollowsChapter 20
Preview1:46Rectified Flow: Straightening by RetrainingChapter 20