Introduction
Normalizing Flows (NFs) are a prominent class of generative models that transform a simple base distribution into a complex target distribution through a sequence of invertible mappings. While highly effective, NFs are traditionally constrained by the "Jacobian bottleneck." To ensure a valid probability density during Maximum Likelihood Estimation (MLE), the model must compute the determinant of the Jacobian for every transformation. For unconstrained linear layers, this operation scales at $O(D^3)$, where $D$ is the data dimension. Consequently, researchers have historically relied on restricted architectures, such as triangular matrices or masked convolutions, which limit the model's capacity to learn complex dependencies.
This paper introduces EBFlow (Energy-Based Normalizing Flow), a framework that bypasses this bottleneck by reinterpreting normalizing flows through the lens of Energy-Based Models (EBMs) and utilizing score-matching objectives for training.
Bypassing the Jacobian Bottleneck
The fundamental insight of EBFlow is that the Jacobian determinant of a linear layer is independent of the input $x$. When a normalizing flow is treated as an EBM, the density function can be factorized into an unnormalized density (the "energy") and a normalizing constant. In the case of linear flows, the computationally expensive Jacobian determinant is absorbed into this normalizing constant.
By shifting the training objective from MLE to Score Matching (SM), the authors eliminate the need to compute the determinant entirely. Score matching minimizes the difference between the model's score—the gradient of the log-density with respect to the input—and the data's score. Since the gradient of a constant (the Jacobian determinant) with respect to the input is zero, the bottleneck term vanishes during the weight-update phase. This reduction shifts the training complexity from $O(D^3 L)$ to $O(D^2 L)$ for an $L$-layered model, enabling the use of fully unconstrained linear layers.
Stability and Implementation
Score matching is known for numerical instability. To address this, the authors implement two key techniques:
- Match-after-Preprocessing (MaP): The authors identify that certain layers, such as the logit transforms used to map data to the $(0, 1)$ interval, are numerically sensitive. MaP excludes these layers from the score-matching objective, preventing gradient explosions.
- Exponential Moving Average (EMA): EMA is applied to parameter updates to smooth the training process and reduce variance in the learned score function.
Experimental Results
The researchers evaluated EBFlow across synthetic 2D datasets, MNIST, CIFAR-10, and CelebA. The results demonstrate significant improvements in both efficiency and expressiveness:
- Massive Computational Speedups: On CIFAR-10 ($D=3072$), EBFlow achieved a throughput of 39.84 batches per second using Finite Difference Sliced Score Matching. In contrast, the standard MLE baseline managed only 0.02 batches per second—a nearly 2000x speedup.
- Superior Expressivity: The authors compared "F-type" (Full matrix) unconstrained layers against traditional "L" (Lower) or "U" (Upper) triangular layers. The unconstrained layers trained via EBFlow significantly outperformed the constrained versions in terms of negative log-likelihood (NLL), proving that previous architectural restrictions were indeed a limiting factor for model performance.
- Competitive Accuracy: EBFlow achieved NLL scores on MNIST (~1092) that are competitive with MLE-trained flows and vastly superior to previous attempts at training flows with score matching, which typically ranged between 1647 and 3398.
Limitations and Discussion
Despite its advantages, EBFlow faces challenges common to score-matching methods. One primary issue is "blindness," where the model struggles to learn the relative weights of modes in a multi-modal distribution if those modes are spatially distant. This was observed in experiments with the Checkerboard dataset.
Furthermore, while training is exceptionally fast, calculating the exact NLL for inference still requires an $O(D^3)$ operation. Although this only needs to be performed once after training, it remains a consideration for extremely high-dimensional data. Finally, the authors noted that sampling quality could occasionally degrade during very long training runs, suggesting a need for further research into the long-term stability of the objective.
Conclusion
EBFlow provides a robust solution to the Jacobian bottleneck in normalizing flows. By leveraging score matching to ignore the determinant during training, it allows for the use of unconstrained linear layers that are both more expressive and significantly faster to train than their constrained counterparts. This work opens new avenues for scaling normalizing flows to high-dimensional datasets without sacrificing architectural flexibility.
Summary updated