Learning goals. After this module you should be able to
define a stabilizer code and read off and from its generators;
compute the syndrome of a Pauli error and build a lookup decoder;
draw an ancilla circuit that measures any Pauli check;
find logical operators as elements of the normalizer that are not in ;
define the distance and decide whether a set of errors is correctable;
explain degeneracy and why a decoder only needs the error up to a stabilizer;
work with the and codes, and state the quantum Hamming and Singleton bounds.
Module 2 showed that independent commuting Pauli generators fix a space of dimension . When that space can store quantum information. This module develops the theory of such stabilizer codes, which include every code in the rest of the course: the toric and surface codes, CSS codes and qLDPC codes are all special cases.
1. Stabilizer codes
Definition 3.1 (Stabilizer code).
Let be a stabilizer group (abelian, ) with independent generators. The stabilizer code of is its stabilized space
The generators are called checks (or stabilizer generators). The code is denoted , where is the distance defined in Section 5.
The dimension count is Theorem 2.1. The examples we already know fit the definition:
code
checks
bit-flip
3
2
1
phase-flip
3
2
1
4
2
2
Shor
9
8
1
Two features make stabilizer codes so convenient. First, a code on qubits is described by Pauli strings instead of a -dimensional subspace of a -dimensional space. Second, everything about errors (detecting, diagnosing, correcting) reduces to commutation, which we can check by counting clashes (Proposition 2.1).
2. Syndromes
Definition 3.2 (Syndrome).
The syndrome of a Pauli error with respect to checks is the bit string with
Proposition 3.1 (What a syndrome measurement sees).
Let and let be a Pauli error. Then is an eigenvector of every check, with . Measuring the checks therefore returns with certainty, without disturbing , and the outcome does not depend on the encoded state .
Proof
, using . The state is already an eigenvector of the measured operators, so the measurement leaves it unchanged. The eigenvalue involves only and .
The syndrome is additive: since commutation signs multiply, for any two Paulis. So we only need the syndromes of single-qubit errors to compute the syndrome of anything. For general errors that are superpositions of Paulis, the measurement projects onto one syndrome, exactly as in the digitization argument of Module 1.
A lookup-table decoder stores, for each of the syndromes, the lowest-weight Pauli with that syndrome, and on seeing applies . For the bit-flip code:
error
w.r.t.
The last two rows have trivial syndrome but are not harmless: flips the logical phase and swaps the codewords. Understanding such operators is the subject of Section 4.
3. Measuring a check: syndrome-extraction circuits
How do we measure a multi-qubit Pauli without measuring its individual factors? With one ancilla:
prepare the ancilla in and apply , giving ;
for each qubit in the support of , apply a controlled- gate with the ancilla as control (a CNOT for , a for , a controlled- for );
apply to the ancilla and measure it in the basis.
Why it works: after step 2 the joint state is . After the final it is . So outcome projects the data onto the eigenspace of and outcome onto the eigenspace. That is exactly a measurement of , with .
q1q2q3q4q5a: |0>HXZZXHMoutcome s1Figure 3.1. Measuring the first check XZZXI of the five-qubit code with one ancilla. Each box is a Pauli applied to a data qubit, controlled on the ancilla. The ancilla reads 0 for eigenvalue +1 and 1 for eigenvalue -1.
Special cases you will see constantly:
-type checks (like ): equivalently, ancilla in , CNOTs from each data qubit onto the ancilla, measure . This is the circuit of Module 1.
-type checks (like ): ancilla in , CNOTs from the ancilla onto each data qubit, measure .
We simulated these circuits in Stim. For the five-qubit code of Section 7, measuring all four checks after an on qubit 1, a on qubit 3, a on qubit 3, or the pair gives the deterministic ancilla outcomes , , and , matching the commutation syndromes computed by hand.
The circuit above assumes perfect gates. In reality the ancilla and the CNOTs fail too, and a single fault on the ancilla can spread to several data qubits. Handling this is the topic of fault tolerance; we meet it for the surface code in Module 8 and Module 9.
4. The normalizer and logical operators
Errors with trivial syndrome commute with every check. Some of them are harmless (they act as the identity on ); others act nontrivially inside the code.
Definition 3.3 (Normalizer and logical operators).
The normalizer of is the set of Paulis that commute with every element of ,
(For subgroups of the Pauli group the normalizer and the centralizer coincide, since and for .) A logical operator is an element of that is not in , i.e. not a stabilizer up to a phase.
Proposition 3.2 (Every Pauli is harmless, logical, or detectable).
Let be the projector onto . For a Pauli exactly one of the following holds:
: acts on as a phase times the identity (harmless).
: maps to itself and acts as a nontrivial unitary on it (logical error, invisible to the checks).
: , so moves every code state to an orthogonal syndrome space (detectable, ).
Proof sketch
Case 1 is immediate. In case 3, anticommutes with some , and using ,
, so . In case 2, commutes with every , hence with , so it preserves . If it acted as on , then would still stabilize , but it has one more independent generator, so by Theorem 2.1 its stabilized space would be only half as large, a contradiction.
all Pauli strings (4^n mod phase)N(S): commutes with every checkSharmlessN(S) minus Slogical erroroutside N(S)detectedsyndrome != 0Figure 3.2. The three kinds of Pauli error for a stabilizer code. Only the middle box is dangerous: those errors change the encoded information without leaving a trace in the syndrome.
How many logical operators are there? Modulo phases, each independent check cuts the number of commuting strings in half (Homework 2, Problem 2), so
The classes are exactly the -qubit Pauli group modulo phases: one can choose logical operators such that and anticommute and every other pair commutes, just like and on bare qubits. Putting the pieces together, every Pauli string factors as (syndrome representative) (logical) (stabilizer), and the count works out: .
Example 3.1 (Logical operators of the bit-flip code).
For (, ) there are strings commuting with both checks (we listed them in Homework 2). Four of them form ; the other twelve are logical. Choose
They anticommute (one clash), as a logical and must. Multiplying by stabilizers gives other representatives of the same logical operator, e.g. . The lowest-weight logical has weight , which is why this code has distance .
5. Distance and the correction condition
Definition 3.4 (Distance).
The distance of a stabilizer code is the minimum weight of a logical operator:
A code with these parameters is an code.
Note what the distance is not: it is not the minimum weight of a stabilizer (Shor’s code has weight-2 stabilizers and distance 3), and it is not the minimum weight of an operator with trivial syndrome.
The Knill-Laflamme condition (Theorem 1.2) becomes a clean algebraic statement for stabilizer codes.
Theorem 3.1 (Correctable Pauli errors).
A set of Pauli errors is correctable by the stabilizer code if and only if for every pair ,
that is, is either detectable or harmless. In particular a code of distance corrects every error of weight at most , and detects every nontrivial error of weight at most .
Proof
By Proposition 3.2, equals if is detectable and if it is harmless; in both cases the Knill-Laflamme condition of Theorem 1.2 holds for this pair. If is a logical error, is a nontrivial operator on , not a multiple of , and the condition fails. For the distance statement: if then , so it cannot be a logical operator.
The proof also tells us how to decode. Measure and apply for some guess with . The net operator has trivial syndrome, so it is in , and
if , the correction succeeded (even if !);
if is a logical operator, we have caused a logical error.
6. Degeneracy
Definition 3.5 (Degenerate code).
A code is degenerate (with respect to errors of weight ) if two distinct correctable errors have , i.e. they act identically on the code. Equivalently, contains a non-identity element of weight . A code that is not degenerate is called pure or nondegenerate.
Classical codes are never degenerate: if two error patterns are different, they are different. In Shor’s code, and are distinct but , so they have the same syndrome and the same effect, and the decoder does not care which one happened. For decoding, the right object is the coset of all errors equivalent to :
errors in the same coset are equivalent (no need to distinguish them);
errors in cosets that differ by a logical operator must be told apart, and the syndrome cannot do it.
So the job of a decoder is to find the most likely coset given the syndrome, not the most likely error. For highly degenerate codes, such as the surface code where stabilizers are small loops and logical operators are long strings, the difference matters a lot. We return to this in Module 7 (where errors differing by a stabilizer are “homologous” strings) and Module 10 (maximum-likelihood versus minimum-weight decoding).
7. The five-qubit code
The smallest code that corrects an arbitrary single-qubit error has five qubits. Its checks are the four cyclic shifts
Example 3.2 (The perfect five-qubit code).
Validity. Every pair of checks clashes in exactly two positions, so they commute. The fifth cyclic shift is not new: . The four checks are independent, so .
Syndromes. Using clash counting, the syndromes of all single-qubit errors are
qubit
1
2
3
4
5
0001
1000
1100
0110
0011
1010
0101
0010
1001
0100
1011
1101
1110
1111
0111
All 15 are distinct and non-zero (each entry is the sum of the and entries, by additivity). Together with “no error” they use up all syndromes. The code wastes nothing: it is perfect.
Logical operators. and commute with every check (each clashes with each check in two positions), anticommute with each other (five clashes), and are not in (every non-identity stabilizer has weight exactly 4). Multiplying by stabilizers gives lighter representatives: , so also acts as (here with sign ).
Distance. A brute-force search over all strings finds elements of modulo phase, of which are logical: of weight 3 and of weight 5, none lighter. So and this is a code. One weight-3 logical is .
The code is not CSS. Its checks mix and , and no choice of generators separates them into purely -type and purely -type checks. So and errors cannot be decoded separately, unlike the codes of Module 4.
What happens with a two-qubit error? Take . Its syndrome is , the syndrome of . The lookup decoder applies , leaving , which has trivial syndrome but is not a stabilizer: it is one of the 30 weight-3 logical operators. A distance-3 code fails on (some) weight-2 errors, as Theorem 3.1 predicts.
8. The Steane code
The second classic example is built from the classical Hamming code, whose parity-check matrix has the binary numbers as its columns:
Example 3.3 (The Steane code).
Use each row of twice, once as an -check and once as a -check:
Any -check and -check overlap on an even number of qubits ( or ), so all six commute; they are independent, so . An error flips exactly the -checks whose row has a in column , so its -check syndrome, read as a binary number (first row = least significant bit), is. The same holds for and the -checks. All 21 single-qubit errors have distinct syndromes.
Logical operators can be taken as and ; multiplying by stabilizers gives weight-3 representatives such as . A brute-force search confirms : the Steane code is a code.
The Steane code uses two more qubits than the five-qubit code, but its checks split into an part and a part. That structure, the CSS construction, is the subject of Module 4, and it is shared by the surface code and essentially all qLDPC codes.
9. How good can a code be?
How small can be for given and ? Two bounds are standard; we state them without proof.
Theorem 3.2 (Quantum Hamming and Singleton bounds).
Quantum Hamming bound. A nondegenerate code satisfies
Quantum Singleton bound. Every code with , degenerate or not, satisfies
The Hamming bound is a counting argument: each of the errors of weight at most needs its own syndrome, and there are syndromes. (For degenerate codes, distinct errors may share a syndrome harmlessly, and the argument does not apply as stated.) The Singleton bound is proved with entropy inequalities, or with the no-cloning theorem: a code would let us recover the logical qubit from either half of the qubits, cloning it.
code
Hamming: vs
Singleton: vs
(tight)
(tight)
(Shor, degenerate)
()
(tight)
For , the Hamming bound reads , which first holds at ; the Singleton bound gives for all codes. So the five-qubit code is optimal, and no code exists.
These bounds are about small codes. For large codes the relevant question is how and scale with . The surface code has and ; good qLDPC codes achieve and with bounded-weight checks (Module 12).
Summary
A stabilizer code (Definition 3.1) is the joint eigenspace of independent commuting checks; it encodes qubits.
The syndrome (Definition 3.2) records which checks anticommute with ; it is additive, independent of the encoded state, and measured by ancilla circuits (Proposition 3.1).
D. Gottesman, Stabilizer Codes and Quantum Error Correction, PhD thesis (1997), arXiv:quant-ph/9705052, Chapters 3-4.
D. Gottesman, “An introduction to quantum error correction and fault-tolerant quantum computation” (2009), arXiv:0904.2557.
J. Preskill, Lecture Notes for Physics 219, Chapter 7, Sections 7.8-7.10 (bounds, stabilizer codes, the five-qubit code; uses a real- convention, so signs differ).
R. Laflamme, C. Miquel, J. P. Paz, W. H. Zurek, “Perfect quantum error correcting code”, Phys. Rev. Lett. 77, 198 (1996), arXiv:quant-ph/9602019; C. H. Bennett, D. P. DiVincenzo, J. A. Smolin, W. K. Wootters, arXiv:quant-ph/9604024.
A. M. Steane, “Error correcting codes in quantum theory”, Phys. Rev. Lett. 77, 793 (1996).
M2 ICFP Quantum Information Theory, QEC Lecture 2: the stabilizer formalism (2021-22); P. Faist, Quantum Error Correction lecture notes, Sections 4.2-4.4.