Expectation propagation (EP) is a deterministic approximate inference algorithm that approximates an intractable posterior distribution with a simpler distribution, usually from the exponential family, by refining one factor approximation at a time through moment matching. In probabilistic models, it serves the same purpose as variational inference and the Laplace approximation: it turns a posterior that cannot be computed exactly into a tractable form that supports prediction, marginal likelihood estimation and uncertainty quantification.
Introduced by Thomas Minka in 2001, EP generalizes assumed density filtering and loopy belief propagation. It is valued for producing accurate marginal means and variances, particularly in Gaussian process classification, Bayesian logistic regression and probit models, where it often outperforms mean-field variational methods.
How expectation propagation refines factor approximations
Expectation propagation starts from a posterior that factorizes as a product of a prior and several likelihood terms, often one factor per data point. Each exact factor is replaced by an approximate site factor from a chosen family, typically an unnormalized Gaussian. The product of all site factors defines the global approximation, written q(θ).
The algorithm then cycles through the factors and updates each one in four steps. The repeated local updates continue until the site parameters stop changing, which signals a fixed point of the EP energy function.
- Form the cavity distribution by removing the current site factor from q(θ).
- Build the tilted distribution by multiplying the cavity by the exact factor.
- Match moments: find the member of the approximating family with the same mean and variance as the tilted distribution.
- Update the site factor so that the cavity times the new site equals the moment-matched distribution.
Moment matching is equivalent to minimizing the forward Kullback-Leibler divergence KL(p || q) locally, from the tilted distribution to the approximation. This choice explains much of EP’s behavior: forward KL penalizes an approximation that misses probability mass, so EP tends to cover the whole posterior rather than lock onto one mode.
Key components and parameters
Several design choices determine whether expectation propagation runs stably and efficiently. The following table lists the main components and what each one controls.
| Component | Typical choice | What it affects |
|---|---|---|
| Approximating family | Gaussian, or other exponential family | Tractability of moment matching |
| Site factors | One per likelihood term | Granularity and memory cost |
| Update schedule | Sequential or parallel | Speed versus stability |
| Damping factor | Step size between 0.1 and 1 | Convergence on difficult models |
| Power parameter α | 1 for standard EP | Interpolation toward variational inference |
| Convergence threshold | Small change in site parameters | Runtime and final accuracy |
The tilted moments must be computable, either in closed form or by one-dimensional numerical integration. For a probit likelihood the moments are analytic, which is why EP is a standard choice for Gaussian process classification. When moments require high-dimensional integrals, EP becomes expensive or impractical.
Expectation propagation compared with other inference methods
Expectation propagation sits between fast local approximations and exact sampling methods. Its main contrast is with variational inference, which minimizes the reverse divergence KL(q || p) and therefore tends to underestimate posterior variance.
| Method | Objective or principle | Typical strength | Typical weakness |
|---|---|---|---|
| Expectation propagation | Local moment matching, forward KL | Accurate marginal variances | No convergence guarantee |
| Variational inference | Maximize the evidence lower bound | Guaranteed convergence, scalable | Underestimates uncertainty |
| Laplace approximation | Gaussian at the posterior mode | Very fast and simple | Poor for skewed posteriors |
| Markov chain Monte Carlo | Sampling from the exact posterior | Asymptotically exact | Slow for large datasets |
| Belief propagation | Exact message passing on discrete graphs | Exact on trees | Limited to tractable messages |
In factor graphs, EP can be written as message passing, and it reduces to loopy belief propagation when the approximating family is fully factorized over discrete variables. This connection makes EP a natural tool for probabilistic programming systems such as Infer.NET, which uses it as a primary inference engine.
When to use expectation propagation
Expectation propagation is most effective when the posterior is roughly unimodal and each likelihood factor depends on a low-dimensional projection of the parameters. The decision table below summarizes typical situations.
| Situation | Recommendation | Reason |
|---|---|---|
| Gaussian process classification | Use EP | Analytic probit moments and accurate variances |
| Bayesian logistic or probit regression | Use EP | Factors depend on one linear projection |
| Very large datasets | Consider stochastic EP or VI | Standard EP stores one site per data point |
| Strongly multimodal posterior | Prefer MCMC | Single Gaussian cannot represent several modes |
| Need a guaranteed convergent optimizer | Prefer VI | EP may oscillate without damping |
Scalable variants address the memory cost of storing all site factors. Stochastic expectation propagation keeps a single shared site factor, and distributed EP partitions data across workers, enabling parallel Bayesian inference on large datasets.
Limitations and failure modes
The main practical weakness is that convergence is not guaranteed. Standard EP does not optimize a bound, and updates can oscillate or diverge, particularly when site precisions become negative variances. Damping, careful update ordering and double-loop algorithms reduce this risk at the cost of speed.
- Negative site precisions: a site factor may become an improper Gaussian; clipping or damping is often required.
- Multimodality: forward KL averages over modes and can place mass in low-probability regions between them.
- Expensive moments: factors that couple many parameters require costly numerical integration.
- Memory growth: one site per observation scales linearly with dataset size.
Despite these issues, EP estimates of the marginal likelihood are often more accurate than the evidence lower bound, which makes the method attractive for hyperparameter selection in Gaussian process models.
A non-technical view
Some probability problems are too complex to solve exactly. Expectation propagation gives a good, simple approximation instead.
Imagine a team estimating a project budget. Each member knows one part of the cost. The team starts with a rough guess. Then each person in turn removes their old input, looks at the current total, and adds a corrected input. They repeat this until nobody wants to change anything. Each small local fix improves the whole estimate. Expectation propagation works the same way with pieces of evidence.
A concrete example
A medical research group builds a Gaussian process classifier to predict whether a patient will develop a complication after surgery, using 1,200 patient records with 15 clinical measurements each. The probit likelihood makes the exact posterior intractable, so the team compares the Laplace approximation with expectation propagation.
The Laplace approximation runs faster but produces overconfident probabilities for borderline patients. EP, with a damping factor of 0.5, converges in about 20 sweeps over the data and yields predictive probabilities that are better calibrated on held-out patients. Its marginal likelihood estimate also guides the choice of kernel length scales.
The outcome is a model whose uncertainty estimates clinicians can trust: patients with predicted risk near 50 percent are flagged for additional review rather than classified with false certainty.