The Mean-Field Approximation
When an exact posterior distribution is too complicated to compute, the mean-field approximation replaces it with the simplest possible stand-in — one that treats every variable as independent of every other — and then optimizes that simple stand-in to fit the true posterior as closely as an independence assumption allows.
Prerequisites: Variational Inference, The Evidence Lower Bound
Exact Bayesian posteriors for realistic models are usually a tangled, high-dimensional mess with no closed form, and sampling from them with MCMC can be slow. Variational inference takes a different approach entirely: pick a family of simple, tractable distributions, and search within that family for the member that best approximates the true posterior. The mean-field approximation is the simplest, most common choice of family — it assumes every variable is independent of every other, turning one impossibly complex joint posterior into a product of separate, manageable pieces that can each be optimized on their own.
The analogy: describing a crowd by describing each person alone
Imagine trying to precisely describe how a large crowd of people move together — every subtle correlation, every person nudging their neighbor, every group moving in loose coordination. That joint description is enormously complex. The mean-field approximation is like giving up on capturing any of those correlations, and instead describing each person's movement completely independently, as if no one in the crowd were influenced by anyone else at all. It is obviously a simplification — real crowds do have correlated motion — but it is vastly easier to write down, and if the correlations are weak enough (or if you only need marginal behavior, not joint behavior), it can still be a genuinely useful approximation.
The formula: factorizing the posterior by assumption
The mean-field family assumes the approximate posterior over all latent variables factorizes completely:
In words: instead of allowing 's distribution to depend on what value took (or any other variable), the approximation treats every variable as having its own separate, independent distribution , and the joint approximate posterior is just the product of these independent pieces. Fitting the approximation means choosing each to make the whole product as close as possible to the true posterior , measured by KL divergence — and it turns out (via the calculus of variations) that the optimal , holding all the others fixed, has a clean closed form:
In words: the best distribution for variable , given everything else's current approximation, is proportional to the expected log joint probability, averaged over all the other variables' current distributions — each is updated one at a time, using the current guesses for everyone else, in a loop called coordinate ascent variational inference (CAVI).
Worked example 1: a two-variable toy model by hand
Take two variables, (a mean) and (a precision, i.e. inverse variance), jointly governing observed data, where the true posterior has and genuinely correlated (as is typical when both are unknown simultaneously). The mean-field approximation forces — no correlation allowed at all. Suppose CAVI converges to and (mean ). These marginal shapes can be quite accurate individually — the mean-field posterior's mean for might land within a few percent of the true posterior's mean for . What is lost entirely is the relationship between them: the true posterior might show that when is unusually large, tends to be unusually small too — that joint tendency simply cannot be represented once you have committed to and being independent by construction.
Worked example 2: underestimating uncertainty
Suppose the true joint posterior variance of , accounting for its correlation with , is , but because the correlation happens to work in a variance-reducing direction once is marginalized out incorrectly, the mean-field fit converges to a narrower , variance . This is a well-known systematic tendency of mean-field approximations: because cannot represent the correlation structure that would otherwise let uncertainty in one variable "borrow" width from uncertainty in another, mean-field posteriors are frequently overconfident — reporting tighter credible intervals than the truth warrants. A risk model built on this approximation might report a 90% credible interval of roughly when the true interval, accounting for correlation, is closer to — a real, quantifiable understatement of genuine uncertainty.
Each factor in a mean-field approximation is a simple distribution like the one above, fit on its own — the whole approximation is just several such curves multiplied together, with no mechanism to represent any curve leaning on another.
The mean-field approximation replaces an intractable joint posterior with a product of independent factors, one per variable, and optimizes each factor to fit as closely as an independence assumption allows — a fast, tractable approximation that systematically underestimates uncertainty whenever the true posterior has real correlations between variables.
What this means in practice
Mean-field variational inference is used wherever exact or MCMC-based posteriors are too slow — large-scale topic models, big hierarchical models with thousands of groups, or any setting needing repeated, fast posterior updates (like real-time model retraining). Because it tends to underestimate posterior uncertainty and can also settle on a single mode when the true posterior is multi-modal, it should be treated as a fast approximation to check against, not an automatic substitute for MCMC when calibrated uncertainty genuinely matters — for instance, in a risk model where understating tail uncertainty has direct financial consequences.
Practice
- Explain in one sentence why forcing cannot represent a true posterior where and are correlated.
- If two variables in a model are known to be nearly uncorrelated in the true posterior, would you expect mean-field to perform well or poorly? Why?
- Name one financial modeling context where understating posterior uncertainty (as mean-field tends to do) would be especially costly.
The common confusion is treating a mean-field variational posterior's reported uncertainty (credible intervals, standard deviations) as directly trustworthy, the same way you would trust an MCMC-based posterior. Mean-field's factorized form is a genuine approximation whose main known failure mode is systematically underestimating uncertainty and mode-collapsing on multi-modal posteriors — its point estimates (means, modes) are often reasonably accurate, but its uncertainty estimates need independent validation before being used for anything risk-sensitive.
Related concepts
Practice in interviews
Further reading
- Blei, Kucukelbir & McAuliffe, Variational Inference: A Review for Statisticians (2017)
- Bishop, Pattern Recognition and Machine Learning (2006), ch. 10