Learning to Infer

Joseph Marino, Yisong Yue, Stephan Mandt

Introduction

In latent variable models like Variational Auto-encoders (VAEs), the goal is to find a hidden representation ($z$) for observed data ($x$). Because calculating the exact posterior distribution is intractable, we rely on Variational Inference (VI) to find an approximation.

Standard VAEs utilize amortized inference: a neural network takes $x$ as input and outputs the parameters of the approximation in a single, fast forward pass. However, this speed comes at a cost known as the "amortization gap"—the difference in accuracy between what a perfect, iterative optimizer could achieve and what the one-shot model actually produces. While traditional optimization (like gradient descent) can close this gap, it is painfully slow because it must be run from scratch for every single data point.

Optimization landscape showing the amortization gap between standard inference and iterative methods.

To address this, the authors introduce iterative inference models, a novel approach to variational inference that moves beyond "one-shot" prediction. By training a model to repeatedly refine its estimate of the latent variables—essentially "learning to optimize"—this method significantly reduces the amortization gap and achieves state-of-the-art performance on several generative modeling benchmarks.

Methods: The Iterative Inference Model

The core innovation of this paper is replacing the direct mapping of data to a posterior estimate with a learned, gradient-based refinement process.

Comparison of Variational EM, Standard Inference, and the proposed Iterative Inference Model.

The iterative inference model operates through several key mechanisms:

  1. Iterative Refinement: Instead of a single pass, the model takes its current latent estimate and the gradient of the objective function (the Evidence Lower Bound, or ELBO) as inputs to produce an updated estimate. This process is repeated for a set number of iterations.
  2. Gradient Encoding: The authors propose two variations for the update step. One encodes the actual gradients of the ELBO, while the other encodes "error terms" (the differences between the model's predictions and the actual data). The error-term approach is computationally cheaper because it avoids backpropagating through the generative model at test time.
  3. Gated Updates: To ensure training stability across multiple steps, the model employs a gated updating scheme (similar to GRUs or "highway" networks). This gating mechanism decides how much of the newly computed update should be incorporated into the current estimate.
  4. Generalization of VAEs: Mathematically, the standard VAE is shown to be a special, single-iteration case of this broader iterative inference framework.

Key Insights and Results

The authors evaluated their approach on standard generative modeling benchmarks, including MNIST, Omniglot, SVHN, CIFAR-10, and the RCV1 text dataset.

  • Closing the Amortization Gap: By allowing the model to evaluate its own mistakes via gradients or error terms and fix them over multiple steps, the iterative model reaches significantly better posterior estimates than a standard VAE.
  • Learning to Optimize is Faster: The iterative model converges to a superior solution in just 5–10 steps, whereas standard optimizers like Adam or RMSProp require hundreds of steps to achieve similar results. The model effectively learns a "custom" optimization path tailored to its specific latent space.
  • Improved Likelihoods: On the binarized MNIST dataset, the iterative model achieved a test log-likelihood of -83.84 nats, outperforming the standard VAE's -84.14 nats.
  • High-Dimensional Sparse Data: On the RCV1 text dataset, the iterative model achieved a perplexity of 382 (compared to 385 for the standard VAE), using significantly fewer parameters than previous state-of-the-art iterative methods.
  • Visualizing Refinement: Qualitative results demonstrate that reconstructions of images start blurry in early iterations and become progressively sharper and more accurate with each inference step. Furthermore, the approach proves particularly powerful for hierarchical models, helping propagate "top-down" information from higher-level latent variables to lower-level ones.

Limitations and Future Work

While highly effective, the iterative approach has some limitations:

  • Computational Overhead: Running multiple iterations is inherently more computationally expensive than a single VAE forward pass, even if it is faster than full optimization.
  • Input Scaling: Because gradients can vary wildly in scale, the authors had to implement a specific log-transformation trick to keep the inputs to the inference model within a manageable range.
  • Architecture Sensitivity: The distribution of gradients changes rapidly during training. This non-stationarity suggests that more advanced architectures, such as specialized RNNs, might be needed to handle the shifting distributions more robustly.

Future directions include exploring more complex "learning to learn" architectures and applying these iterative models to even more complex, high-dimensional data modalities like video.

Summary updated

BibTeX
@inproceedings{marino2018learning,
  author = {Joseph Marino and Yisong Yue and Stephan Mandt},
  title = {{Learning to Infer}},
  booktitle = {Workshops @ ICLR},
  year = {2018},
}
Figure