# Variational Inference: A Review for Statisticians

Variational inference turns hard Bayesian computation into optimization

David M. Blei, Alp Kucukelbir, Jon D. McAuliffe · arXiv · 2016-1-4

- **Problem** Computing the posterior is often intractable because the evidence integral has no closed form. MCMC sampling can be too slow when the data set is large.
- **Method** The authors pick a family of densities and keep the member closest to the posterior. Closeness is measured by KL divergence, so inference becomes a search over the family's parameters.
- **Results** On image color histograms, CAVI fit a thirty-cluster Gaussian mixture to ten thousand images, running much faster than Hamiltonian Monte Carlo.

## Why exact posterior inference stalls

Bayesian inference comes down to computing the posterior, which is the joint density divided by the evidence. The evidence is an integral over all latent variables, and for many models it has no closed form. Modern Bayesian models often sit exactly in this regime, where the posterior is not easy to compute.

In the Bayesian mixture of Gaussians, each mean appears in every factor of the integrand, so the integral does not split into simple pieces. Numerically evaluating it costs O(K^n) time, and summing over all cluster configurations leaves K^n terms. So even a small model becomes intractable as the number of data points grows.

MCMC has long been the default answer, building a Markov chain whose stationary distribution is the posterior. That gap is why the authors look for an approach that turns inference into optimization instead of sampling.

## Turning inference into optimization

The key idea is to choose a family Q of densities over the latent variables and keep the member closest to the posterior. Closeness is measured by KL divergence, so the approximation is the member q\*(z) that minimizes KL(q(z) \|\| p(z\|x)) within Q. Once the family is fixed, inference becomes a search problem over its parameters.

The family has to be flexible enough to hold a density near the posterior, yet simple enough to optimize efficiently. Its complexity sets the complexity of the optimization, so the design choice is a trade-off between fidelity and cost. Both the choice of family and the optimizer decide how good the final approximation can be.

The KL objective can't be computed directly, because it contains the log evidence. Expanding the KL shows that minimizing it is the same as maximizing a quantity that drops the log evidence, since that term is constant in q. This quantity is the evidence lower bound, and it is what the optimization maximizes in practice.

## Mean-field factors and the CAVI update

The mean-field family makes every latent variable independent, with its own factor q\_j(z\_j). In principle each factor can take any parametric form suited to its variable, such as a Gaussian for a continuous variable. The paper's mixture example uses Gaussian factors for the means and categorical factors for the assignments.

CAVI, the coordinate ascent algorithm, updates one factor at a time while holding the others fixed. Because of the independence built into the family, that expectation doesn't depend on q\_j itself, so the update is valid.

The algorithm loops over the factors, applies this update to each, and recomputes the ELBO until it stops changing. Each full pass climbs the ELBO, so the procedure settles at a local optimum rather than a guaranteed global one. The same complete conditional appears in the Gibbs sampler, but CAVI uses its expected log instead of drawing samples from it.

## Worked example: Bayesian mixture of Gaussians

The model uses K unit-variance Gaussian components whose means have a Gaussian prior with variance sigma squared. Each observation first draws a cluster assignment from a categorical distribution, then draws from the Gaussian of its cluster. The latent variables are the K means and the n cluster assignments, so the mixture is a natural test of the method.

The variational family gives each mean a Gaussian factor with its own mean and variance. Each observation gets a categorical factor over the K clusters, described by its assignment probabilities.

With the family in place, the ELBO follows from the model and the mean-field family. Optimization then adjusts the Gaussian parameters for each component and the categorical parameters for each assignment. The result is a fully specified inference procedure for the mixture.

## Image histograms: CAVI against sampling

The experiment groups images by their color profiles, using histograms of the red, green and blue channels. Each channel histogram has 192 entries, so each image is a 576-dimensional vector regardless of its pixel size. The authors fit a Gaussian mixture with thirty clusters to ten thousand training images and test on ten thousand held-out images.

The baseline is a Hamiltonian Monte Carlo sampler implemented in Stan.

The authors caution that this is not a definitive comparison between VI and MCMC. A collapsed Gibbs sampler may do better than the Hamiltonian Monte Carlo baseline used here. So the result shows a speed gap against one sampler, not a general ranking of the two families.

Convergence is monitored with the average log predictive on a small held-out set instead of the full ELBO. Different random initializations led to different ELBO values, so the optimum found depends on the start. Better local optima give variational densities closer to the exact posterior in KL(q\|\|p).

## Exponential families and stochastic updates

When each complete conditional is in the exponential family, each optimal factor is in the same family. Its natural parameter is set to the expected natural parameter of the complete conditional. This makes CAVI updates easier to derive for many models.

In conditionally conjugate models, the global variables govern all the data and each local variable governs one data point. The local update sets each local parameter from the expectation under the global parameter. The global update then combines the local statistics from all data points with the prior parameters.

CAVI needs a full pass over the data at every iteration, which gets expensive as the data set grows. Stochastic variational inference instead subsamples one data point, computes its local parameters, and moves the global parameters toward a fresh estimate. A step size that decreases over time blends the new estimate into the running global parameters.

The update direction is a natural gradient, which accounts for the geometry of probability parameters. In exponential families it is the ordinary gradient premultiplied by the inverse covariance of the sufficient statistic. This is what makes the stochastic step a valid way to climb the ELBO.

## Limits of the approach

Variational inference doesn't carry the asymptotic exactness guarantees that MCMC provides. It can only find a density close to the target, not the target itself. The gap is harder to judge because statistical theory for variational inference is still thin.

