# \#advi

**URL:** https://discourse.mc-stan.org/tag/advi/58.md

[Latest](https://discourse.mc-stan.org/latest.md) · [Categories](https://discourse.mc-stan.org/categories.md) · [Tags](https://discourse.mc-stan.org/tags.md)

---

## [New Theoretical analysis for ADVI](https://discourse.mc-stan.org/t/new-theoretical-analysis-for-advi/31529)

<div class="topic-metadata">

**Author:** [@Red-Portal](https://discourse.mc-stan.org/u/Red-Portal)\
**Replies:** 0\
**Last updated:** [May 28, 2023, 6:07am UTC](https://discourse.mc-stan.org/t/new-theoretical-analysis-for-advi/31529 "2023-05-28T06:07:39Z")

</div>

Hi all, We’ve recently uploaded to ArXiv a theoretical analysis for ADVI (although the title says black-box VI), which I believe is the first formal full convergence proof for any black-box VI-type algorithm that uses S…

---

## [Why is HMC faster than ADVI?](https://discourse.mc-stan.org/t/why-is-hmc-faster-than-advi/29964)

<div class="topic-metadata">

**Author:** [@malonzm1](https://discourse.mc-stan.org/u/malonzm1)\
**Replies:** 4\
**Last updated:** [January 8, 2023, 3:50pm UTC](https://discourse.mc-stan.org/t/why-is-hmc-faster-than-advi/29964 "2023-01-08T15:50:12Z")

</div>

Hi, I’m comparing the run times when using ADVI and HMC on the same model. For ADVI, I use variational output\_samples=1000 elbo\_samples=1000 grad\_samples=10 For HMC I use sample num\_samples=250 num\_chains=4 I expect…

---

## [Why is the distribution obtained using advi not close to the normal distribution?](https://discourse.mc-stan.org/t/why-is-the-distribution-obtained-using-advi-not-close-to-the-normal-distribution/27807)

<div class="topic-metadata">

**Author:** [@Madhav\_Kanda](https://discourse.mc-stan.org/u/Madhav_Kanda)\
**Replies:** 1\
**Last updated:** [June 13, 2022, 6:54am UTC](https://discourse.mc-stan.org/t/why-is-the-distribution-obtained-using-advi-not-close-to-the-normal-distribution/27807 "2022-06-13T06:54:44Z")

</div>

I am using advi in stan to plot the posterior distribution. According to the variational inference method, it should be identical to a normal distribution, but the distribution I am getting is not normal. It might be bec…

---

## [How to find the mean and Standard deviation of the curve obtained in Vi](https://discourse.mc-stan.org/t/how-to-find-the-mean-and-standard-deviation-of-the-curve-obtained-in-vi/27804)

<div class="topic-metadata">

**Author:** [@Madhav\_Kanda](https://discourse.mc-stan.org/u/Madhav_Kanda)\
**Replies:** 0\
**Last updated:** [June 12, 2022, 12:11pm UTC](https://discourse.mc-stan.org/t/how-to-find-the-mean-and-standard-deviation-of-the-curve-obtained-in-vi/27804 "2022-06-12T12:11:59Z")

</div>

I am using the variational inference method cmdstanPy. How can I find out the mean and the Standard Deviation of the normal distribution whose KL divergence we minimize to get distribution as close as possible to the pos…

---

## [How to do VI or ADVI in pystan?](https://discourse.mc-stan.org/t/how-to-do-vi-or-advi-in-pystan/27204)

<div class="topic-metadata">

**Author:** [@patel-zeel](https://discourse.mc-stan.org/u/patel-zeel)\
**Replies:** 1\
**Last updated:** [April 20, 2022, 7:43am UTC](https://discourse.mc-stan.org/t/how-to-do-vi-or-advi-in-pystan/27204 "2022-04-20T07:43:14Z")

</div>

How to do Variational Inference (VI) or Automatic Differentiation Variational Inference (ADVI) with pystan? I would greatly appreciate a simple code example.

---

## [ADVI: Too many dropped evaluations even for well behaved models](https://discourse.mc-stan.org/t/advi-too-many-dropped-evaluations-even-for-well-behaved-models/24338)

<div class="topic-metadata">

**Author:** [@martinmodrak](https://discourse.mc-stan.org/u/martinmodrak)\
**Replies:** 7\
**Last updated:** [October 15, 2021, 12:56pm UTC](https://discourse.mc-stan.org/t/advi-too-many-dropped-evaluations-even-for-well-behaved-models/24338 "2021-10-15T12:56:20Z")

</div>

The current ADVI implementation can sometimes (stochastically) fail to fit even the simplest models. I think this might indicate that some defaults for algorithm parameters are suspicious. Context: I am helping @hyunji.…

---

## [Variational inference in Rstan with errors](https://discourse.mc-stan.org/t/variational-inference-in-rstan-with-errors/22937)

<div class="topic-metadata">

**Author:** [@mary](https://discourse.mc-stan.org/u/mary)\
**Replies:** 1\
**Last updated:** [June 14, 2021, 10:09am UTC](https://discourse.mc-stan.org/t/variational-inference-in-rstan-with-errors/22937 "2021-06-14T10:09:35Z")

</div>

Hello Guys, I am a very newer here, I have trie to build my own variational inference algorithm in pure R without any package help, however my parameters were very strange at the end of iterations and I had to change. …

---

## [Stan gradient w.r.t ? in advi code](https://discourse.mc-stan.org/t/stan-gradient-w-r-t-in-advi-code/19938)

<div class="topic-metadata">

**Author:** [@hyunji.moon](https://discourse.mc-stan.org/u/hyunji.moon)\
**Replies:** 2\
**Last updated:** [December 24, 2020, 7:52pm UTC](https://discourse.mc-stan.org/t/stan-gradient-w-r-t-in-advi-code/19938 "2020-12-24T19:52:02Z")

</div>

tl;dr what is the result of stan::model::gradient(m, zeta, tmp\_lp, tmp\_mu\_grad, &ss);? \\zeta value plugged in to \\nabla\_{\\theta} \\log p(\\mathbf{X}, \\theta) OR \\nabla\_{\\zeta} \\log g(\\mathbf{X}, \\zeta)? – It seems thi…

---

## [Chatzilena et al. Contemporary statistical inference for infectious disease models using Stan](https://discourse.mc-stan.org/t/chatzilena-et-al-contemporary-statistical-inference-for-infectious-disease-models-using-stan/8272)

<div class="topic-metadata">

**Author:** [@Bob\_Carpenter](https://discourse.mc-stan.org/u/Bob_Carpenter)\
**Replies:** 1\
**Last updated:** [April 4, 2019, 8:06am UTC](https://discourse.mc-stan.org/t/chatzilena-et-al-contemporary-statistical-inference-for-infectious-disease-models-using-stan/8272 "2019-04-04T08:06:13Z")

</div>

Everyone’s telling me about this paper (arXiv, Jon Zelner, the authors). In addition to the epidemiology content, it’s a very careful study of ODE models being fit with MCMC and with ADVI. Chatzilena, A., van Leeuwen,…
