46.08.01 · information-theory / modern-codes

LDPC Codes, Tanner Graphs, Belief Propagation, and Density Evolution Analysis

shipped3 tiersLean: none

Anchor (Master): Cover & Thomas 2006 Elements of Information Theory 2e (Wiley) §7.1-7.4; Richardson & Urbanke 2008 Modern Coding Theory (Cambridge) §§3-4 (density evolution, stability condition, threshold phenomenon); Gallager 1962 Low-Density Parity-Check Codes (MIT PhD thesis)

Intuition Beginner

Imagine you have a large sheet of equations, each involving only a few unknowns. Each equation checks whether a small group of bits satisfies a parity constraint (their sum is even). Each bit appears in only a few equations. The sheet is "sparse" — most entries are zero. This sparse system of checks is a low-density parity-check code, or LDPC code.

Why sparsity matters: a dense parity-check matrix (like Hamming codes use) gives strong algebraic structure but does not scale. A sparse matrix gives you something different — you can decode by passing simple messages between bits and checks, iteratively, without solving the whole system at once. Each bit sends its best guess to the checks it participates in. Each check sends back information about what the bit should be, based on the other bits in that check. After several rounds, the bits converge to a consistent codeword.

Think of it like a group of students solving a puzzle together. Each student knows their own clue and can share hints with a few neighbours. After enough rounds of sharing, the whole group converges on the answer. No student needs to see the entire puzzle — just local information, iterated.

Robert Gallager invented these codes in his 1962 PhD thesis at MIT. At the time, computers were too slow for iterative decoding to be practical, so the codes were forgotten for three decades. In 1996, David MacKay and Radford Neal rediscovered them and demonstrated near-capacity performance. Today, LDPC codes are in every modern communication standard: Wi-Fi (802.11n/ac/ax), 5G cellular, satellite links, and hard drive storage.

Visual Beginner

Component Analogy Role
Variable node A student with a clue Represents one bit of the codeword
Check node A classroom rule Represents one parity constraint
Edge A conversation Connects a bit to a check it participates in
Message A whispered hint Probabilistic opinion passed along an edge
Iteration One round of sharing All messages update simultaneously

Figure: A Tanner graph for a small LDPC code with 6 variable nodes (circles, labelled through ) and 4 check nodes (squares, labelled through ). Each variable node connects to 2 check nodes; each check node connects to 3 variable nodes. This is a (2,3)-regular code. Messages flow left-to-right (variable to check) and right-to-left (check to variable) in alternating rounds.

The Tanner graph is bipartite: edges only connect variable nodes to check nodes, never variable-to-variable or check-to-check. The graph structure exactly mirrors the sparsity pattern of the parity-check matrix.

Worked example Beginner

Consider a tiny (3,6)-regular LDPC code with block length and parity checks, so the rate is . Each bit participates in 3 checks; each check involves 6 bits. Suppose we transmit the all-zeros codeword over a binary symmetric channel with crossover probability (5% chance each bit flips).

The channel output has, on average, bit errors. Let us say the received word is , where bit 3 was flipped by the channel.

Each bit starts with a log-likelihood ratio (LLR) from the channel. For the binary symmetric channel with crossover , the LLR for received bit is:

With : . A positive LLR means the bit is more likely 0. For the flipped bit 3, the received value is 1, so its LLR is (leaning toward bit value 1, which is wrong).

In the first round of belief propagation, each variable node sends its channel LLR to each of its 3 neighbouring check nodes. Each check node then combines the messages from its other 5 neighbours (excluding the target variable) to send back a message. The check-to-variable message says: "given what the other bits in this check look like, what should your bit be?"

For check nodes connected to the error bit , one of the 5 other bits will contribute wrong information, but the other 4 contribute correct information. The majority vote of the check node will point the bit back toward 0. After a few iterations, the error is corrected. The decoder converges because the channel is "clean enough" — the error rate of 5% is well below the decoding threshold for a (3,6)-regular code, which is approximately 8.4% on the binary symmetric channel.

