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.

Historic achievement: Polar codes are the first (and so far only) family with a rigorous proof of achieving channel capacity, combined with O(N log N) encoding and decoding complexity. Arıkan's result was not just a good code — it was a theorem.

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:

The polarization kernel:
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.

Polarization in action:

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.
The polar coding strategy: Send data on the good channels. On the bad channels, send known values called frozen bits (typically zeros). The decoder knows which channels are reliable and which carry frozen values — this shared knowledge is what makes decoding possible.

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.

N = 8 — the butterfly structure:

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.

The 5G compromise:

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.

The fountain analogy: Filling a glass from a fountain — you don't care which drops you catch, just that you catch enough. No need to know the error rate in advance. No retransmission requests. Just keep sending until the receiver says "I have 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.

LT example — 4 input symbols (A, B, C, D):

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.

Why it works: The pre-code means the decoder need not recover every symbol from the LT layer — just enough for the pre-code to fill in the rest. Result: linear-time O(K) encoding and decoding. Standardized as RaptorQ (RFC 6330) and deployed worldwide.

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:

CodeYearTypeDecoding Gap to ShannonPrimary Use
Hamming1950Block (algebraic) Syndrome lookupLargeECC memory
Reed-Solomon1960Block (polynomial) Berlekamp-MasseyModerateCDs, QR codes, deep space
Convolutional1955Stream Viterbi (ML)ModerateDial-up, early wireless
Turbo1993Concatenated Iterative (BCJR)< 1 dB3G/4G, deep space
LDPC1960/1996Sparse graph Belief propagation< 0.1 dBWi-Fi, DVB, 5G data
Polar2009Recursive transform SC / SCL0 (proven)5G control channels
Fountain2002Rateless Peeling / BPN/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."
Series complete. From a single parity bit that tells you something went wrong, to polar codes that provably transmit at the maximum rate physics allows, and fountain codes that adapt to any channel without knowing its conditions.

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.