arXiv(opens in a new tab)MathematicsJan 2016Cited by 4 papers on PaperVantage

Manuscript Offprint

arXiv:1601.00670

Variational Inference: A Review for Statisticians

D. Blei, A. Kucukelbir, Jon D. McAuliffe

Abstract

One of the core problems of modern statistics is to approximate difficult-to-compute probability densities. This problem is especially important in Bayesian statistics, which frames all inference about unknown quantities as a calculation involving the posterior density. In this paper, we review variational inference (vi), a method from machine learning that approximates probability densities through optimization. vi has been used in many applications and tends to be faster than classical methods, such as Markov chain Monte Carlo sampling. The idea behind vi is to first posit a family of densities and then to find the member of that family which is close to the target. Closeness is measured by Kullback-Leibler divergence. We review the ideas behind mean-field variational inference, discuss the special case of vi applied to exponential family models, present a full example with a Bayesian mixture of Gaussians, and derive a variant that uses stochastic optimization to scale up to massive data. We discuss modern research in vi and highlight important open problems. vi is powerful, but it is not yet well understood. Our hope in writing this paper is to catalyze statistical research on this class of algorithms.

Keywords: Algorithms; Statistical Computing; Computationally Intensive Methods.

1 Introduction

One of the core problems of modern statistics is to approximate difficult-to-compute probability densities. This problem is especially important in Bayesian statistics, which frames all inference about unknown quantities as a calculation about the posterior. Modern Bayesian statistics relies on models for which the posterior is not easy to compute and corresponding algorithms for approximating them.

In this paper, we review variational inference (vi), a method from machine learning for approximating probability densities (Jordan et al., 1999; Wainwright and Jordan, 2008). Variational inference is widely used to approximate posterior densities for Bayesian models, an alternative strategy to Markov chain Monte Carlo (mcmc) sampling. Compared to mcmc, variational inference tends to be faster and easier to scale to large data—it has been applied to problems such as large-scale document analysis, computational neuroscience, and computer vision. But variational inference has been studied less rigorously than mcmc, and its statistical properties are less well understood. In writing this paper, our hope is to catalyze statistical research on variational inference.

First, we set up the general problem. Consider a joint density of latent variables z=z1:m\mathbf{z}=z_{1:m} and observations x=x1:n\mathbf{x}=x_{1:n},

p(z,x)=p(z)p(x ∣ z).\displaystyle p(\mathbf{z},\mathbf{x})=p(\mathbf{z})p(\mathbf{x}\,|\,\mathbf{z}).

In Bayesian models, the latent variables help govern the distribution of the data. A Bayesian model draws the latent variables from a prior density p(z)p(\mathbf{z}) and then relates them to the observations through the likelihood p(x ∣ z)p(\mathbf{x}\,|\,\mathbf{z}). Inference in a Bayesian model amounts to conditioning on data and computing the posterior p(z ∣ x)p(\mathbf{z}\,|\,\mathbf{x}). In complex Bayesian models, this computation often requires approximate inference.

For decades, the dominant paradigm for approximate inference has been mcmc (Hastings, 1970; Gelfand and Smith, 1990). In mcmc, we first construct an ergodic Markov chain on z\mathbf{z} whose stationary distribution is the posterior p(z ∣ x)p(\mathbf{z}\,|\,\mathbf{x}). Then, we sample from the chain to collect samples from the stationary distribution. Finally, we approximate the posterior with an empirical estimate constructed from (a subset of) the collected samples.

mcmc sampling has evolved into an indispensable tool to the modern Bayesian statistician. Landmark developments include the Metropolis-Hastings algorithm (Metropolis et al., 1953; Hastings, 1970), the Gibbs sampler (Geman and Geman, 1984) and its application to Bayesian statistics (Gelfand and Smith, 1990). mcmc algorithms are under active investigation. They have been widely studied, extended, and applied; see Robert and Casella (2004) for a perspective.

However, there are problems for which we cannot easily use this approach. These arise particularly when we need an approximate conditional faster than a simple mcmc algorithm can produce, such as when data sets are large or models are very complex. In these settings, variational inference provides a good alternative approach to approximate Bayesian inference.

Rather than use sampling, the main idea behind variational inference is to use optimization. First, we posit a family of approximate densities Q\mathcal{Q}. This is a set of densities over the latent variables. Then, we try to find the member of that family that minimizes the Kullback-Leibler (kl) divergence to the exact posterior,

q∗(z)=arg min⁡q(z)∈Q\textsckl(q(z)∥p(z ∣ x)).\displaystyle q^{*}(\mathbf{z})=\argmin_{q(\mathbf{z})\in\mathcal{Q}}\textsc{kl}\left(q(\mathbf{z})\|p(\mathbf{z}\,|\,\mathbf{x})\right).

Finally, we approximate the posterior with the optimized member of the family q∗(⋅)q^{*}(\cdot).

Variational inference thus turns the inference problem into an optimization problem, and the reach of the family Q\mathcal{Q} manages the complexity of this optimization. One of the key ideas behind variational inference is to choose Q\mathcal{Q} to be flexible enough to capture a density close to p(z ∣ x)p(\mathbf{z}\,|\,\mathbf{x}), but simple enough for efficient optimization.