Check your understanding Beginner

Formal definition Intermediate+

Let denote the binary field. An LDPC code of length with parity checks is defined by a parity-check matrix that is sparse: the number of nonzero entries per row and per column is bounded by constants independent of .

Definition (Regular LDPC code). A -regular LDPC code has a parity-check matrix where every column contains exactly ones and every row contains exactly ones. The parameters satisfy (equal total edge count counted by rows and columns). The design rate is .

Definition (Tanner graph). The Tanner graph of is a bipartite graph where is the set of variable nodes (one per column of ), is the set of check nodes (one per row of ), and iff . For a -regular code, every variable node has degree and every check node has degree .

Definition (Irregular LDPC code). An irregular LDPC code is described by two polynomials. The variable-node degree distribution from the edge perspective is:

where is the fraction of edges connected to variable nodes of degree , and is the maximum variable-node degree. The check-node degree distribution is:

where is the fraction of edges connected to check nodes of degree , and is the maximum check-node degree. The rate of the irregular code is:

A -regular code has and .

Counterexamples to common slips

  • Sparsity is asymptotic. For a code of length , the density of is , which vanishes as . A fixed matrix with 3 ones per column is not "low-density" in the asymptotic sense — the code is too short for the sparsity to matter.

  • The Tanner graph must be acyclic for exact belief propagation. If the Tanner graph has cycles, belief propagation is no longer exact — messages become correlated after one traversal of each cycle. Practical LDPC codes always have cycles, but the graph is designed so the shortest cycle (the girth) is long enough that BP converges before correlations corrupt the messages.

  • Rate is a design rate, not always achievable. The formula gives the design rate assuming all rows of are linearly independent. If has linearly dependent rows, the actual rate is higher, but the code is weaker because fewer independent constraints are enforced.

Key theorem with proof Intermediate+

Theorem (Belief propagation update rules). Consider an LDPC code with Tanner graph . Let denote the log-likelihood ratio message from variable node to check node in the current iteration, and the message from to . Let be the set of check-node neighbours of and the set of variable-node neighbours of . The belief propagation update rules are:

Variable-to-check update:

Check-to-variable update:

where is the channel log-likelihood ratio for bit .

Proof. The variable-node update combines independent evidence. Variable node has access to the channel observation and the incoming messages from all neighbouring check nodes except (to avoid feeding back information that originated from ). Since the messages from different check nodes concern disjoint parity constraints, the combined LLR is the sum:

The check-node update uses the parity constraint. Check node enforces the equation (mod 2). The LLR for the XOR of two independent binary random variables with LLRs satisfies:

This is the box-plus (or tanh) rule. By induction, the LLR of the XOR of variables is given by the product of their tanh values, which yields the check-node update. The exclusion of from the product enforces the extrinsic message principle: sends to only information derived from the other variable nodes.

