Abstract
Normalizing Flows (NF) are powerful likelihood-based generative models that are able to trade off between expressivity and tractability to model complex densities. A now well established research avenue leverages optimal transport (OT) and looks for Monge maps, i.e. models with minimal effort between the source and target distributions. This paper introduces a method based on Brenier's polar factorization theorem to transform any trained NF into a more OT-efficient version without changing the final density. We do so by learning a rearrangement of the source (Gaussian) distribution that minimizes the OT cost between the source and the final density. The Gaussian preserving transformation is implemented with the construction of high dimensional divergence free functions and the path leading to the estimated Monge map is further constrained to lie on a geodesic in the space of volume-preserving diffeomorphisms thanks to Euler's equations. The proposed method leads to smooth flows with reduced OT costs for several existing models without affecting the model performance.
Introduction
Normalizing Flows (NFs) are a staple of modern generative modeling, prized for their ability to transform a simple probability distribution (like a Gaussian) into a complex data distribution through a series of invertible mappings. However, while NFs are expressive, they aren't always "efficient." They often take a convoluted path to move mass from point A to point B, resulting in high "transport costs" and potentially scrambled latent representations.
In generative modeling, we want to map a simple source distribution $\nu$ (usually a standard Gaussian) to a target data distribution $\mu$. While many functions can achieve this mapping, Optimal Transport seeks the "Monge map"—the specific transformation that minimizes the total distance moved (the $L_2$ cost). Standard NFs are rarely Monge maps; they might "twist" or "loop" the data during the transformation. While this doesn't hurt the final density estimation, it makes the model less interpretable and can destroy the underlying structure of the latent space.
Methods: Geodesic Gaussian Preserving Flows
The authors leverage Brenier’s polar factorization theorem, which states that any non-degenerate map can be factored into the composition of an optimal transport map and a measure-preserving map.
- Gaussian Preserving (GP) Flows: The core idea is to learn a rearrangement of the source Gaussian distribution (a GP flow) that "pre-shuffles" the points before they enter the pre-trained NF. Because this shuffle is Gaussian-preserving, the final output density remains identical, but the total path from start to finish becomes much shorter.
- Divergence-Free Vector Fields: To ensure the GP flow actually preserves the Gaussian measure, the authors construct it using divergence-free functions. They provide a novel, GPU-friendly construction for these functions that scales to higher dimensions ($d=10$).
- Euler’s Geodesics: To find the "best" rearrangement, the authors use Euler’s equations (from fluid dynamics) as a regularization term. This constrains the transformation to lie on a geodesic—essentially a "straight line" in the space of volume-preserving diffeomorphisms—resulting in much smoother trajectories.
Key Insights: Structure Preservation
One of the most striking findings is that OT isn't just about mathematical elegance; it has practical benefits for representation learning. By making the flow OT-efficient, the model better preserves disentanglement. If a VAE latent space has a specific axis for a feature like "rotation," the OT-corrected flow is much more likely to keep that axis intact than a standard NF, which might warp the latent space significantly.
Results
The authors evaluated their approach on synthetic 2D distributions and high-dimensional latent spaces (dSprites, MNIST, Chairs).
- Reduced OT Cost: On the dSprites dataset, adding the GP flow reduced the transport cost of a FFJORD model from 10.45 to 5.69. Adding Euler regularization further dropped it to 5.30.
- Disentanglement Recovery: Standard NFs often "destroy" the disentangled structure of a VAE latent space. On dSprites, a vanilla FFJORD dropped the disentanglement score from 0.58 to 0.39. The proposed GP flow recovered it back to the original 0.58.
- Visual Fidelity: Qualitative results show that the GP-corrected flows closely approximate the exact Monge map.
Conclusion
This work demonstrates that you don't need to sacrifice your favorite NF architecture to gain Optimal Transport properties. By wrapping a pre-trained model in a Gaussian Preserving flow, one can achieve smoother trajectories and better preservation of latent structures. While scaling to very high dimensions ($d > 1000$) remains a challenge due to the quadratic growth of the divergence-free field construction, this post-hoc optimization offers a powerful tool for improving the interpretability and efficiency of generative models.
Summary updated