S8 · Lesson 37 · LDPC codes and iterative decoding
Sparse parity-check matrices and their Tanner graphs, regular ensembles and design rate, the peeling decoder on the erasure channel, density evolution and the decoding threshold, belief propagation with log-likelihood ratios, and why these codes run within a fraction of a decibel of capacity
Lesson 36 ended with codes that come close to Shannon's limit. Low-density parity-check codes, invented by Gallager in 1960 and forgotten for thirty years, now protect the data in Wi-Fi, 5G, satellite television and most solid-state drives. Their parity-check matrices are almost entirely zeros, and they're decoded by passing short messages back and forth along the edges of a graph. Richardson and Urbanke showed how to predict, from a one-line recursion, exactly how much noise such a code survives. Where does that recursion come from?
- A (d_v, d_c)-regular LDPC code on the binary erasure channel, which erases each bit with probability ε. Density evolution tracks x, the probability that a message from a bit node is still an erasure, one decoding iteration at a time: .
- Decoding succeeds if iterating from x = ε reaches zero, which happens exactly when the curve f(x) stays below the line y = x. Where they touch, decoding stalls at a nonzero fixed point.
- For the (3, 6) code (rate 1/2) the threshold is ε* = 0.4294, against the capacity limit of 0.5. Move ε across it and watch the tunnel between the curve and the line close.
Predict
A rate-1/2 code is used on an erasure channel that erases 45% of the bits. Could any code at rate 1/2 work? Can the (3, 6) LDPC code with iterative decoding?
The erasure channel's capacity is 1 − ε = 0.55 bits per use, above the code's rate of 0.5, so reliable codes exist. But density evolution for the (3, 6) ensemble stalls above ε* = 0.4294: at 0.45, the erasure probability settles at about 0.36 instead of falling to zero. Irregular degree distributions, with some bits in many checks and some in few, push the threshold to within a hair of 0.5.
Name it
Sparse parity checks and Tanner graphs
An LDPC code is defined by a parity-check matrix H that is mostly zeros. Draw it as a bipartite Tanner graph: n bit (variable) nodes, one per column, m check nodes, one per row, and an edge for every 1. In a -regular code every bit sits in checks and every check involves bits, so there are edges and the design rate is
Codes are drawn from an ensemble of random graphs with the given degrees; for long blocks almost every member performs like the average.
Decoding erasures by peeling
On the binary erasure channel each bit arrives correctly or as "?". Any check with exactly one erased bit determines it: that bit is the XOR of the others. Fill it in, remove it, and repeat. Decoding stops when every bit is known or when every remaining check has two or more erasures (a stopping set). The work is proportional to the number of edges, linear in block length.
Density evolution
For a long random code, the graph around any edge looks like a tree for many iterations, so messages are independent. A check sends an erasure unless all other incoming messages are known; a bit sends an erasure only if its channel value and all other check messages are erasures. So the erasure probability x on bit-to-check messages evolves as
The threshold ε is the largest ε for which . For (3, 6), ε = 0.4294; for (4, 8), 0.3834. Higher degrees aren't better for iterative decoding, though they help the code's minimum distance.
Belief propagation on noisy channels
On channels with noise, messages are log-likelihood ratios . A bit node adds its channel LLR and the incoming check messages (except on the edge it sends along). A check node combines its other inputs by the tanh rule
often approximated by the min-sum rule: the smallest magnitude, with the product of the signs. Density evolution then tracks distributions of LLRs, and optimized irregular codes reach within a few hundredths of a decibel of the Shannon limit on the AWGN channel at long block lengths.
Worked example
A (3, 6)-regular code has n = 1000 bits. How many checks and edges does it have, and what's its rate? How does decoding go at ε = 0.4?
Show the solution
- Edges.
- Checks.
- Rate.
- Density evolution at ε = 0.4. From = 0.4 it gives 0.340, 0.306, 0.282, 0.262, 0.244, 0.227, slowing as it squeezes through the narrow gap between the curve and the line near x ≈ 0.25, then racing to zero: below 10⁻⁶ after 18 iterations.
- Against the threshold. Since 0.4 is below ε* = 0.4294, a long code decodes; at 0.45 the recursion settles at x = 0.355 and most erased bits stay unknown.
Answer 500 checks and 3000 edges, rate 1/2; at ε = 0.4 decoding succeeds, with the erasure fraction below 10⁻⁶ after 18 iterations.
Worked example
A check node receives LLRs of 2 and 3 from its other two bits. What does it send to the third, by the tanh rule and by min-sum?
Show the solution
- Tanh of each half-LLR. with product 0.689.
- Tanh rule.
- Min-sum. It sends min(2, 3) = 2, with a positive sign.
- Why the output is weaker. The parity check is weaker evidence than either input: the third bit is inferred from two uncertain bits, so its confidence is below the less certain one. Min-sum's overestimate is why practical decoders scale or offset its outputs.
Answer 1.69 by the tanh rule and 2 by min-sum.
Worked example
A check node receives LLRs 1.5, −2 and 3 from its other bits. What does it send by the tanh rule, and by min-sum?
Show the solution
- Tanh of each half-LLR.
- Tanh rule.
- Min-sum. The product of the signs (−) times the smallest magnitude (1.5): −1.5.
- Overconfidence. Min-sum overstates confidence, which practical decoders correct with a scaling factor or an offset.
Answer −0.94 by the tanh rule and −1.5 by min-sum.
Check
What's the design rate of a (3, 7)-regular LDPC code?
Check
A (3, 12)-regular code has 1200 bits. How many check nodes does it have?
Check
A (3, 8)-regular code sees erasure probability 0.4. What's the erasure probability on bit-to-check messages after one iteration of density evolution?
Check
A check node's other inputs carry LLRs 2 and 1.5. What LLR does it send by the tanh rule?
Check
A bit node has channel LLR 1.2 and receives −1 and 3 from its other checks. What does it send to its third check?
Check
An erasure channel erases bits with probability 0.35. What's the highest rate any code can reliably achieve on it?
Check
A (3, 6)-regular LDPC code has 4800 bits.
(a)
How many check nodes does it have?
(b)
How many edges does its Tanner graph have?
(c)
What is its design rate?
Check
Density evolution runs on a (v, c)-regular code over an erasure channel with probability e; the current bit-to-check erasure probability is x.
Step 1
What erasure probability do check-to-bit messages carry?
Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.
Step 2
What is the next bit-to-check erasure probability?
Explain why
Why can a one-line recursion predict exactly how a long LDPC code decodes?
Iterative decoding is local: each message depends only on the part of the graph within a few edges of where it's computed. In a long code with randomly placed sparse connections, that neighborhood is almost surely a tree for many iterations, with no short cycles, so the messages entering any node come from disjoint parts of the graph and are statistically independent. Independence lets the probability of an erasure, or the distribution of an LLR, be computed from those of the incoming messages with no other information about the particular code. That is density evolution. And concentration results show that almost every code in the ensemble behaves like the average, so the threshold the recursion predicts is the threshold real long codes show. Finite codes have cycles and stopping sets, which create an error floor and a gradual waterfall rather than a sharp threshold.
Practice
Keep practicing
9 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.