TL;DR
Optimal Flow Matching (OFM) is a new generative modeling approach that learns straight, Optimal Transport (OT) trajectories in a single training step. By parameterizing vector fields as gradients of convex functions using Input Convex Neural Networks (ICNNs), OFM avoids the error accumulation of iterative methods and the biases of minibatch heuristics, enabling faster and more accurate inference.
What Problem Does This Paper Address?
Generative models based on Flow Matching (FM) move a simple source distribution (like noise) to a complex target distribution (like images) along a vector field. Ideally, these paths should be straight lines—this corresponds to the "Optimal Transport" displacement, which minimizes the "effort" of moving mass. Straight paths are highly desirable because they allow for extremely fast inference; you can jump from start to finish in a single step without needing to solve a complex Ordinary Differential Equation (ODE).
However, standard FM often produces curved paths. Existing solutions have significant drawbacks:
- Rectified Flow (RF): Straightens paths iteratively, but each iteration accumulates numerical errors and requires expensive ODE integration during training.
- OT-Conditional Flow Matching (OT-CFM): Uses minibatch OT as a heuristic, which is biased and doesn't guarantee truly straight trajectories in practice.
Methods
The authors introduce Optimal Flow Matching (OFM). The core innovation is restricting the search space of vector fields to only those that must produce straight paths by design.
The Secret Sauce: Convexity
Instead of learning a general vector field $u_t(x)$, OFM parameterizes the vector field as the gradient of a convex function $\Psi$. Specifically, they use Input Convex Neural Networks (ICNNs) to represent $\Psi$.
Mathematically, they show that for quadratic transport costs, the optimal vector field $u^*$ defines linear trajectories: $$z_t = (1 - t)z_0 + t\nabla\Psi^*(z_0)$$ where $\Psi^*$ is the Brenier potential.
Training without ODEs
To train the model, they derive a novel loss function that is theoretically equivalent to the dual Optimal Transport loss. A key challenge is that the vector field formula depends on the initial point $z_0$, but during training, we only have the interpolated point $x_t$. To solve this, they perform a flow map inversion: finding the $z_0$ that leads to $x_t$ is framed as a strongly convex optimization sub-problem, which can be solved efficiently using standard optimizers like LBFGS.
Datasets
The authors evaluated OFM across three distinct regimes:
- Illustrative 2D Scenario: Moving a standard Gaussian to a Mixture of 8 Gaussians.
- High-dimensional OT Benchmarks: A standard suite of continuous distributions (dimensions $D=2$ to $256$) where the ground-truth OT map is known.
- Unpaired Image-to-Image Translation: Translating between "Adult" and "Child" faces using the FFHQ dataset. This was performed in the 512-dimensional latent space of a pre-trained ALAE autoencoder.
Key Insights and Ideas
- Theoretical Bridge: The paper proves that minimizing the OFM loss is mathematically equivalent to minimizing the dual OT loss. This provides a rigorous foundation that previous heuristic methods lacked.
- Plan Independence: Standard Flow Matching is sensitive to how you pair source and target points (the "transport plan"). OFM is theoretically agnostic to this choice; whether you use random pairing or minibatch OT, it converges to the same optimal straight-path solution.
- One-Step Convergence: Unlike Rectified Flow, which requires multiple rounds of training and sampling to straighten paths, OFM achieves OT-optimality in a single training run.
- Simulation-Free Inference: Because the learned trajectories are straight, the model can generate samples in one step during inference, bypassing the need for ODE solvers.
Key Results
- Benchmark Performance: On high-dimensional OT tasks, OFM significantly outperformed other FM-based methods. For example, in 128 dimensions, OFM achieved an $L^2$-UVP (Unexplained Variance Percentage) of 1.5% - 1.9%, while OT-CFM scored 12.1% and Rectified Flow scored over 80%.
- Image Translation: In the Adult $\to$ Child face translation task, OFM achieved a Frechet Inception Distance (FID) of 11.0, outperforming OT-CFM (12.9) and c-Rectified Flow (13.5).
- Empirical Stability: 2D experiments confirmed that OFM finds the same straight-line solution regardless of whether the initial training pairs were independent, minibatch-optimized, or even "anti-optimized" (misleading pairs).
Limitations and Future Work
- Computational Cost of Inversion: While OFM is "one-step" in terms of training iterations, each training step requires solving an inner optimization problem (flow map inversion) and inverting a Hessian matrix, which is computationally expensive.
- ICNN Expressivity: Input Convex Neural Networks are harder to train and potentially less expressive than standard architectures. The authors note that more expressive ICNN architectures are a promising area for future research.
- Quadratic Cost Restriction: The current theory is specifically tailored for the quadratic transport cost ($W_2$ distance). Extending this to general cost functions remains an open challenge.
Summary updated