8. Polar & Fountain Codes
The cutting edge of error correction
8. Polar & Fountain Codes
Turbo and LDPC codes brought us within fractions of a decibel of the Shannon limit, but they rely on careful design and experimental optimization. Nobody could prove they actually achieve capacity. In 2009, Erdal Arıkan introduced polar codes — the first codes proven to achieve Shannon capacity with efficient encoding and decoding. This was a landmark result, solving a problem open for over sixty years.
Meanwhile, fountain codes tackle a different question: what if you don't know the channel conditions in advance? They produce a potentially unlimited stream of encoded symbols — the receiver collects enough (any subset) and recovers the data. Together, these two families represent the cutting edge of coding theory.
Polar Codes: Provably Optimal
Shannon's 1948 theorem said "good codes exist" but never told us how to build them efficiently. For decades, every practical code was either proven suboptimal or lacked a proof of optimality.
The core idea: instead of designing a code that works well on a mediocre channel, transform the channel itself into a collection of very good and very bad channels, then only use the good ones.
Channel Polarization: The Core Idea
Take N copies of the same noisy channel. Apply a recursive transformation based on the 2×2 kernel matrix:
F = [ 1 0 ; 1 1 ]output1 = input1 ⊕ input2, and output2 = input2. Just one XOR — but recursive application has profound consequences.
As N grows, the channels polarize: some become almost perfect (capacity → 1), others almost useless (capacity → 0), with few in between. Think of sorting a room of average students into geniuses and dunces, with almost nobody left in the middle.
N = 2: 2 channels → 1 good + 1 bad
N = 4: 4 channels → ~2 good + ~2 bad
N = 8: 8 channels → ~4 good + ~4 bad
N = 1024: most clearly good or bad, very few ambiguous
The fraction of good channels converges to the channel capacity C. If your channel has capacity 0.6, about 60% of polarized channels become good.
Polar Encoding
Step 1 — Rank the channels: Determine which polarized bit-channels are reliable. This depends on channel type and noise level, and can be precomputed.
Step 2 — Assign bits: Place K data bits in the K best positions (information bits). Set the remaining N − K to zero (frozen bits).
Step 3 — Apply the transform: Multiply by F⊗n (n-fold Kronecker product of the kernel), N = 2n. All arithmetic is XOR.
Step 4 — Transmit the resulting N-bit codeword.
With 8 positions and 3 stages (8 = 23), encoding forms a butterfly network — the same structure as the FFT:
Stage 1: (u1⊕u2, u2, u3⊕u4, u4, u5⊕u6, u6, u7⊕u8, u8)
Stage 2: pairs of width 4 XORed together
Stage 3: pairs of width 8 XORed together
If positions {4, 6, 7, 8} are good (information) and {1, 2, 3, 5} are frozen, place 4 data bits at those positions and apply the butterfly. Encoding is O(N log N) — just like FFT.
Successive Cancellation Decoding
The original decoding algorithm is successive cancellation (SC): decode bits one at a time. For each position: if frozen, output 0; if information, use the received observations plus all previously decoded bits to decide. Correct decisions feed forward like dominoes falling in the right direction.
The problem: if an early bit is wrong, the error cascades. For asymptotically long blocks this is fine — polarization is so strong that good channels virtually never err. But at practical lengths (hundreds to thousands of bits), basic SC does not match LDPC or turbo codes.
SCL Decoding: Closing the Gap
Successive Cancellation List (SCL) decoding hedges bets by maintaining L candidate paths instead of one:
Branch: At each information bit, every path splits into two (bit = 0 and bit = 1), doubling the list to 2L.
Prune: Score paths by likelihood, keep the best L.
Select: At the end, choose the most likely surviving path.
With L = 1 this is ordinary SC. With L = 8 or 32, the decoder explores many parallel hypotheses and resists early mistakes. The breakthrough was CRC-Aided SCL (CA-SCL): append a CRC before encoding, then after SCL decoding, check which surviving paths pass the CRC. The correct path almost always passes; incorrect ones almost never do. This makes polar codes fully competitive with turbo and LDPC at practical block lengths.
Polar Codes in 5G
The adoption of polar codes in 5G NR was one of the most significant — and politically charged — decisions in modern telecommunications.
Control channels (short blocks): Polar codes with CA-SCL decoding. Polar codes excel at short lengths where LDPC has less room to work.
Data channels (large blocks): LDPC codes with layered belief propagation, offering higher throughput with optimized hardware.
Huawei championed polar, Qualcomm championed LDPC. The compromise used each where it performs best — the first time a provably capacity-achieving code entered a major wireless standard.
Fountain Codes: Rateless Coding
Every code so far has a fixed rate — you decide redundancy in advance. But what if you don't know the channel conditions? What if different receivers see different loss rates?
Fountain codes are rateless: the encoder produces a potentially infinite stream of encoded symbols. The decoder collects symbols — it doesn't matter which ones, only that it gets enough.
LT Codes: The First Fountain Code
Michael Luby invented LT (Luby Transform) codes in 2002:
Encode: For each output symbol, choose a random degree d from the Soliton distribution. Randomly pick d input symbols. XOR them. That is one output symbol. Repeat indefinitely.
Decode: Collect slightly more symbols than inputs. Find degree-1 symbols (copies of a single input). XOR known values out of other equations, reducing degrees. Cascade until all inputs are recovered.
Receive 6 encoded symbols:
e1 = A (degree 1)
e2 = B ⊕ D (degree 2)
e3 = A ⊕ C (degree 2)
e4 = C (degree 1)
e5 = A ⊕ B ⊕ C (degree 3)
e6 = B (degree 1)
Cascade:
1. e1 → A known.
2. XOR A from e3 → C known.
3. XOR A, C from e5 → B known.
4. XOR B from e2 → D known. All recovered!
Only 4 of 6 symbols needed — any sufficient subset works.
The Soliton distribution is critical: too many low-degree symbols wastes bandwidth; too many high-degree symbols stalls decoding. Luby's robust Soliton distribution ensures the cascade completes with minimal overhead.
Raptor Codes: Practical Fountain Codes
LT codes need some high-degree symbols for low overhead, making them O(K log K). Raptor codes (Luby and Shokrollahi) fix this: pre-code inputs with a conventional code (e.g., LDPC), then apply LT coding with a simpler, mostly low-degree distribution.
Fountain Codes in Practice
Fountain codes shine where feedback is impractical or impossible:
Broadcast/multicast: A satellite sends to millions of receivers with different packet loss. Each independently collects enough symbols — no feedback needed.
Content distribution: FLUTE uses Raptor codes to deliver files to receivers that join at different times or miss different packets.
Deep space: With 40-minute round trips, retransmission is not an option. Fountain codes enable one-way, guaranteed recovery.
DNA storage: You cannot control which DNA strands survive sequencing. The rateless property is a natural fit — recover data from whichever strands you read.
The Landscape of Modern Codes
The arc of progress across this series — from simple parity to provably optimal codes:
| Code | Year | Type | Decoding | Gap to Shannon | Primary Use |
|---|---|---|---|---|---|
| Hamming | 1950 | Block (algebraic) | Syndrome lookup | Large | ECC memory |
| Reed-Solomon | 1960 | Block (polynomial) | Berlekamp-Massey | Moderate | CDs, QR codes, deep space |
| Convolutional | 1955 | Stream | Viterbi (ML) | Moderate | Dial-up, early wireless |
| Turbo | 1993 | Concatenated | Iterative (BCJR) | < 1 dB | 3G/4G, deep space |
| LDPC | 1960/1996 | Sparse graph | Belief propagation | < 0.1 dB | Wi-Fi, DVB, 5G data |
| Polar | 2009 | Recursive transform | SC / SCL | 0 (proven) | 5G control channels |
| Fountain | 2002 | Rateless | Peeling / BP | N/A (rateless) | Broadcast, storage |
Early codes corrected a handful of errors with algebra. Modern codes exploit randomness, sparsity, and recursion to approach or achieve the fundamental limits.
Try It Yourself — LT Fountain Code
This demo simulates an LT fountain code with 4 input symbols. Encoded symbols are random XOR combinations. Collect them one at a time and run the peeling decoder — you don't need all of them, just enough.
Input Symbols
Encoded Stream
Each card shows an encoded symbol: the inputs it XORs together and its value. Grayed-out symbols have not arrived yet.
Collect & Decode
Key Takeaways
- Polar codes are the first proven to achieve Shannon capacity with efficient O(N log N) encoding and decoding.
- Channel polarization transforms N mediocre channels into nearly perfect and nearly useless ones. Send data on the good, frozen bits on the bad.
- SCL + CRC makes polar codes practical: keep L candidate paths, use a CRC to select the correct one.
- 5G uses polar codes for control channels and LDPC for data channels — each where it excels.
- Fountain codes are rateless: an unlimited stream of symbols, recoverable from any sufficient subset.
- Raptor codes achieve linear-time fountain coding and are standardized as RaptorQ (RFC 6330).
- From Hamming's 1950 single-error fix to Arıkan's 2009 optimality proof — the field moved from "fix one bit" to "transmit at the theoretical limit."
Along the way we saw Hamming turn frustration into the first error-correcting code, Reed and Solomon protect data with polynomials, Viterbi find the most likely path through a trellis, and Berrou shock the world with turbo codes. We saw Gallager's forgotten LDPC codes resurrected for Wi-Fi and deep space, and Arıkan prove what nobody before had: that efficient, optimal codes actually exist.
Error correction is, at its heart, about the cost of reliability. Shannon told us the price — the minimum redundancy needed to communicate through noise. Every code in this series is an attempt to pay exactly that price. The fact that we now can — provably, efficiently, in hardware running in billions of phones — is one of the great achievements of modern mathematics and engineering.