Iterative Amortized Inference

Joseph Marino, Yisong Yue, Stephan Mandt

In the world of deep generative modeling, Variational Auto-encoders (VAEs) are a staple. They allow us to learn complex distributions by "amortizing" the cost of inference—using a neural network (the encoder) to predict the latent variables for any given data point in a single forward pass. But there is a catch: this "one-shot" guess is often sub-optimal, leading to what researchers call the amortization gap.

In their ICML 2018 paper, Joseph Marino and colleagues from Caltech and Disney Research propose a clever middle ground: Iterative Amortized Inference. By teaching the encoder to look at its own mistakes and refine its guess over several steps, they significantly narrow the gap between speed and accuracy.

The Amortization Gap

Variational Inference (VI) treats the task of finding latent variables ($z$) for an observation ($x$) as an optimization problem, where the goal is to maximize the Evidence Lower Bound (ELBO).

Traditionally, there are two ways to tackle this:

  1. Optimization-based: Use gradient ascent for every single data point. It’s highly accurate but painfully slow.
  2. Amortized (Standard VAE): Train a neural network to map $x \to z$ directly. It’s lightning-fast at test time but often misses the global maximum because a single mapping cannot perfectly capture the complex optimization landscape for every possible input.

The difference in performance between these two approaches is the amortization gap. Furthermore, standard "bottom-up" encoders struggle with hierarchical models where "top-down" priors are important.

The amortization gap visualized: standard inference models often miss the global maximum, while traditional gradient ascent requires many slow steps to converge.

Iterative Amortized Inference

To bridge this gap, the authors propose a hybrid approach. Instead of relying on a single feedforward mapping, they introduce an iterative inference model.

The core idea is to update the latent parameters ($\lambda$) over several iterations ($t$): $$ \lambda_{t+1} \leftarrow f(\nabla_\lambda \mathcal{L}_t, \lambda_t; \phi) $$

Key technical highlights include:

  • Learning to Learn: The model $f$ acts as an optimizer that has been explicitly trained to navigate the ELBO landscape.
  • Error Encoding: Rather than just feeding the model raw gradients, the authors found that encoding errors—the difference between the reconstruction and the original data, and the difference between the current latent state and the prior—works even better. These errors act as a proxy for higher-order derivatives (curvature), allowing the model to take smarter optimization steps.
  • Generalization: The authors demonstrate that a standard VAE is actually just a special case of their model: a one-step iterative model.

Key Insights

  • Theoretical Backing for Top-Down Inference: For years, researchers used "top-down" connections in hierarchical VAEs (like Ladder VAEs) because they worked empirically. This paper provides a theoretical justification: the gradients of the ELBO naturally contain terms that compare the current state to the top-down prior.
  • Non-Recurrent Optimizers Work: While previous "learning to learn" work relied heavily on Recurrent Neural Networks (LSTMs), this paper shows that simple feedforward networks can perform inference optimization effectively by just looking at the current gradient or error.
  • Stability: Surprisingly, even though the models were trained for only 16 iterations, they remain stable and continue to improve (or stay at the peak) even if run for hundreds of iterations at test time.

Results and Performance

The authors evaluated their approach across a variety of modalities, including images (MNIST, Omniglot, SVHN, CIFAR-10) and text (RCV1).

  • Closing the Gap: On MNIST and CIFAR-10, the iterative models consistently achieved a higher ELBO (better lower bounds on log-likelihood) than standard amortized models.
  • Faster than Adam: The learned iterative models converged to better solutions in far fewer steps than conventional optimizers like Adam or RMSProp.
  • Sharper Reconstructions: Qualitatively, as the iterations progress, the reconstructed images become visibly sharper and more faithful to the original input.
  • Text Performance: On the RCV1 dataset, the iterative model achieved a significantly lower perplexity (285.0) compared to the standard model (323.0).
Iterative inference models converge to higher ELBO values in a fraction of the iterations required by standard optimizers like Adam or RMSProp.

Limitations and Future Work

The primary trade-off of this approach is computational cost. While much faster than pure optimization, iterative amortized inference is still slower than a standard VAE because it requires multiple forward and backward passes through the generative model per data point.

The authors suggest that future work could involve applying these models to online filtering and sequential latent variable models where priors change over time. Additionally, exploring ways to reduce the number of iterations needed could help maintain the speed advantage of amortization while keeping the accuracy of iteration.

Summary updated

BibTeX
@inproceedings{marino2018iterative,
  author = {Joseph Marino and Yisong Yue and Stephan Mandt},
  title = {{Iterative Amortized Inference}},
  booktitle = {International Conference on Machine Learning},
  year = {2018},
  url = {https://openreview.net/forum?id=ryb9Zi-OWS},
}
Figure