Polar codes
| Problem | Build codes that provably achieve the capacity of symmetric binary channels, with encoding and decoding |
| Devised by | Erdal Arıkan (2009); Ido Tal and Alexander Vardy (2011–15), list decoding |
| Accuracy | Capacity-achieving as ; at , rate 1/2, successive cancellation reaches a bit error rate of near 3 dB (figure below) |
| Cost | for encoding and for successive-cancellation decoding; the code construction costs |
| Read first | Low-density parity-check codes |
| API | PolarCode (new, encode, decode, decode_hard, info_positions, n, k) |
Overview
Shannon proved that every noisy channel has a capacity: a rate, in data bits per transmitted bit, below which communication can be made as reliable as desired. For sixty years no code was known that provably reached capacity with a practical decoder. Polar codes were the first, and the idea behind them is unusual.
Instead of spreading the noise evenly over all the data bits, a polar code redistributes it. A simple transformation is applied to uses of the channel. Seen by a decoder that recovers the input bits one at a time, in order, each input bit then has its own effective channel, called a bit channel. The transformation makes these polarise: most become either almost perfect or almost useless, and the fraction of nearly perfect ones tends to the capacity of the original channel as grows.
Coding is then simple. The data bits are sent on the most reliable bit channels. The others carry nothing: they are frozen to zeros that the decoder knows in advance. Encoding is a network of XORs with the same butterfly structure as the FFT, and successive-cancellation (SC) decoding walks the same network recursively. With list decoding, polar codes protect the control channels of 5G.
Where it is used
Polar codes are the newest codes in the book, and the first with a proof that they reach channel capacity.
- 5G control channels. The 3GPP 5G New Radio standard uses polar codes for the short control messages that tell a phone how to talk to the base station, where their performance at short block lengths is excellent.
- A bridge from theory to practice. They show how a mathematical result (channel polarisation) turns into an implementable encoder in , using the same butterfly structure as the FFT.
- Research. Because the construction is explicit, polar codes are a convenient test bed for ideas in cryptography and quantum communication.
History
Erdal Arıkan of Bilkent University introduced channel polarisation in 2009, building on his study of sequential decoding’s cutoff rate. He proved that polar codes with SC decoding achieve the capacity of any binary-input symmetric memoryless channel. At practical lengths SC decoding was weaker than LDPC or turbo decoding. Ido Tal and Alexander Vardy’s list decoding (2011, published 2015), with a CRC to pick from the list, closed the gap. In 2016 3GPP adopted polar codes for the 5G control channels.
The idea
The polarising transform
The channel. Everything can be seen on the simplest noisy channel, the binary erasure channel: each transmitted bit either arrives intact or, with probability , is erased and arrives as “unknown”. Its capacity is , the fraction of bits that get through.
One step. Take two independent uses of the channel and two input bits . Instead of sending them directly, send
The decoder recovers first and then .
- Deciding , with unknown. Since , both transmitted bits must arrive. is lost if either is erased, which has probability . This is a worse channel than the original; call it .
- Deciding , with now known. There are two ways to learn : directly, from , or from , as . It is lost only if both are erased, with probability . This is a better channel, .
With , the two bit channels have erasure probabilities 0.75 and 0.25. Nothing has been gained or lost overall: the capacities add up to , twice the original. In general, writing for the capacity of a channel , . The step has only moved reliability from one bit to the other.
Repeating. Apply the same step to two copies of and to two copies of , giving four bit channels, two of them more extreme than before; then again, and so on, times. At each level every channel splits into a worse and a better one. A channel that is already nearly perfect or nearly useless hardly changes, while those in the middle keep being pushed apart, so after many levels almost all have drifted to one extreme or the other.
In matrix form, one step is with over GF(2), and steps give , the -fold Kronecker power, computed by stages of XOR butterflies in operations. The library uses the natural order, without Arıkan’s bit-reversal permutation, so the first split decides the most significant bit of a channel’s index.
Choosing the frozen set
To build a code we must know which bit channels are the good ones. For the erasure channel the two formulas above give the answer exactly: starting from the erasure probability of the channel, each level replaces every value by the pair (for ) and (for ). After levels there are values, one per bit channel.
For other channels, such as the Gaussian channel, there is no such exact formula. The reliability of a channel is then measured by its Bhattacharyya parameter, a number between 0 (perfect) and 1 (useless) that bounds its error probability, and for which the same recursion gives upper bounds. The library designs a code by running the recursion from a chosen design erasure probability and freezing the channels with the largest values. A lower design value suits a higher signal-to-noise ratio.
Figure 19.7. Polarization.
Of the 1024 bit channels, 344 have erasure probability below 0.001 and 344 above 0.999; the capacity of the BEC(0.5) is 512 bits per 1024 uses. The rest of the channels are still in between at this length; polarisation is slow, which is why short polar codes need better decoders than SC.
Successive cancellation
The decoder mirrors the analysis: it decides the bits in index order, each using the channel outputs together with the decisions already made. It works with log-likelihood ratios (LLRs), positive for “probably 0”, and applies the two cases of the single step recursively. For a block of LLRs split into a first half and a second half (the LLRs of the and parts):
-
The worse channel first. The first half of the inputs was XORed into the first half of the outputs, so its LLRs are those of the XOR of the two halves,
The sign is that of an XOR, and the confidence is that of the weaker of the two inputs. (This is the min-sum form of the check-node rule of LDPC decoding.) Decode the first half recursively from these.
-
Then the better channel. Re-encode the decisions just made to get the bits that were XORed onto the first half. Each bit of the second half now has two independent observations, directly and with the known bit removed, and independent LLRs add:
Decode the second half recursively from these.
-
Return the re-encoded bits of both halves to the level above.
At the bottom of the recursion a single bit is decided: a frozen bit is set to zero whatever its LLR, and an information bit takes the sign of its LLR.
The weakness of SC decoding is that a decision, once made, is never revisited. A wrong early bit corrupts everything that follows. List decoders keep the most likely partial paths instead of one, and choose among them at the end, usually with the help of a checksum.
Figure 19.8. Polar BER.
The design matters: a code designed for a BEC(0.32), closer to the operating point, beats one designed for a BEC(0.5) at higher signal-to-noise ratios.
Algorithm
For a code of length with information bits.
Construction.
- Start with the single value , the design erasure probability.
- Repeat times: replace every value in the list by the pair and , in the order that matches the library’s indexing of the bit channels. The list now has values.
- The positions with the smallest values are the information positions; the rest are frozen.
Encoding.
- Put the information bits in the information positions of a block of bits, and zeros in the frozen positions.
- Apply the butterfly stages, one for each span (their order does not affect the result). In the stage with span , the block is divided into groups of bits, and in each group every bit of the first half is replaced by its XOR with the bit places further on: .
The cost is XORs.
Successive-cancellation decoding, from channel LLRs. decode(llrs, positions) returns
the re-encoded bits of the block:
- if the block has one bit: if its position is frozen, the bit is 0; otherwise it is 0 if the LLR is positive and 1 if not. Record it and return it;
- otherwise split the LLRs into halves and . Compute and call
decodeon it for the first half of the positions, obtaining the bits ; - compute , element by element, and call
decodeon it for the second half, obtaining the bits ; - return the block .
The decoded message is the recorded decisions at the information positions. The cost is .
Implementation
fn sc(&self, llr: &[f64], pos: &mut usize, u: &mut [u8]) -> Vec<u8> {
let n = llr.len();
if n == 1 {
let bit = if self.frozen[*pos] { 0 } else if llr[0] < 0.0 { 1 } else { 0 };
u[*pos] = bit;
*pos += 1;
return vec![bit];
}
let half = n / 2;
let f: Vec<f64> = (0..half)
.map(|i| {
let (a, b) = (llr[i], llr[i + half]);
a.signum() * b.signum() * a.abs().min(b.abs())
})
.collect();
let left = self.sc(&f, pos, u);
let g: Vec<f64> = (0..half)
.map(|i| llr[i + half] + if left[i] == 0 { llr[i] } else { -llr[i] })
.collect();
let right = self.sc(&g, pos, u);
let mut out = Vec::with_capacity(n);
out.extend(left.iter().zip(&right).map(|(l, r)| l ^ r));
out.extend(right);
out
}
- Lengths up to are supported; decoding takes soft LLRs or hard bits.
In practice
//! A polar code with successive-cancellation decoding.
use lib_jsl_information::forward_error_correction::PolarCode;
fn main() {
let code = PolarCode::new(3, 4, 0.5).unwrap();
println!("N = {}, k = {}: information on channels {:?}", code.n(), code.k(), code.info_positions());
let info = [1, 0, 1, 1];
let cw = code.encode(&info).unwrap();
println!("codeword {cw:?}");
let mut rx = cw.clone();
rx[0] ^= 1;
println!("one flipped bit, SC decoding: {:?}", code.decode_hard(&rx).unwrap());
let big = PolarCode::new(10, 512, 0.32).unwrap();
let info: Vec<u8> = (0..512).map(|i| (i % 3 == 0) as u8).collect();
let cw = big.encode(&info).unwrap();
// Soft input: every received value reliable except 40 erased (LLR 0) positions.
let llr: Vec<f64> = cw.iter().enumerate().map(|(i, &b)| if i % 25 == 7 { 0.0 } else if b == 0 { 3.0 } else { -3.0 }).collect();
println!("N = 1024, k = 512, 41 erasures: recovered {}", big.decode(&llr).unwrap() == info);
}
N = 8, k = 4: information on channels [3, 5, 6, 7]
codeword [1, 0, 1, 0, 0, 1, 0, 1]
one flipped bit, SC decoding: [1, 0, 1, 1]
N = 1024, k = 512, 41 erasures: recovered true
The (8, 4) polar code designed for a BEC(0.5) is the (8, 4) Reed-Muller code, with information on channels 3, 5, 6 and 7.
Strengths
- Provably capacity-achieving; explicit construction; simple encoder and decoder; any rate by choosing .
Weaknesses
- SC decoding is weak at short and moderate lengths, and sequential, so slow in hardware; list decoding (not provided here) is needed for competitive performance.
- The construction depends on the channel; the BEC design is an approximation for AWGN.
Exercises
- Show that for a BEC(), and are BECs with erasure probabilities and , and that capacity is conserved.
- Show that is its own inverse over GF(2).
- Verify that the (8, 4) polar code with information channels 3, 5, 6, 7 is the first-order Reed-Muller code.
- Count the operations of SC decoding and show that it is .
- Implement CRC-aided list decoding with and compare its error rate with SC’s.
Hints and answers
- For a BEC(), the combined bit (the ‘minus’ channel) is erased unless both outputs are received: erasure probability ; the ‘plus’ channel is erased only if both are: . The capacities add up to twice the original: conserved.
- Over GF(2), satisfies , and the Kronecker power satisfies .
- The rows of with indices 3, 5, 6, 7 (0-based, zero-indexed rows of weight at least 4) are those of weight 4 or 8, which span the first-order Reed-Muller code of length 8, dimension 4 and minimum distance 4.
- SC decoding evaluates levels of node operations each; the recursion is , which solves to .
- A list decoder keeps the best paths and selects, among those, the one that passes the CRC; compare the frame error rates at the same .
Further reading
- E. Arıkan, “Channel polarization: a method for constructing capacity-achieving codes for symmetric binary-input memoryless channels”, IEEE Transactions on Information Theory 55 (2009) 3051–3073.
- I. Tal and A. Vardy, “List decoding of polar codes”, IEEE Transactions on Information Theory 61 (2015) 2213–2226.
- E. Şaşoğlu, “Polarization and polar codes”, Foundations and Trends in Communications and Information Theory 8 (2012) 259–381.