OT-Flow: Fast and Accurate Continuous Normalizing Flows via Optimal Transport

Derek Onken, Samy Wu Fung, Xingjian Li, Lars Ruthotto

Introduction

Continuous Normalizing Flows (CNFs) represent a powerful class of generative models that transform a simple base distribution into a complex data distribution via an Ordinary Differential Equation (ODE). While theoretically elegant, CNFs have historically been hindered by high computational costs during both training and inference. OT-Flow addresses these limitations by integrating Optimal Transport (OT) theory and a novel exact Jacobian trace computation, resulting in significant performance gains.

The Bottlenecks of Continuous Normalizing Flows

Standard CNFs face two primary challenges:

  1. Trajectory Complexity: Without explicit constraints, the learned ODE paths can become highly curved or "stiff." This requires ODE solvers to take numerous small steps, leading to slow processing.
  2. Trace Computation: Calculating the change in log-density requires the trace of the Jacobian of the dynamics. An exact calculation is $O(d^3)$, which is prohibitive for high-dimensional data. While stochastic estimators like Hutchinson’s are faster, they introduce noise that slows convergence.

The OT-Flow Approach: Straightening the Path

OT-Flow overcomes these hurdles by reframing the CNF problem through the lens of Optimal Transport. By incorporating an $L_2$ transport cost and a Hamilton-Jacobi-Bellman (HJB) regularizer, the model is incentivized to learn the "shortest path"—resulting in nearly straight trajectories.

Comparison of trajectories between OT-Flow and standard CNF.

Furthermore, OT-Flow models the velocity field as the gradient of a potential function ($\Phi$), parameterized by a specialized ResNet. This structure allows for an analytical, exact computation of the Jacobian trace in $O(m^2 d)$ time, where $m$ is the hidden dimension and $d$ is the data dimension. This provides the stability of exact methods with the efficiency of stochastic ones.

Experimental Results

The authors evaluated OT-Flow across various benchmarks, including UCI datasets and image data (MNIST, BSDS300). The results demonstrate that "straight is great": the simplified trajectories allow ODE solvers to converge in far fewer function evaluations (NFE).

Runtime and accuracy benchmarks for OT-Flow.

Key performance metrics include:

  • Speed: OT-Flow achieves an 8x speedup in training and a 24x speedup in inference compared to the state-of-the-art FFJORD model.
  • Efficiency: The model requires 75% fewer parameters while maintaining or exceeding the accuracy of larger, unregularized models.
  • Stability: The exact trace computation leads to faster decay of validation loss and more stable training trajectories. For instance, on the MINIBOONE dataset, OT-Flow requires only 24 function evaluations, compared to hundreds for unregularized CNFs.

Conclusion

By grounding generative modeling in Optimal Transport theory, OT-Flow transforms CNFs from a theoretical curiosity into a practical tool for high-dimensional data. The combination of trajectory regularization and efficient exact trace computation sets a new standard for speed and accuracy in continuous normalizing flows.

Summary updated

BibTeX
@inproceedings{onken2021ot,
  author = {Derek Onken and Samy Wu Fung and Xingjian Li and Lars Ruthotto},
  title = {{OT-Flow: Fast and Accurate Continuous Normalizing Flows via Optimal Transport}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2021},
  doi = {10.1609/aaai.v35i10.17113},
}
Figure