Abstract
Normalizing flows allow for tractable maximum likelihood estimation of their parameters but are incapable of modelling low-dimensional manifold structure in observed data. Flows which injectively map from low- to high-dimensional space provide promise for fixing this issue, but the resulting likelihood-based objective becomes more challenging to evaluate. Current approaches avoid computing the entire objective -- which may induce pathological behaviour -- or assume the manifold structure is known beforehand and thus are not widely applicable. Instead, we propose two methods relying on tricks from automatic differentiation and numerical linear algebra to either evaluate or approximate the full likelihood objective, performing end-to-end manifold learning and density estimation. We study the trade-offs between our methods, demonstrate improved results over previous injective flows, and show promising results on out-of-distribution detection.
Introduction
The manifold hypothesis posits that high-dimensional data, such as images or complex physical measurements, typically concentrates on a lower-dimensional surface embedded within the high-dimensional ambient space. Standard Normalizing Flows (NFs), which rely on bijective transformations between spaces of equal dimension, struggle with this structure. They are forced to spread probability mass across the entire high-dimensional space, leading to a modeling mismatch when the true data distribution is confined to a thin manifold.
While "injective flows" (mapping from low to high dimensions) offer a theoretical solution, they introduce a significant computational hurdle: the volume-change term in the change-of-variables formula involves the Jacobian-transpose-Jacobian ($J^T J$). Differentiating and computing the log-determinant of this term is notoriously difficult for large-scale models. Previous work often bypassed this term or assumed a known manifold, limiting practical applicability.
Methodology: Rectangular Normalizing Flows (RNFs)
This paper introduces Rectangular Normalizing Flows (RNFs), which enable simultaneous manifold learning and density estimation by making the full likelihood objective tractable.
Optimization Objective
The authors maximize the log-likelihood on the manifold while constraining reconstruction error—the distance between data points and the learned manifold—using a Lagrangian multiplier. This ensures the model learns a manifold that both fits the data and simplifies the resulting density estimation.
Tractable Gradients
To handle the $\log \det(J^T J)$ term, the authors employ two key strategies:
- Stochastic Gradient Estimation: By combining Hutchinson’s trace estimator with Conjugate Gradients (CG), the gradient can be estimated without explicitly forming or inverting the massive Jacobian matrix.
- Forward-Backward AD Trick: A clever sequence of Forward-mode (Jacobian-Vector Product, JVP) and Backward-mode (Vector-Jacobian Product, VJP) automatic differentiation allows for efficient computation of $J^T J \epsilon$ products.
For lower-dimensional problems, an Exact Method uses forward-mode AD to construct the Jacobian explicitly, which is more memory-efficient than standard backpropagation in this context.
Experimental Results
Simulated Manifold Learning
In experiments with a von Mises distribution on a 1D circle embedded in 2D space, RNFs demonstrate the importance of the volume-change term. Without it (as in "two-step" methods), the model may learn the correct manifold shape but fail to capture the correct density, "stretching" or "compressing" the distribution incorrectly.
Benchmarking and Out-of-Distribution Detection
On standard tabular datasets, RNFs consistently outperform two-step baselines that decouple manifold learning from density estimation.
Furthermore, RNFs address a common failure mode of standard NFs in Out-of-Distribution (OoD) detection. Standard flows often assign higher likelihoods to simpler datasets (like MNIST) even when trained on complex ones (like Fashion-MNIST). By correctly modeling the manifold structure, RNFs achieve up to 98% accuracy in identifying the training distribution.
Discussion and Limitations
While RNFs represent a significant step forward, scaling backpropagation through injective volume terms to dimensions as high as $D=3,000$ (CIFAR-10), some challenges remain:
- Topology: The model assumes a manifold homeomorphic to Euclidean space, making it difficult to learn disconnected components or complex "holes" without manual intervention.
- Computational Overhead: Although the CG method is efficient, it remains more expensive than standard square flows.
- Numerical Stability: In very high dimensions, the $J^T J$ matrix can become ill-conditioned, requiring careful preconditioning or architectural constraints to maintain stability.
Summary updated