- Introduced by
- Thomas P. Minka
- Year
- 2001
- Type
- Approximate inference algorithm
What does it do?
Expectation Propagation (EP) is a deterministic message-passing algorithm for approximate posterior inference in Bayesian models, introduced by Thomas P. Minka at UAI 2001.
It approximates the true posterior as a product of local factors, each drawn from the exponential family, and refines them one at a time so that the global product matches the intractable posterior. In many models this moment-matching scheme gives marginal variances closer to the true posterior than mean-field variational inference does, though this depends on the model.
The intuition behind the method
Think of the true posterior as a product of many simple pieces, one per likelihood term or prior. EP keeps a Gaussian-type (exponential-family) approximation for each piece and updates them in turn. To update piece i, it first removes that piece's current contribution from the global approximation, leaving a 'cavity' distribution that carries the information from all other pieces. It then combines the cavity with the exact piece and finds the exponential-family distribution that matches the mean and variance of that combination. The result becomes the new approximate piece. Repeating this over all pieces until the approximations stop changing gives a global approximation that tracks the posterior's correlations, which a fully factorised mean-field approximation does not.
History
Thomas P. Minka introduced Expectation Propagation at UAI 2001, presenting it as a framework that unifies assumed-density filtering (ADF) and loopy belief propagation (LBP), both of which use local KL projections. EP makes this shared structure explicit as an iterative procedure over factors. The framework was later extended to fractional-exponent variants, often called power EP, which are discussed in the literature on the method. EP is covered in Bishop's 2006 textbook, which helped make it a standard tool in probabilistic machine learning.
When to use it
Use EP when the posterior is analytically intractable, the likelihood terms are not conjugate to the prior, and you need a more faithful approximation than mean-field variational inference gives, particularly when posterior correlations matter. Typical cases are probit or logistic regression, Gaussian process classification, and regression with Student-t likelihoods, provided the moment integrals of the tilted distributions can be evaluated in closed form or by low-dimensional quadrature. EP is deterministic, so repeated runs from the same settings return the same answer, which is an advantage over sampling methods. Do not use EP when the posterior is genuinely multimodal, because a single exponential-family factor cannot represent several modes. Also avoid it when the moment integrals are unavailable or very high-dimensional, since the updates then become impractical or inaccurate, and MCMC may be the safer choice.
Limitations and considerations
- Convergence is not guaranteed. EP can oscillate or fail to converge, and the risk is higher for models whose posteriors are strongly multimodal or heavy-tailed.
- The method requires the moments of each tilted distribution to be computable, either analytically or by low-dimensional numerical quadrature. This restricts which likelihoods can be used.
- The exponential-family constraint makes the approximation unimodal (Gaussian in the common case), so EP cannot represent several separate posterior modes.
- Results can depend on the order in which factors are updated and on the initialisation of the approximate factors, so the sensitivity should be checked in practice.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Each update matches the moments of the tilted distribution rather than minimising the reverse KL used by mean-field variational inference. In many models this tends to give marginal variances that are less understated than those from mean-field, although the size of the difference depends on the model.
- Updates are local: each factor is refreshed using only its own tilted distribution and the cavity, so a new likelihood term can be added by introducing one more approximate factor.
- EP yields an approximate marginal likelihood (model evidence) as a by-product of its updates, which supports Bayesian model comparison without a separate estimator. Computing it requires the full EP free-energy expression in Minka (2001), not the per-factor normalisation constants alone.
- The procedure is deterministic, so it avoids the Monte Carlo variability that comes with sampling-based inference.
Applications
- Gaussian process classification with non-Gaussian likelihoods, where EP is a standard approximate inference choice.
- Probit and logistic regression in a Bayesian setting, giving approximate posterior uncertainty over the weights.
- Robust regression with Student-t or other heavy-tailed likelihoods, where mean-field inference can understate posterior uncertainty and EP's moment integrals can often be evaluated by quadrature.
How it works
How it works
The posterior is written as a product of factors f_i(x), each encoding one observation likelihood or prior term. This product is generally intractable to work with directly, so EP does not use it in its exact form during the iterations.
Formula
p(\mathbf{x} \mid \mathcal{D}) \propto \prod_{i} f_i(\mathbf{x})The global approximation q(x) is a normalised product of local approximate factors f̃_i(x). Because the exponential family is closed under multiplication, q stays in the same family throughout (for example, Gaussian when the factors are Gaussian), which keeps each update analytically manageable.
Formula
q(\mathbf{x}) = \frac{1}{Z} \prod_{i} \tilde{f}_i(\mathbf{x}), \quad \tilde{f}_i \in \text{exponential family}Before updating factor i, EP divides q by the current f̃_i to remove that factor's contribution. The resulting cavity distribution q^{\setminus i}(x) represents the approximation built from all other factors.
Formula
q^{\setminus i}(\mathbf{x}) = \frac{q(\mathbf{x})}{\tilde{f}_i(\mathbf{x})}EP chooses q^{new} within the exponential family so that KL(f_i q^{\setminus i} || q) is minimised. This is the 'tilted' distribution formed by the exact factor and the cavity. For exponential-family approximations, this KL minimisation reduces to matching the sufficient statistics, which for a Gaussian means matching the mean and variance.
Formula
q^{\text{new}}(\mathbf{x}) = \operatorname*{arg\,min}_{q \in \mathcal{Q}} \mathrm{KL}\!\left(f_i(\mathbf{x})\,q^{\setminus i}(\mathbf{x}) \,\Big\|\, q(\mathbf{x})\right)The new approximate factor is obtained by dividing the updated global approximation by the cavity, f̃_i^{new} = Z_i q^{new} / q^{\setminus i}, where Z_i is the normalisation constant of the tilted distribution. The new factor replaces the old one in the product. The Z_i values are local quantities and are not by themselves the model evidence, which requires a separate calculation (see the faq on the marginal likelihood).
Formula
\tilde{f}_i^{\text{new}}(\mathbf{x}) = Z_i \,\frac{q^{\text{new}}(\mathbf{x})}{q^{\setminus i}(\mathbf{x})}The cycle of cavity computation, moment matching and factor update is repeated over all factors until the approximate factor parameters stop changing within a chosen tolerance. Convergence is not guaranteed for general models: the iterations can oscillate, or produce invalid parameters such as negative variances. Convergence is therefore checked in practice rather than assumed, and damped updates are a common remedy.
Common pitfalls
- Assuming convergence without checking. Run until changes in the approximate factor parameters fall below a tolerance, and treat invalid parameters such as negative variances as a failed run rather than a result.
- Reading a unimodal EP approximation as if it summarised all posterior modes. EP captures one mode and its local width, and this should be stated when reporting results on multimodal problems.
- Using the sum of the per-factor normalisation constants Z_i as the approximate log marginal likelihood. The evidence requires the full EP free-energy expression in Minka (2001), so this shortcut can give a wrong value.
- Confusing EP with mean-field variational inference. The two methods minimise KL divergences in opposite directions, so they optimise different objectives and can give noticeably different marginal variances.
Frequently asked questions
How does EP differ from mean-field variational inference?
Mean-field VI assumes the latent variables are mutually independent in the approximation and minimises KL(q || p). This objective tends to make the approximation too concentrated, understating the posterior's spread and ignoring correlations. EP instead minimises KL(f_i q^{\setminus i} || q) for each factor, which matches moments. In many models of this type this gives marginal variances closer to those of the true posterior, although the size of the improvement depends on the model. EP is harder to implement and does not come with a convergence guarantee.
Is EP guaranteed to converge?
No. Mean-field VI maximises a global evidence lower bound by coordinate updates and so converges to a local optimum of that bound. EP has no equivalent global objective that its updates are guaranteed to decrease, so it can oscillate or produce invalid parameters such as negative variances. Damped updates and careful monitoring of the factor parameters are the usual ways to manage convergence in practice. Power EP, which uses a fractional exponent on the approximate factors, is a separate generalisation and should not be confused with damping.
What does EP give me besides the approximate posterior?
EP also yields an approximate marginal likelihood p(data), the model evidence used in Bayesian model selection and hyperparameter tuning. Its computation requires the full EP free-energy expression given by Minka (2001), not the per-factor normalisation constants Z_i alone. This is a practical advantage, because MCMC does not directly return the evidence and typically requires an additional estimator for it.
When should I prefer MCMC over EP?
Choose MCMC when the posterior may be multimodal or when you need samples that converge to the exact posterior rather than a single exponential-family approximation. EP is deterministic and often cheaper, but its result is constrained to one unimodal approximate distribution. For high-stakes problems where approximation quality is uncertain, an MCMC run can serve as a reference for checking EP results.
Related methods
Sources
Minka, T. P. (2001). Expectation propagation for approximate Bayesian inference. In Proceedings of the Seventeenth Conference on Uncertainty in Artificial Intelligence (UAI-01), pp. 362–369. Morgan Kaufmann.
Open publication referenceMinka, T. P. (2001/2013). Expectation propagation for approximate Bayesian inference. arXiv:1301.2294 [cs.AI].
Open publication referenceBishop, C. M. (2006). Pattern Recognition and Machine Learning. Springer. (Chapter 10: Approximate Inference; Section 10.7 covers Expectation Propagation.)
ISBN: 978-0387310732