The objective tends to underestimate the posterior variance, which the authors attribute to its form. In the two-dimensional Gaussian example, the mean-field approximation keeps the mean but decouples the covariance and shrinks the marginal variances. Whether that matters depends on the task, and the authors note that the variance may be acceptable in some uses.

The ELBO is generally non-convex, so CAVI only guarantees a local optimum that depends on initialization. Ten random initializations of CAVI for the Gaussian mixture reached different ELBO values, indicating many local optima. Structured and mixture-based families can improve fidelity, but they make the optimization harder.

## Paper info

- **Authors**: David M. Blei, Alp Kucukelbir, Jon D. McAuliffe
- **Venue**: arXiv · Preprint
- **First published**: 2016-1-4
- **Added**: 2026-11-12
- **Updated**: 2018-5-9
- **Version**: v9
- **arXiv**: 1601.00670
- **DOI**: 10.1080/01621459.2017.1285773
- **Category**: stat.CO · cs.LG · stat.ML
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1601.00670v9) · [PDF ↗](https://arxiv.org/pdf/1601.00670v9)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

David M. Blei, Alp Kucukelbir, Jon D. McAuliffe (2016). Variational Inference: A Review for Statisticians. arXiv:1601.00670v9. https://doi.org/10.1080/01621459.2017.1285773

**BibTeX**

```
@article{blei2016variational,
  title = {{Variational Inference: A Review for Statisticians}},
  author = {David M. Blei and Alp Kucukelbir and Jon D. McAuliffe},
  year = {2016},
  eprint = {1601.00670},
  archivePrefix = {arXiv},
  doi = {10.1080/01621459.2017.1285773},
  url = {https://arxiv.org/abs/1601.00670v9}
}
```

## Other paper commentary

- [High-Resolution Image Synthesis and Semantic Manipulation with Conditional GANs](https://refivu.com/en/papers/ad89d7a4-6049-4da7-8901-5fe971c7ff30-high-resolution-image-synthesis-and-semantic-manipulation.md)
- [ESRGAN: Enhanced Super-Resolution Generative Adversarial Networks](https://refivu.com/en/papers/ebad818e-19ed-4df9-8fcf-6d62836fa124-esrgan-enhanced-super-resolution-generative-adversarial.md)
- [Least Squares Generative Adversarial Networks](https://refivu.com/en/papers/de7adb03-4a8a-4e01-93e9-d9d8b2434300-least-squares-generative-adversarial-networks.md)
- [Progressive Growing of GANs for Improved Quality, Stability, and Variation](https://refivu.com/en/papers/8be12dd7-41d4-4ddd-8e8c-ec44b2d70443-progressive-growing-of-gans-for-improved-quality-stability.md)
- [Hierarchical Text-Conditional Image Generation with CLIP Latents](https://refivu.com/en/papers/a54e72c7-9aba-4f0a-b093-9f8704564243-hierarchical-text-conditional-image-generation-with-clip.md)
- [GANs Trained by a Two Time-Scale Update Rule Converge to a Local Nash Equilibrium](https://refivu.com/en/papers/e19fb2a4-2e7f-47ba-9ba7-ba5660b1efb6-gans-trained-by-a-two-time-scale-update.md)
- [Qwen2 Technical Report](https://refivu.com/en/papers/edc7be28-5a87-45ae-afa8-a9b7e9819cd7-qwen2-technical-report.md)
- [OPT: Open Pre-trained Transformer Language Models](https://refivu.com/en/papers/dd696b35-00bf-4198-8591-a1a5b74fa7d4-opt-open-pre-trained-transformer-language-models.md)
- [Efficient Processing of Deep Neural Networks: A Tutorial and Survey](https://refivu.com/en/papers/587cab8c-6795-4edf-94db-5f485a9b553b-efficient-processing-of-deep-neural-networks-a-tutorial.md)
- [Bidirectional LSTM-CRF Models for Sequence Tagging](https://refivu.com/en/papers/7f421939-0d02-43b3-b25f-86a13896fd18-bidirectional-lstm-crf-models-for-sequence-tagging.md)
- [A Random Forest Guided Tour](https://refivu.com/en/papers/6b2074eb-032d-4248-8e6a-fa64485f867d-a-random-forest-guided-tour.md)
- [UNet++: Redesigning Skip Connections to Exploit Multiscale Features in Image Segmentation](https://refivu.com/en/papers/5be5e543-8f10-4ce6-ae1e-1194b9773c52-unet-redesigning-skip-connections-to-exploit-multiscale.md)

## Terms in this paper

- [Kullback-Leibler divergence](https://refivu.com/en/terms/3aa99486ee6b-kullback-leibler-divergence)
- [Markov Chain Monte Carlo](https://refivu.com/en/terms/6fce1ff83248-markov-chain-monte-carlo)
- [variational inference](https://refivu.com/en/terms/44c66cf79542-variational-inference)
- [evidence lower bound](https://refivu.com/en/terms/ab8bf35324c3-evidence-lower-bound)
- [latent Dirichlet allocation](https://refivu.com/en/terms/3605167214fc-latent-dirichlet-allocation)
- [natural gradient](https://refivu.com/en/terms/241750b87e43-natural-gradient)
- [Hamiltonian Monte Carlo](https://refivu.com/en/terms/390634556361-hamiltonian-monte-carlo)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/9499b5e2-6ec4-4fcc-8d8e-4709801c41a4-variational-inference-a-review-for-statisticians)
