NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Self Normalizing Flows

T. Anderson Keller, Jorn W. T. Peters, Priyank Jaini, Emiel Hoogeboom, Patrick Forré, Max WellingICML 2021

Abstract

Normalizing flows are a powerful class of generative models that allow for exact density estimation. However, they often incur a heavy computational tax: the need to compute the determinant of a Jacobian matrix. In Self Normalizing Flows, Keller et al. propose a clever method to bypass this bottleneck, reducing an expensive $O(D^3)$ operation into a leaner $O(D^2)$ update. By using learned approximate inverses to estimate gradients, Self Normalizing Flows (SNF) eliminate the need for expensive Jacobian determinant computations during training. This enables faster training of flexible, unconstrained flow architectures without sacrificing generative quality.

Introduction: The Jacobian Bottleneck

Normalizing flows work by transforming a simple probability distribution (such as a Gaussian) into a complex one through a series of invertible mappings. To calculate the likelihood of data under this model, researchers use the change of variables formula, which requires computing the log-determinant of the transformation's Jacobian.

The primary challenge is that for a general $D \times D$ matrix, computing the determinant (or its inverse) scales cubically—$O(D^3)$. To maintain efficiency, researchers typically restrict their models by using constrained architectures, such as triangular Jacobians (which have easy-to-compute determinants) or Lipschitz-constrained residual blocks. While efficient, these constraints limit the expressivity of the model, often requiring very deep networks to achieve competitive results. The authors ask a fundamental question: Can we train unconstrained, highly flexible flows without paying the $O(D^3)$ price tag?

Methodology

The core innovation of SNF is to stop computing the log-determinant and instead approximate its gradient directly.

  1. Learned Inverses: For every forward transformation $f$ (with parameters $\theta$), the authors introduce a separate "inverse" transformation $g$ (with parameters $\gamma$).
  2. Reconstruction Loss: They add a self-supervised, layer-wise reconstruction penalty: $\|g(f(x)) - x\|^2$. This forces $g$ to become the functional inverse of $f$.
  3. The Gradient Trick: By the inverse function theorem, the derivative of the log-determinant of $f$ involves the inverse of its Jacobian. Since $g \approx f^{-1}$, the authors use the Jacobian of $g$ as a proxy for the inverse Jacobian of $f$ in the gradient update.
  4. Symmetric Training: The overall objective is a mixture of the likelihoods induced by both the forward and inverse paths. This symmetry ensures that both $f$ and $g$ are regularized to be well-conditioned and invertible.

By using the weights of $g$ directly in the gradient update for $f$, the method sidesteps the matrix inversion entirely, bringing the computational cost down to $O(D^2)$.

Experimental Setup

The authors evaluated their framework on standard generative modeling benchmarks to test scalability and performance:

  • MNIST: Used for initial proof-of-concept with both fully connected and convolutional architectures.
  • CIFAR-10: A more complex dataset of natural images to test scalability.
  • ImageNet 32x32: A downsampled version of the massive ImageNet dataset, testing the model's ability to handle high-dimensional data and deep flows (>100 steps).

Key Insights and Results

Theoretical and Structural Advantages

  • Gradient Alignment: One might worry that an approximate gradient would lead to training instability. However, the authors show that the "angular error" between their approximate gradient and the true gradient quickly drops to less than 1 degree during training.
  • Amortized Inference: While training uses approximations, exact likelihood evaluation (inference) still requires the exact determinant. The authors point out that for linear layers, the determinant is data-independent. Once the model is trained, the determinant can be computed once and reused for all future samples, effectively amortizing the cost.
  • Breaking Constraints: Unlike models like Glow or RealNVP, which use specific coupling layers to keep the Jacobian simple, SNF allows for more general transformations. This includes unconstrained $1 \times 1$ convolutions, which can be significantly more expressive.

Empirical Performance

  • Speed: On MNIST, the SNF version of a 2-layer fully connected model trained roughly 2.4x faster per batch than the exact gradient version. For convolutional models, the speedup in sampling was even more dramatic.
  • Performance: SNFs achieved nearly identical negative log-likelihood (NLL) values compared to their exact counterparts. For example, on MNIST, the SNF model hit 947.1 nats versus the exact model's 947.6 nats.
  • Scalability: The method scales much more favorably as the input dimensionality increases. While exact methods see a steep, cubic rise in computation time, SNF remains relatively flat.

Limitations and Future Work

While highly effective, the SNF framework has a few notable limitations:

  • No Convergence Guarantees: The paper lacks a formal proof that this approximate gradient scheme will always converge, relying instead on the empirical observation that the reconstruction loss stays low.
  • Convolutional Inverse Constraint: In the convolutional case, the authors assume the inverse of a convolution is also a convolution. Mathematically, this isn't always true, which might limit the accuracy of the approximation for certain kernels.
  • Hyperparameter Sensitivity: The reconstruction weight ($\lambda$) needs careful tuning. If it is too low, the inverse approximation fails; if it is too high, it might over-regularize the forward model.

For future work, the authors suggest exploring "asymmetric" flows where the inverse function $g$ is structurally more complex than the forward function $f$, allowing it to better capture the true inverse.

Summary updated

BibTeX
@inproceedings{keller2021self,
  author = {T. Anderson Keller and Jorn W. T. Peters and Priyank Jaini and Emiel Hoogeboom and Patrick Forré and Max Welling},
  title = {{Self Normalizing Flows}},
  booktitle = {International Conference on Machine Learning},
  year = {2021},
  url = {https://openreview.net/forum?id=LGi4WDJJAHB},
}
Figure