Amortized Monte Carlo Integration

Adam Golinski, Frank Wood, Tom Rainforth

Standard amortized inference focuses heavily on approximating the posterior distribution. However, in many practical applications, finding the posterior is merely an intermediate step toward calculating an expectation. This paper introduces Amortized Monte Carlo Integration (AMCI), a "target-aware" framework that directly amortizes the integration process. By tailoring proposal distributions to the specific function being integrated, AMCI achieves significantly higher accuracy—and theoretically zero variance—compared to traditional methods.

The Problem with Standard Amortized Inference

In Bayesian machine learning, we frequently need to compute an expectation of a target function $f(x)$ under a posterior distribution: $\mathbb{E}_{p(x|y)}[f(x)]$. The standard "amortized" approach, popularized by architectures like Variational Autoencoders, trains a neural network to approximate the posterior $p(x|y)$. Once this approximation is learned, we draw samples from it to estimate the integral.

The authors argue this standard pipeline is fundamentally inefficient for two main reasons:

  1. Target Agnosticism: If the function $f(x)$ you want to integrate is known in advance (e.g., a specific loss function or prediction metric), ignoring it during the training phase is a missed opportunity.
  2. The SNIS Limit: Most amortized methods rely on Self-Normalized Importance Sampling (SNIS). SNIS has a strict theoretical "speed limit"—a lower bound on variance that prevents it from reaching perfect accuracy with a finite number of samples, even if the proposal distribution perfectly matches the posterior.

Amortized Monte Carlo Integration (AMCI)

To overcome these limitations, AMCI abandons the idea of learning a single, one-size-fits-all posterior. Instead, it learns three distinct amortized proposals tailored to handle different parts of the expectation calculation.

Density plots illustrating how AMCI's target-aware proposals shift to cover the target function rather than just the posterior.

The methodology relies on a few key steps:

  • The Ratio Decomposition: The expectation is broken down into a ratio: the "unnormalized expectation" divided by the "normalization constant" (the evidence).
  • Positivization: Because target functions can be both positive and negative, the function is split into its positive ($f^+$) and negative ($f^-$) components.
  • Triple Proposals: AMCI trains three separate proposal distributions ($q_1^+, q_1^-, q_2$) tailored to these specific components. At runtime, a single sample is drawn from each and combined.
  • Tractable Training: Training these "target-aware" proposals typically requires knowing the exact value of the integral you are trying to estimate—a "double intractability" problem. The authors bypass this using a clever change-of-variables trick, altering the distribution of datasets seen during training so the objective function can be computed using only samples from the joint distribution $p(x, y)$.

Key Results and Performance

The paper evaluates AMCI on challenging problems where ground truth is available, demonstrating significant improvements over standard baselines.

Breaking the SNIS Bound on Tail Integrals

One of the most striking insights is that while standard SNIS can never achieve zero variance for non-constant functions, AMCI theoretically can. If the amortization networks are sufficiently expressive, AMCI can produce an exact estimate with just one sample from each proposal.

AMCI performance on 1D and 5D tail integrals compared to SNIS bounds.

This is demonstrated in a "Tail Integral" calculation task, where the goal is to estimate the probability that a variable falls in the extreme tail of a Gaussian distribution. Because the interesting region is far from the mean, it is numerically difficult. As shown in the results, AMCI significantly outperforms the theoretical lower bound of any possible SNIS estimator in both 1D and 5D settings.

Efficiency in Real-World Simulations

The authors also tested AMCI on a simulated cancer treatment planning problem. Here, an oncologist must decide on a treatment based on noisy observations of tumor size, using a loss function derived from a tumor growth simulator. In this setting, AMCI achieved a level of accuracy with just a few samples that required the standard SNIS baseline 10,000 times more samples to match.

Ultimately, AMCI performs best when there is a "mismatch" between the posterior and the target function—that is, when the function is highly sensitive in regions where the posterior density is low. By incorporating $f(x)$ into the proposal training, the model learns to sample from regions that are important for the integral, not just regions that are likely under the posterior.

Limitations and Future Work

While powerful, AMCI has a few limitations:

  • The Curse of Dimensionality: Like all importance sampling methods, AMCI struggles as the dimensionality of the latent space $x$ increases. It scales no worse than standard amortized inference, but it does not inherently solve high-dimensional integration.
  • Requirement of the Target Function: The method requires knowing the target function (or a parameterized family of functions $f(x; \theta)$) during the offline training phase. It is not suited for "exploratory" settings where the target function is completely unknown until runtime.
  • Correlated Estimates: Future work could explore correlating the estimates of the numerator and denominator (e.g., through common random numbers) to further reduce variance when the target function and posterior are well-matched.

Summary updated

Abstract

Current approaches to amortizing Bayesian inference focus solely on approximating the posterior distribution. Typically, this approximation is, in turn, used to calculate expectations for one or mo...
BibTeX
@inproceedings{golinski2019amortized,
  author = {Adam Golinski and Frank Wood and Tom Rainforth},
  title = {{Amortized Monte Carlo Integration}},
  booktitle = {International Conference on Machine Learning},
  year = {2019},
  url = {https://openreview.net/forum?id=rkbPNnZu-H},
}
Figure