Expectation propagation

On this page 7

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.

  1. Form the cavity distribution by removing the current site factor from q(θ).
  2. Build the tilted distribution by multiplying the cavity by the exact factor.
  3. Match moments: find the member of the approximating family with the same mean and variance as the tilted distribution.
  4. 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.

ComponentTypical choiceWhat it affects
Approximating familyGaussian, or other exponential familyTractability of moment matching
Site factorsOne per likelihood termGranularity and memory cost
Update scheduleSequential or parallelSpeed versus stability
Damping factorStep size between 0.1 and 1Convergence on difficult models
Power parameter α1 for standard EPInterpolation toward variational inference
Convergence thresholdSmall change in site parametersRuntime and final accuracy
Components of an expectation propagation implementation

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.

MethodObjective or principleTypical strengthTypical weakness
Expectation propagationLocal moment matching, forward KLAccurate marginal variancesNo convergence guarantee
Variational inferenceMaximize the evidence lower boundGuaranteed convergence, scalableUnderestimates uncertainty
Laplace approximationGaussian at the posterior modeVery fast and simplePoor for skewed posteriors
Markov chain Monte CarloSampling from the exact posteriorAsymptotically exactSlow for large datasets
Belief propagationExact message passing on discrete graphsExact on treesLimited to tractable messages
Comparison of approximate inference methods

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.

SituationRecommendationReason
Gaussian process classificationUse EPAnalytic probit moments and accurate variances
Bayesian logistic or probit regressionUse EPFactors depend on one linear projection
Very large datasetsConsider stochastic EP or VIStandard EP stores one site per data point
Strongly multimodal posteriorPrefer MCMCSingle Gaussian cannot represent several modes
Need a guaranteed convergent optimizerPrefer VIEP may oscillate without damping
Choosing expectation propagation in practice

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.