Variational Inference with Normalizing Flows

Danilo Jimenez Rezende, Shakir Mohamed

This seminal paper introduces Normalizing Flows to Variational Inference (VI), providing a powerful way to move beyond simple Gaussian posterior approximations. By applying a sequence of invertible, differentiable transformations to a simple distribution, the authors construct arbitrarily complex, multi-modal probability densities that remain computationally efficient and scalable.

The Expressivity Gap in Variational Inference

In Bayesian machine learning, estimating a "posterior distribution"—our updated belief about latent variables after seeing data—is a core challenge. Because the true posterior is usually mathematically intractable, we use Variational Inference (VI) to approximate it with a simpler, known distribution (like a Gaussian).

However, traditional VI suffers from a major "expressivity gap." Most practitioners rely on the mean-field approximation, which assumes latent variables are independent and follow a simple bell curve. This is often a poor fit for real-world data, leading to:

  1. Underestimated variance: The model becomes overconfident in its predictions.
  2. Biased estimates: The approximation is so far from the truth that the model parameters themselves become skewed.

The authors tackle this by asking: How can we create a posterior approximation flexible enough to match any shape, yet fast enough for deep learning?

Methods: Normalizing Flows

The core contribution is the Normalizing Flow (NF). The idea is to start with a simple, easy-to-sample distribution (like a standard Normal) and "flow" it through a series of invertible mappings to warp it into a complex shape.

The Mechanism

If you transform a variable $z$ using an invertible function $f$, the change-of-variables formula dictates exactly how the probability density changes. By chaining $K$ such transformations together, you can create a highly complex density. The computational "cost" of this is calculating the Jacobian determinant of the transformation, which measures how much the function stretches or compresses space.

Effect of planar and radial flows on simple distributions

Key Innovations: Planar and Radial Flows

Standard invertible neural networks often have $O(D^3)$ complexity for the Jacobian, which is too slow for high-dimensional data. To solve this, the authors introduce two specific types of flows with linear-time $O(D)$ Jacobian computations:

  • Planar Flows: These apply expansions and contractions along a specific hyperplane, allowing the model to "stretch" the distribution in specific directions.
  • Radial Flows: These apply transformations around a reference point, useful for creating circular or "donut-shaped" densities.

The parameters of these flows are not fixed; they are predicted by an inference network (as in a Variational Autoencoder), allowing the model to adapt the complexity of the posterior to each specific data point.

Key Insights

  • Complexity through Composition: You don't need one massive, complex function to model a difficult distribution. A sequence of very simple, invertible "warps" can achieve the same result.
  • The Infinitesimal Limit: The paper provides a unified view connecting finite flows to infinitesimal flows (like Langevin or Hamiltonian dynamics). As the flow length $K$ goes to infinity, the approximation can theoretically recover the exact true posterior.
  • Amortization is Key: By using a neural network to output the flow parameters, the model "amortizes" the cost of inference. It learns a general rule for how to warp the distribution for any given input, rather than solving a new optimization problem for every data point.

Experimental Results

The authors evaluated their approach across three levels of complexity: 2D toy densities, MNIST (handwritten digits), and CIFAR-10 (natural images).

Visual Success on Toy Problems

On 2D toy problems featuring complex "energy functions" (moons, waves, and multi-modal peaks), Normalizing Flows successfully captured multi-modal and periodic distributions that are impossible to represent with standard Gaussians.

Normalizing Flows matching complex 2D toy densities

Scaling to Real Datasets

  • MNIST Performance: Adding flows to a Deep Latent Gaussian Model (DLGM) significantly improved the Variational Bound. A model with 80 flow steps achieved a negative log-likelihood of $\le 85.1$ nats, compared to $\le 89.9$ for the standard diagonal covariance baseline.
  • CIFAR-10 Scaling: The test log-likelihood improved consistently as the flow length $K$ increased, moving from -293.7 ($K=0$) to -320.7 ($K=10$), proving that richer posteriors lead to better generative models.

Limitations and Future Work

While highly effective, the approach has limitations:

  • Invertibility Constraints: Planar and radial flows require specific parameter constraints to remain invertible, which can sometimes be numerically tricky to enforce during training.
  • High-Dimensional Scaling: While $O(D)$ is efficient, very long chains of flows ($K=80+$) still add computational overhead. Finding the optimal balance between flow depth and latent dimensionality remains an area for exploration.

Ultimately, this paper laid the groundwork for a massive wave of research into invertible neural networks and more sophisticated flow architectures, proving that we no longer have to settle for simple Gaussian approximations in deep generative modeling.

Summary updated

BibTeX
@inproceedings{rezende2015variational,
  author = {Danilo Jimenez Rezende and Shakir Mohamed},
  title = {{Variational Inference with Normalizing Flows}},
  booktitle = {International Conference on Machine Learning},
  year = {2015},
  url = {https://openreview.net/forum?id=rkVNToWO-S},
}
Figure