Improving Variational Inference with Inverse Autoregressive Flow

Diederik P. Kingma, Tim Salimans, Max Welling

Introduction

Variational Autoencoders (VAEs) are powerful generative models, but their performance is often constrained by the simplicity of the approximate posterior distribution, typically assumed to be a diagonal Gaussian. This "approximation gap" limits the model's ability to capture complex dependencies in high-dimensional data.

The Problem: Simple Posteriors in VAEs

Standard VAEs map input data to a latent space where variables are assumed to be independent. As shown in Figure 1, while the prior is a simple Gaussian, the true posterior of complex data is often far more intricate. Standard VAEs struggle to match this complexity, leading to suboptimal reconstruction and generation.

Comparison of latent space distributions: (a) Prior, (b) standard VAE posterior, and (c) IAF-enhanced posterior.

Methods: Inverse Autoregressive Flow (IAF)

To address this, the authors propose Inverse Autoregressive Flow (IAF). Normalizing flows transform a simple distribution into a complex one through a sequence of invertible mappings. IAF leverages the structure of autoregressive models but inverts the transformation to enable massive parallelism.

In a single IAF step, a latent variable $z$ is updated using scale ($\sigma$) and shift ($\mu$) parameters produced by an autoregressive neural network.

Schematic of a single IAF step showing the transformation of latent variable z.

The transformation follows: $z_t = \mu_t + \sigma_t \odot z_{t-1}$. Because the parameters depend only on the previous state $z_{t-1}$ (or a noise vector in the first step), the entire vector can be computed in parallel during inference, unlike standard autoregressive models which are sequential. For deep VAEs, the authors also employ a bidirectional architecture that integrates bottom-up image data with top-down latent information.

Key Insights

  • Parallelism: IAF achieves the flexibility of autoregressive models without the sequential sampling bottleneck, making it highly efficient for high-dimensional tensors.
  • Variable Reordering: Reversing the order of variables between flow steps ensures that all dimensions eventually interact, improving the flow's expressivity without complicating the Jacobian math.
  • "Free Bits" Objective: To prevent "posterior collapse" (where the model ignores latent variables), the authors use a modified objective that enforces a minimum information gain ($\lambda$) per latent group.

Results

The model was evaluated on MNIST and CIFAR-10. On MNIST, IAF achieved a state-of-the-art log-likelihood of -79.10 for VAE-based methods. On CIFAR-10, it reached 3.11 bits per dimension, significantly outperforming previous latent-variable models.

Crucially, IAF offers a massive speedup in data generation. On a Titan X GPU, it generated images in 0.05 seconds, roughly 1000x faster than PixelCNN (52.0 seconds), effectively bridging the gap between high-quality autoregressive models and fast VAEs.

Conclusion

IAF represents a significant step forward in variational inference, providing a scalable and flexible way to model complex posteriors. By combining the strengths of normalizing flows and autoregressive architectures, it enables high-fidelity generative modeling at speeds suitable for real-time applications.

Summary updated

BibTeX
@inproceedings{kingma2016improving,
  author = {Diederik P. Kingma and Tim Salimans and Max Welling},
  title = {{Improving Variational Inference with Inverse Autoregressive Flow}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2016},
}
Figure