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.

  • $\begingroup$ Clicking the link (to the paper) gives error 404. Can you re-upload it? $\endgroup$
    – tail
    Commented Apr 20, 2023 at 15:12
  • $\begingroup$ I have updated the link to the paper. $\endgroup$
    – kedarps
    Commented Apr 20, 2023 at 19:14

1 Answer 1


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.

  • 1
    $\begingroup$ I think Stan is the fastest software to do MCMC (NUTS). What's the fastest (or more powerful) to do Variational Inference? $\endgroup$
    – skan
    Commented Nov 22, 2018 at 20:45
  • 3
    $\begingroup$ @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.) $\endgroup$ Commented Nov 24, 2018 at 13:02
  • 2
    $\begingroup$ Stan also support VI. The only limitation of stan is that it can't sample discrete variables. $\endgroup$
    – RJTK
    Commented Feb 28, 2019 at 19:41
  • 3
    $\begingroup$ Also, I don't believe Stan runs ADVI on GPU... yet anyway. The fastest software for variational inference is likely TensorFlow Probability (TFP) or Pyro, both built on highly optimized deep learning frameworks (i.e., CUDA). TFP grew out of early work on Edward by Dustin Tran, who now leads TFP at Google I believe. $\endgroup$ Commented Sep 5, 2019 at 15:29
  • 1
    $\begingroup$ Just happened to stumble across this discussion and I'd like to make a small correction for posterity. I started TFP in 2016 with Ian Langmore and Eugene Brevdo approximately a year before Dustin's involvement. Dustin's main contribution was to help write the paper, arxiv.org/abs/1711.10604 and to promote TFP via Edward building on top of it. Both Dustin and I now work on different projects at Google. $\endgroup$
    – jvdillon
    Commented Dec 10, 2021 at 21:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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