-
Notifications
You must be signed in to change notification settings - Fork 0
Understanding Flow Matching
Flow Matching provides an alternative approach to generative modeling by learning velocity fields that transform samples from a prior distribution to the target data distribution.
The core idea of Flow Matching is to learn a continuous transformation of samples through a velocity field. Given a sample X₀ from a prior distribution (typically Gaussian) and a target sample X₁, we define:
dX_t/dt = V_t(X_t)
where t ∈ [0,1] represents the continuous time parameter and V_t is the learned velocity field.
The transformation follows the optimal transport trajectory between distributions:
X_t = (1-t)X₀ + tX₁
This provides a direct path in the latent space for training the velocity field.
The time parameter t is sampled from a logit-normal distribution where the underlying Gaussian has zero mean and unit standard deviation:
z ~ N(0,1)
t = σ(z)
This sampling strategy ensures better coverage of the transformation space compared to uniform sampling.
The model learns to predict velocities V_t that match the optimal transport path:
L = E_{t,X₀,X₁}[||V_t(X_t) - (X₁ - X₀)||²]
where (X₁ - X₀) represents the ground truth velocity.
During inference, we generate samples by integrating the velocity field:
X_t = X₀ + ∫₀ᵗ V_s(X_s)ds
This integration is typically performed using numerical ODE solvers.
- The method optimizes directly in the space of continuous flows
- No intermediate distributions or noise scheduling required
- Training is based on optimal transport principles
- The continuous time formulation provides natural interpolation
Note: This is a distinct approach from the methods used in NovelAI V3, which uses different techniques for image generation. See NovelAI V3 Methods for details on that approach.