We emphasize that mcmc and variational inference are different approaches to solving the same problem. mcmc algorithms sample a Markov chain; variational algorithms solve an optimization problem. mcmc algorithms approximate the posterior with samples from the chain; variational algorithms approximate the posterior with the result of the optimization.

Comparing variational inference and mcmc. When should a statistician use mcmc and when should she use variational inference? We will offer some guidance. mcmc methods tend to be more computationally intensive than variational inference but they also provide guarantees of producing (asymptotically) exact samples from the target density (Robert and Casella, 2004). Variational inference does not enjoy such guarantees—it can only find a density close to the target—but tends to be faster than mcmc. Because it rests on optimization, variational inference easily takes advantage of methods like stochastic optimization (Robbins and Monro, 1951; Kushner and Yin, 1997) and distributed optimization (though some mcmc methods can also exploit these innovations (Welling and Teh, 2011; Ahmed et al., 2012)).

Thus, variational inference is suited to large data sets and scenarios where we want to quickly explore many models; mcmc is suited to smaller data sets and scenarios where we happily pay a heavier computational cost for more precise samples. For example, we might use mcmc in a setting where we spent 20 years collecting a small but expensive data set, where we are confident that our model is appropriate, and where we require precise inferences. We might use variational inference when fitting a probabilistic model of text to one billion text documents and where the inferences will be used to serve search results to a large population of users. In this scenario, we can use distributed computation and stochastic optimization to scale and speed up inference, and we can easily explore many different models of the data.

Data set size is not the only consideration. Another factor is the geometry of the posterior distribution. For example, the posterior of a mixture model admits multiple modes, each corresponding label permutations of the components. Gibbs sampling, if the model permits, is a powerful approach to sampling from such target distributions; it quickly focuses on one of the modes. For mixture models where Gibbs sampling is not an option, variational inference may perform better than a more general mcmc technique (e.g., Hamiltonian Monte Carlo), even for small datasets (Kucukelbir et al., 2015). Exploring the interplay between model complexity and inference (and between variational inference and mcmc) is an exciting avenue for future research (see Section 5.4).

The relative accuracy of variational inference and mcmc is still unknown. We do know that variational inference generally underestimates the variance of the posterior density; this is a consequence of its objective function. But, depending on the task at hand, underestimating the variance may be acceptable. Several lines of empirical research have shown that variational inference does not necessarily suffer in accuracy, e.g., in terms of posterior predictive densities (Blei and Jordan, 2006; Braun and McAuliffe, 2010; Kucukelbir et al., 2016); other research focuses on where variational inference falls short, especially around the posterior variance, and tries to more closely match the inferences made by mcmc (Giordano et al., 2015). In general, a statistical theory and understanding around variational inference is an important open area of research (see Section 5.2). We can envision future results that outline which classes of models are particularly suited to each algorithm and perhaps even theory that bounds their accuracy. More broadly, variational inference is a valuable tool, alongside mcmc, in the statistician’s toolbox.

It might appear to the reader that variational inference is only relevant to Bayesian analysis. Indeed, both variational inference and mcmc have had a significant impact on applied Bayesian computation and we will be focusing on Bayesian models here. We emphasize, however, that these techniques also apply more generally to computation about intractable densities. mcmc is a tool for simulating from densities and variational inference is a tool for approximating densities. One need not be a Bayesian to have use for variational inference.

Research on variational inference. The development of variational techniques for Bayesian inference followed two parallel, yet separate, tracks. Peterson and Anderson (1987) is arguably the first variational procedure for a particular model: a neural network. This paper, along with insights from statistical mechanics (Parisi, 1988), led to a flurry of variational inference procedures for a wide class of models (Saul et al., 1996; Jaakkola and Jordan, 1996; Jaakkola and Jordan, 1997; Ghahramani and Jordan, 1997; Jordan et al., 1999). In parallel, Hinton and Van Camp (1993) proposed a variational algorithm for a similar neural network model. Neal and Hinton (1999) (first published in 1993) made important connections to the expectation maximization (em) algorithm (Dempster et al., 1977), which then led to a variety of variational inference algorithms for other types of models (Waterhouse et al., 1996; MacKay, 1997).

Modern research on variational inference focuses on several aspects: tackling Bayesian inference problems that involve massive data; using improved optimization methods for solving Equation (1) (which is usually subject to local minima); developing generic variational inference, algorithms that are easy to apply to a wide class of models; and increasing the accuracy of variational inference, e.g., by stretching the boundaries of Q\mathcal{Q} while managing complexity in optimization.

Organization of this paper. Section 2 describes the basic ideas behind the simplest approach to variational inference: mean-field inference and coordinate-ascent optimization. Section 3 works out the details for a Bayesian mixture of Gaussians, an example model familiar to many readers. Sections 4.1 and 4.2 describe variational inference for the class of models where the joint density of the latent and observed variables are in the exponential family—this includes many intractable models from modern Bayesian statistics and reveals deep connections between variational inference and the Gibbs sampler of Gelfand and Smith (1990). Section 4.3 expands on this algorithm to describe stochastic variational inference (Hoffman et al., 2013), which scales variational inference to massive data using stochastic optimization (Robbins and Monro, 1951). Finally, with these foundations in place, Section 5 gives a perspective on the field—applications in the research literature, a survey of theoretical results, and an overview of some open problems.