Bridge. The belief propagation update rules build toward density evolution in 46.08.01 (this unit's advanced section) by providing the exact functional map from input message densities to output message densities at each node type. This functional map appears again in 46.08.02 as the same sum-product structure used in turbo decoding, and in 40.06.06 as the soft-decoding generalisation of the syndrome-based algebraic decoder. The foundational reason the tanh product rule works is that parity constraints in define XOR operations whose likelihood ratios factor through the tanh identity, and this is exactly the algebraic structure that makes iterative decoding tractable. The central insight is that the graph sparsity keeps each update local (constant cost per node), while the global structure of the Tanner graph ensures that information propagates across all bits over multiple iterations.

Exercises Intermediate+

Lean formalization Intermediate+

Mathlib does not define sparse parity-check matrices, Tanner graphs, or iterative message-passing algorithms. The SimpleGraph type can represent bipartite graphs but lacks the variable/check node labelling, the degree-distribution polynomials and , and the BP update rules. The density evolution analysis requires a functional that maps a distribution on to a new distribution under the tanh-product and summation operations; this is absent. A Codex.CodingTheory.LDPC module defining a ParityCheckMatrix type with sparsity constraints, the associated Tanner graph, and a MessagePassing procedure would be the load-bearing first step; this unit ships without it.

Advanced results Master

Density evolution

Density evolution is the analytical tool that predicts the performance of belief propagation decoding on LDPC codes in the limit of infinite blocklength. The key idea: in the limit , the Tanner graph of a random -regular LDPC code is locally tree-like (the girth grows as ), so messages arriving at any node are approximately independent. This independence assumption allows us to track the probability distribution of messages through iterations as a deterministic dynamical system.

Let denote the density transformation at a variable node of degree and the density transformation at a check node of degree . For the binary erasure channel, the density is fully characterised by a single scalar , the erasure probability of a randomly chosen message at iteration . The density evolution equation for a -regular code on the BEC is:

where and are the edge-degree distribution polynomials. For a -regular code (, ), this becomes:

For general channels (BSC, AWGN), the density is a distribution on , and the evolution involves convolutions (at variable nodes) and a nonlinear transformation involving the tanh product rule (at check nodes). Richardson and Urbanke (2001) showed that this infinite-dimensional dynamical system can be analysed to compute the threshold precisely.

The threshold phenomenon

Definition (BP threshold). The belief propagation threshold for an LDPC ensemble with degree distributions on a channel family parameterised by is:

The threshold is a property of the degree distribution, not of any individual code. For the (3,6)-regular ensemble on the BSC, the threshold is . For the BEC, . Shannon capacity for rate on the BSC is , so the (3,6)-regular code achieves about 76% of capacity.

The threshold phenomenon says that BP decoding undergoes a phase transition: below the threshold, the error probability converges to zero exponentially fast in the number of iterations; above the threshold, it converges to a nonzero constant. This is analogous to a physical phase transition, and the mathematical structure is the same as that of spin glasses in statistical mechanics.

Capacity-approaching irregular codes

The breakthrough of Luby, Mitzenmacher, Shokrollahi, Spielman, and Stemann (1997, 2001) was to show that irregular LDPC codes can approach the Shannon capacity arbitrarily closely by optimising the degree distributions and . The key insight: nodes of high degree act as "super-nodes" that collect information from many checks and broadcast it widely, accelerating convergence. Nodes of low degree provide the majority of the code's structure and redundancy.

For the BEC, the optimisation problem is: given a target erasure rate , find maximising subject to the stability condition and the convergence condition under density evolution. Using linear programming over the degree distribution coefficients, codes achieving rates within bits of Shannon capacity on the BEC have been constructed (for example, by Shokrollahi and Urbanke's Tornado/LDPC constructions).

For the AWGN channel, Chung, Forney, Riley, and Urbanke (2001) constructed irregular LDPC codes that achieve rates within 0.0045 dB of the Shannon limit at block length . These codes use variable-node degrees up to 8000 and are the closest any practical code has come to the Shannon limit.

Stability condition

The stability condition is a local analysis of the density evolution fixed point at . For a general binary-input memoryless symmetric channel, the condition is:

where is the Bhattacharyya parameter of the channel. For the BEC with erasure probability , , so the condition becomes . This ensures that the all-zero fixed point of the density evolution is stable, i.e., small residual error rates decay to zero. The stability condition gives a necessary condition for the threshold, and in many cases it is also sufficient.

Synthesis. Density evolution is the analytical engine that transforms belief propagation from an algorithm into a theory; the threshold phenomenon is the central insight that BP decoding undergoes a sharp phase transition at a channel parameter determined entirely by the degree distribution; the stability condition is the bridge between the local (linearised) analysis of the fixed point at zero error and the global convergence of the density evolution map; and the optimisation of irregular degree distributions puts these together to close the gap to Shannon capacity. The generalises from the BEC analysis to general symmetric channels through the same functional iteration on message densities, and the foundational reason LDPC codes can approach capacity is that the sparsity of the Tanner graph simultaneously ensures low decoding complexity (linear in ) and long-range information propagation (through the expander-like structure of the graph).

Full proof set Master

Proposition (Girth and independence). For a random -regular LDPC code ensemble with block length , the expected girth of the Tanner graph is at least . Consequently, messages within iterations of BP, where is the girth, are statistically independent.

Proof. Consider a breadth-first search from an arbitrary edge in the Tanner graph. At depth , the search tree has at most edges. A cycle of length exists only if two distinct paths from the root reconnect at the same node. For a random bipartite graph with variable nodes and check nodes, the probability that a given pair of paths of length reconnect is at most at each reconnection opportunity. There are candidate path pairs, so the expected number of cycles of length is at most . This vanishes when , which holds for where depends on and . Direct computation shows suffices, giving girth . Messages within iterations traverse only the tree neighbourhood, which is cycle-free, ensuring independence.

Proposition (Density evolution for the BEC). For an LDPC code ensemble with degree distributions on the BEC with erasure probability , the probability that a randomly chosen message is erased at iteration satisfies:

Proof. On the BEC, a check node can recover an erased variable if and only if all other variables in that check are known (non-erased). A check-to-variable message from a check node of degree is erased iff all other variable-to-check messages are erased, each with probability . So the check-to-variable erasure probability for a degree- check is .

Averaging over the edge-degree distribution , the check-to-variable erasure rate is:

Now consider a variable node of degree . Its outgoing variable-to-check message is erased iff the channel erased it (probability ) AND all incoming check messages are erased (each with probability ). The conditional erasure probability is .

Averaging over and including the channel erasure:

To convert to the standard form, substitute and define as the probability a check message provides information. On the BEC, a check message provides information with probability for a degree- check, so and . The standard literature form uses the complementary variable: writing in terms of gives as the fraction of check messages that provide information (all others known). Then the erasure fraction at the check output is , and the variable-node combining gives .

Verification for the -regular code: , , giving , which matches the known recurrence.

Connections Master

  • 46.01.01 — Entropy and mutual information set the fundamental limits (Shannon capacity) that LDPC codes approach; the gap between the BP threshold and capacity is measured in terms of the mutual information between channel input and output.
  • 40.06.06 — Linear codes and their parity-check matrices are the algebraic substrate on which LDPC codes are built; the LDPC construction adds the sparsity constraint that enables iterative decoding.
  • 46.03.01 — Channel capacity is the benchmark: the BP threshold of an LDPC ensemble is always below Shannon capacity, and the goal of degree-distribution optimisation is to close this gap.
  • 40.06.07 — Perfect codes (Hamming, Golay) achieve maximum-likelihood decoding bounds but have fixed rates; LDPC codes sacrifice algebraic perfection for flexible rates and near-capacity performance via iterative decoding.
  • 46.02.01 — The asymptotic equipartition property guarantees that long codes concentrate around their ensemble average, which is the statistical foundation for density evolution's analysis.

Historical & philosophical context Master

Robert Gallager developed LDPC codes in his 1962 MIT doctoral thesis, "Low-Density Parity-Check Codes," supervised by Peter Elias and Claude Shannon. Gallager constructed -regular ensembles, devised the iterative decoding algorithm (then called "probabilistic decoding"), and proved that the minimum distance of his random codes grew linearly with block length with high probability. His thesis was published as an MIT Press monograph in 1963.

Despite their theoretical elegance, Gallager's codes were impractical for the computers of the 1960s. Decoding required iterative floating-point operations on large matrices, and the computational cost exceeded what was feasible. The codes fell into obscurity for three decades. The coding theory community focused on algebraic codes (Reed-Solomon, BCH) and convolutional codes with Viterbi decoding, which had efficient hardware implementations.

The rediscovery began in 1996 when David MacKay and Radford Neal published "Near Shannon Limit Performance of Low Density Parity Check Codes" in Electronics Letters (vol. 32, pp. 1645-1646). They demonstrated that Gallager's codes, when decoded with modern hardware, achieved bit-error rates of at signal-to-noise ratios within 0.3 dB of the Shannon limit on the AWGN channel. This result, coming just two years after Berrou, Glavieux, and Thitimajshima's 1993 turbo code breakthrough, reignited interest in iterative decoding.

The theoretical framework was completed by Thomas Richardson and Ruediger Urbanke in their 2001 paper "The Capacity of Low-Density Parity-Check Codes Under Message-Passing Decoding" (IEEE Transactions on Information Theory, vol. 47, pp. 599-618). They introduced density evolution as a rigorous analytical tool, proved the concentration of individual code performance around the ensemble average, and computed the BP threshold for various channels and degree distributions. Their 2008 book Modern Coding Theory (Cambridge University Press) is the definitive treatment.

The parallel development of irregular LDPC codes by Luby, Mitzenmacher, Shokrollahi, Spielman, and Stemann (STOC 1997, and subsequent papers) showed that optimising the degree distribution could close the gap to capacity entirely on the BEC. Chung, Forney, Riley, and Urbanke (2001) extended this to the AWGN channel, constructing codes within 0.0045 dB of capacity. These results cemented LDPC codes as the practical realisation of Shannon's 1948 promise.

LDPC codes entered commercial standards in the 2000s. They replaced turbo codes in the 5G NR (New Radio) standard (3GPP Release 15, 2017) for the data channel, and they are the FEC scheme in Wi-Fi 802.11n/ac/ax, DVB-S2 (satellite television), and IEEE 802.3an (10GBASE-T Ethernet). The victory of LDPC over turbo codes in 5G was decided by LDPC's superior throughput at high data rates and lower decoding latency.

Bibliography Master

@phdthesis{gallager1962,
  author = {Gallager, R. G.},
  title  = {Low-Density Parity-Check Codes},
  school = {Massachusetts Institute of Technology},
  year   = {1962},
}
@book{gallager1963,
  author    = {Gallager, R. G.},
  title     = {Low-Density Parity-Check Codes},
  publisher = {MIT Press},
  year      = {1963},
}
@book{cover-thomas2006,
  author    = {Cover, T. M. and Thomas, J. A.},
  title     = {Elements of Information Theory},
  edition   = {2nd},
  publisher = {Wiley},
  year      = {2006},
}
@book{richardson-urbanke2008,
  author    = {Richardson, T. and Urbanke, R.},
  title     = {Modern Coding Theory},
  publisher = {Cambridge University Press},
  year      = {2008},
}
@article{mackay-neal1996,
  author  = {MacKay, D. J. C. and Neal, R. M.},
  title   = {Near Shannon Limit Performance of Low Density Parity Check Codes},
  journal = {Electronics Letters},
  volume  = {32},
  pages   = {1645--1646},
  year    = {1996},
}
@inproceedings{luby1997,
  author    = {Luby, M. G. and Mitzenmacher, M. and Shokrollahi, M. A. and Spielman, D. A. and Stemann, V.},
  title     = {Practical Loss-Resilient Codes},
  booktitle = {Proc. 29th ACM STOC},
  pages     = {150--159},
  year      = {1997},
}
@article{richardson-urbanke2001,
  author  = {Richardson, T. and Urbanke, R.},
  title   = {The Capacity of Low-Density Parity-Check Codes Under Message-Passing Decoding},
  journal = {IEEE Transactions on Information Theory},
  volume  = {47},
  pages   = {599--618},
  year    = {2001},
}
@article{chung2001,
  author  = {Chung, S.-Y. and Forney, G. D. and Riley, T. J. and Urbanke, R.},
  title   = {On the Design of Low-Density Parity-Check Codes Within 0.0045 dB of the Shannon Limit},
  journal = {IEEE Communications Letters},
  volume  = {5},
  pages   = {58--60},
  year    = {2001},
}