Belief propagation is a message-passing algorithm that computes marginal distributions of variables in a probabilistic graphical model by having neighboring nodes repeatedly exchange local summaries of evidence. Also known as the sum-product algorithm, it is one of the central inference methods in probabilistic models, and it gives exact marginals on tree-structured graphs in a number of steps proportional to the graph diameter.
Introduced by Judea Pearl for Bayesian networks in the early 1980s and later unified on factor graphs, the method underlies decoding of modern error-correcting codes, stereo vision, and many inference routines in artificial intelligence. On graphs with cycles it is applied as loopy belief propagation, an approximate method that often works well but carries no general convergence guarantee.
How belief propagation passes messages
The algorithm operates on a factor graph, a bipartite graph of variable nodes and factor nodes, where each factor encodes a local potential such as a conditional probability table or a pairwise compatibility. Each node sends to each neighbor a message, a nonnegative function over the shared variable that summarizes all evidence reachable through the sender, excluding the recipient.
Two update rules define the method. A variable-to-factor message is the product of all incoming factor messages except the one from the target factor. A factor-to-variable message multiplies the factor potential by incoming variable messages and then sums out every other variable, which gives the sum-product algorithm its name. The belief of a variable is the normalized product of all its incoming messages.
| Component | Definition | Role in inference |
|---|---|---|
| Factor potential | Nonnegative function over a subset of variables | Encodes local model structure |
| Message | Function over one variable sent along an edge | Carries summarized evidence |
| Belief | Normalized product of incoming messages | Approximates or equals the marginal |
| Schedule | Order in which messages are updated | Affects speed and convergence |
| Evidence | Observed values clamped as unary factors | Conditions the computation |
On a tree, a two-pass schedule suffices: messages flow from the leaves to a chosen root and then back out. After both passes every belief equals the exact marginal posterior, at a cost linear in the number of edges and polynomial in the variable cardinality.
Variants of the algorithm
Several variants share the same message-passing skeleton but change the algebraic operations or the message representation. The choice depends on whether the goal is marginals or the most probable configuration, and on whether variables are discrete or continuous.
| Variant | Operation replacing the sum | Computes | Typical use |
|---|---|---|---|
| Sum-product | Sum over variables | Marginal probabilities | General posterior inference |
| Max-product | Maximum over variables | Most probable assignment | MAP decoding, labeling |
| Min-sum | Minimum in log space | MAP with numeric stability | LDPC and turbo decoders |
| Gaussian BP | Integration of Gaussians | Means and variances | Sensor fusion, linear systems |
| Loopy BP | Sum-product on cyclic graphs | Approximate marginals | Vision, coding, networks |
The forward-backward algorithm for hidden Markov models is exactly sum-product on a chain, and the Viterbi algorithm is max-product on the same chain. Recognizing these equivalences helps practitioners reuse one implementation across several model families.
Loopy belief propagation and convergence
When the graph contains cycles, messages can circulate and reinforce their own evidence, so beliefs are no longer guaranteed to be exact. Loopy belief propagation simply iterates the same updates until messages stop changing or a maximum iteration count is reached.
Theory explains much of its behavior. Fixed points of loopy belief propagation correspond to stationary points of the Bethe free energy, a variational approximation, which links the method to variational inference. Convergence is guaranteed for trees, single-cycle graphs and certain models with weak or attractive couplings, but strong interactions and short cycles can cause oscillation or overconfident beliefs.
- Damping blends new and old messages, typically with a factor of 0.5 to 0.9, to suppress oscillation.
- Residual scheduling updates the messages that changed most first, often converging faster.
- Tree-reweighted BP and generalized BP use region-based approximations for tighter bounds.
Belief propagation compared with other inference methods
Belief propagation sits between exact algorithms that become intractable on dense graphs and sampling methods that are general but slow. Its strength is speed and parallelism on sparse graphs; its weakness is the lack of accuracy guarantees once cycles appear.
| Method | Exactness | Cost driver | Best suited to |
|---|---|---|---|
| Belief propagation | Exact on trees, approximate on loops | Edges and variable cardinality | Sparse graphs, real-time inference |
| Junction tree algorithm | Exact on any graph | Treewidth, exponential | Small or low-treewidth models |
| Variable elimination | Exact for one query | Elimination order | Single marginal queries |
| Gibbs sampling | Asymptotically exact | Mixing time | Complex models, ample compute |
| Mean-field variational inference | Approximate | Iterations of coordinate updates | Large latent variable models |
The junction tree algorithm can be viewed as belief propagation on clusters of variables, which restores exactness at the price of message sizes that grow exponentially with treewidth. Expectation propagation generalizes the idea by projecting messages onto tractable distribution families.
Practical implementation advice
Robust implementations depend on a few numerical and scheduling details. Ignoring them causes underflow, silent divergence or misleading confidence, even on models that are theoretically well behaved.
| Issue | Cause | Remedy |
|---|---|---|
| Numerical underflow | Products of many small probabilities | Normalize messages or work in log space |
| Oscillating messages | Strong couplings on short cycles | Apply damping or residual scheduling |
| Overconfident beliefs | Evidence double-counted around loops | Validate against exact or sampled marginals |
| Slow updates | Large discrete state spaces | Exploit factor structure or use particles |
| Stopping too early | Loose convergence tolerance | Use tolerances near 1e-6 and iteration caps |
Because every message depends only on local information, the algorithm parallelizes well on GPUs and distributed systems, a major reason it remains attractive for large sparse models despite its approximation risks.
A plain-language summary
Belief propagation is a way for many connected pieces of a puzzle to work out what is likely by talking to their neighbors. Each piece knows only a little. It sends a short note to each neighbor about what it has learned.
The neighbors combine these notes and pass new ones along. After enough rounds, each piece has a good estimate of its own probability. When the connections form no loops, the estimate is exact. With loops, it is usually close but not guaranteed.
An example from practice
A wireless equipment manufacturer designs a receiver for a 5G data channel that uses low-density parity-check codes. Each received block contains several thousand bits, some corrupted by noise. The decoder represents the code as a factor graph in which bit nodes connect to parity-check nodes, and it runs min-sum belief propagation, a numerically stable variant of max-product in log space.
Bit nodes start with likelihoods from the demodulator, and messages flow between bits and checks for a fixed budget of about 10 to 25 iterations. Most blocks converge within a few iterations, and decoding stops early once all parity checks are satisfied. The engineering team tunes a scaling factor of about 0.75 on check messages to compensate for the min-sum approximation, which brings the error rate close to sum-product performance at much lower hardware cost. The result is a decoder that meets throughput targets of several gigabits per second on a dedicated chip.