References (100)

  • Scalable inference in latent variable models
  • Mixed membership stochastic blockmodels
  • Differential geometry of curved exponential families-curvatures and information loss
  • Natural gradient works efficiently in learning
  • Gaussian process approximations of stochastic differential equations
  • Variational inference for diffusion processes
  • Generalized beta mixtures of Gaussians
  • and Dunson, D
  • Bayesian Reasoning and Machine Learning
  • and Chiappa, S
  • and de van Laar, P
  • and Wiegerinck, W
  • and Ghahramani, Z
  • and Smith, A
  • Asymptotic normality of maximum likelihood and its variational approximation for stochastic blockmodels
  • Pattern Recognition and Machine Learning
  • and Winn, J
  • Probabilistic topic models
  • and Lafferty, J
  • and McAuliffe, J
  • Fundamentals of Statistical Exponential Families
  • Laplace variational approximation for semiparametric regression in the presence of heteroscedastic errors
  • and Stephens, M
  • Consistency of maximum-likelihood and variational estimators in the stochastic block model
  • and Barber, D
  • and Vasconcelos, N
  • and Smith, N
  • and Newman, P
  • Variational Gaussian process dynamical systems
  • VBA: A probabilistic treatment of nonlinear models for neurobiological and behavioural data
  • Maximum likelihood from incomplete data via the EM algorithm
  • Switching dynamic system models for speech articulation and acoustics
  • Conjugate priors for exponential families
  • Variational Bayesian inference for linear and logistic regression (opens arXiv in a new tab)
  • A Bayesian model for simultaneous image clustering, annotation and object segmentation
  • and Bouchard, G
  • E., and Joutard, C
  • and Penny, W
  • Stochastic variational inference for hidden Markov models
  • D., Højen-Sørensen, P., Jordan, M., and Russell, S
  • and Geman, D
  • An introduction to Bayesian inference via variational approximations
  • Theory of Gaussian variational approximation for a Poisson mixed model
  • Asymptotic normality and valid inference for Gaussian variational approximation
  • and Green, G
  • Monte Carlo sampling methods using Markov chains and their applications
  • Gaussian processes for big data
  • Fast variational inference in the conjugate exponential family
  • and Van Camp, D
  • D., Blei, D., Wang, C., and Paisley, J
  • and Gelman, A
  • Natural conjugate gradient in variational inference
  • Bounded approximations for marginal likelihoods
  • and Willsky, A
  • and Frey, B
  • Efficient approximations for learning phylogenetic HMM models from data
  • I., Ghahramani, Z., Jaakkola, T., and Saul, L
  • Variational Bayesian inversion of the equivalent current dipole model in EEG/MEG
  • and Welling, M
  • and Minka, T
  • Automatic variational inference in Stan
  • Kucukelbir, A., Tran, D., Ranganath, R., Gelman, A., and Blei, D. M. (2016). Automatic differentiation variational inference. arXiv preprint arXiv:1603.00788. (opens arXiv in a new tab)
  • and Leibler, R
  • and Sato, T
  • and Yin, G
  • Search for patterns of functional specificity in the brain: A nonparametric hierarchical Bayesian model for group fMRI data
  • and Spiegelhalter, D
  • and Bottou, L
  • and Kappen, H
  • I., and Klein, D
  • and Galatsanos, N
  • A variational Bayes algorithm for fast and accurate multiple locus genome-wide association analysis
  • Equations of state calculations by fast computing machines
  • Sparse stochastic inference for latent Dirichlet allocation
  • Divergence measures and message passing
  • Infer.NET 2.6
  • Using universal linguistic knowledge to guide grammar induction
  • A variational Bayes spatiotemporal model for electromagnetic brain mapping
  • and Hinton, G
  • Mean field variational Bayes for continuous sparse signal shrinkage: pitfalls and remedies
  • L., Villani, M., and Kohn, R
  • and Winther, O
  • A variational Bayes approach to variable selection
  • Statistical Field Theory
  • Probabilistic Reasoning in Intelligent Systems: Networks of Plausible Inference
  • Variational Bayesian inference for fMRI time series
  • Bayesian fMRI time series analysis with spatial priors
  • and Anderson, J
  • fastSTRUCTURE: Variational inference of population structure in large SNP data sets
  • A Bayesian approach for place recognition
  • Black box variational inference
  • Hierarchical variational models
  • Celeste: Variational inference for a generative model of astronomical images
  • Multiband audio modeling for single-channel acoustic source separation
  • J., Mohamed, S., and Wierstra, D
  • and Monro, S
  • and Casella, G
  • Positional entropy during pigeon homing I: Application of Bayesian latent state modelling
  • and Wand, M
  • Markov chain Monte Carlo and variational inference: Bridging the gap

Couldn't load all references. Reload the page to try again.