Decoding from Syndromes
A syndrome is a diagnosis, not a cure. Decoding is the classical step that turns the measured syndrome into a concrete recovery operation — which Pauli to apply, to which qubit, to undo the error. For small codes the decoder is a simple lookup table; for large codes it is a nontrivial algorithm in its own right.
The decoding problem
After syndrome extraction we hold a classical bitstring . Several different physical errors can produce the same syndrome, so the decoder must pick the most likely one. Under the standard assumption that errors are independent and rare, "most likely" means lowest weight — the fewest single-qubit faults consistent with . This is minimum-weight decoding.
The bit-flip lookup table
For the three-qubit bit-flip code the two stabilizers and give a 2-bit syndrome, and each single-qubit error maps to a distinct value:
The middle qubit participates in both parity checks, so flipping it trips both bits; the outer qubits each sit in only one check. The recovery is to apply to the named qubit, which exactly inverts the error.
Degeneracy and the limit
The table only covers errors of weight 0 or 1. A weight-2 error, say , produces the same syndrome as the single error . The minimum-weight decoder will "correct" it as , leaving — a logical error. This is unavoidable: a distance-3 code guarantees correction only up to one error. Pushing the residual logical error rate down requires a larger-distance code, which is the whole point of the families in the coming lessons.
Decoders for big codes
For the surface code the syndrome is a 2-D grid of parity checks, and minimum-weight decoding becomes a minimum-weight perfect matching problem on a graph — solvable in polynomial time, and the workhorse of today's experiments. The lookup-table idea you implement here is the same principle, just small enough to enumerate by hand.
Try it
Implement decode(s1, s2) returning the index of the qubit to flip (or for no error). The
grader feeds it the syndrome and checks that you return qubit .
When the decoder is correct the returned value is 1, matching the middle-qubit error that trips
both parity checks.
Sign in on the full site to ask questions and join the discussion.