I think I get the general idea of both VI and MCMC including the various flavors of MCMC like Gibbs sampling, Metropolis Hastings etc. This paper provides a wonderful exposition of both methods.

I have the following questions:

  • If I wish to do Bayesian inference, why would I choose one method over the other?
  • What are the pros and cons of each of the methods?

I understand that this is a pretty broad question, but any insights would be highly appreciated.

up vote 23 down vote accepted

For a long answer, see Blei, Kucukelbir and McAuliffe here. This short answer draws heavily therefrom.

  • MCMC is asymptotically exact; VI is not. In the limit, MCMC will exactly approximate the target distribution. VI comes without warranty.
  • MCMC is computationally expensive. In general, VI is faster.

Meaning, when we have computational time to kill and value precision of our estimates, MCMC wins. If we can tolerate sacrificing that for expediency—or we're working with data so large we have to make the tradeoff—VI is a natural choice.

Or, as more eloquently and thoroughly described by the authors mentioned above:

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.

  • I think Stan is the fastest software to do MCMC (NUTS). What's the fastest (or more powerful) to do Variational Inference? – skan Nov 22 at 20:45
  • 1
    @skan Wonderful question! The closest I've seen to a general-purpose VI software is edward, though I haven't used it myself. (Many applications of VI are custom, in that they derive an algorithm to fit the specific model of interest.) – Sean Easter Nov 24 at 13:02

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.