Every time a machine learning model updates its beliefs from data, it faces a hidden problem: computing the posterior distribution. In principle, Bayes' theorem tells you exactly how to do it — multiply the prior by the likelihood and normalize. In practice, that normalization requires integrating over every possible setting of the model's parameters, and for any realistic model that integral is computationally intractable.
The naive answer is to sample from the posterior using Markov Chain Monte Carlo (MCMC). MCMC is exact in the limit, but it is also slow — it can take millions of steps to explore a high-dimensional space well enough to trust the result.
Variational inference (VI) takes a different route: instead of sampling, it optimizes. Pick a family of simple, tractable distributions — Gaussians, for instance. Find the member of that family that is closest to the true posterior, where "closest" is measured by KL divergence. The impossible integral becomes a loss function, and modern gradient descent can minimize it efficiently.
The tradeoff is honesty. Variational inference is fast but approximate: it finds the best simple distribution, not the true one. Understanding that tradeoff — and what "best" even means — is the heart of modern approximate Bayesian inference.
Comments
Loading comments...