In mean-field variational inference, with q(z)=∏jqj(zj), show that the optimal factor satisfies ln⁡qj∗(zj)=Ei≠j[ln⁡p(x,z)]+const. How is this used as an algorithm?

Probabilistic models, Variational inference
Level L4 Advanced. Length Long. Nature Mat Mathematical.

What's being asked

Whether you can derive the coordinate-ascent update by isolating one factor in the ELBO and recognising a KL divergence.

Key idea

Fix all factors except qj. The ELBO becomes −KL(qj ∥ q~j)+const, where ln⁡q~j=Ei≠j[ln⁡p(x,z)]+const. It is maximised when qj=q~j.

Steps

  1. Start from the ELBO L(q)=Eq[ln⁡p(x,z)]−Eq[ln⁡q(z)] with q=∏iqi.
  2. The entropy term splits: −Eq[ln⁡q]=−∑iEqi[ln⁡qi]. Keep only the terms with qj and absorb the rest into a constant.
  3. The first term is ∫qj(zj) Ei≠j[ln⁡p(x,z)] dzj. Define the new density q~j(zj)∝exp⁡(Ei≠j[ln⁡p(x,z)]).
  4. Then L=∫qjln⁡q~j dzj−∫qjln⁡qj dzj+const=−KL(qj ∥ q~j)+const.
  5. The KL divergence is non-negative and equals 0 only at qj=q~j. So qj∗(zj)∝exp⁡(Ei≠j[ln⁡p(x,z)]).
  6. Algorithm (CAVI): initialise all qi. Cycle through j, recomputing qj∗ using the current other factors. Each update cannot decrease the ELBO, so it converges, but only to a local optimum because the ELBO is not concave in general.
  7. For conjugate-exponential models the expectation is easy: the update stays in the same family and only changes its parameters.

Common mistakes

How long your answer should be

A page. About 7 minutes.

Last checked on 4 December 2026.

Read this

Previous in Probabilistic models: How does the Metropolis–Hastings acceptance probability follow from detailed balance, and why is Gibbs sampling a special case whose proposals are always accepted?
Next in Probabilistic models: For Bayesian linear regression with prior w∼N(0,α−1I) and noise precision β, derive the log evidence ln⁡p(t∣α,β). Which terms reward fit, and which penalise complexity?