Level 4 · Hardware & Fault Tolerance

Quantum Error Correction

About 5,718 words · roughly 26 minute read · sources checked December 2, 2026

Quantum information is fragile. A qubit left alone loses its state in microseconds to seconds, and every gate adds a little error. Without a way to correct errors, a quantum computer could run only short circuits before the answer turned to noise. Quantum error correction is the idea that makes long computations possible in principle: spread one logical qubit across many physical qubits, keep checking for errors without looking at the data, and fix them as they appear.

This lesson builds the idea from the ground up. We start with the classical repetition code, see why it cannot be copied directly into the quantum world, and then build the three-qubit code that can. From there we reach stabilizers, the famous Shor and Steane codes, and the surface code that most hardware roadmaps use. We then look at the threshold theorem, which says when error correction wins, and at what Google’s 2024 experiment actually measured, with the real numbers from the paper.

You should know the material of Level 2 on gates and measurement and Level 3 on algorithms. The cost estimates for Shor’s algorithm in the previous lesson used the numbers developed here, and this lesson shows where they come from.

What you will learn

  • Why copying is impossible and what replaces it: encoding in entanglement and measuring parities.
  • The three-qubit bit-flip code, its syndrome table, and its exact failure rate.
  • Why continuous errors become discrete ones when you measure a syndrome.
  • Stabilizers, the [[n, k, d]] notation, and the Shor and Steane codes.
  • The surface code: its layout, its qubit count 2d² − 1, and the scaling law with Λ.
  • The threshold theorem and the concatenation recursion, with numbers.
  • What the Google below-threshold experiment measured and what it did not show.
  • Why logical gates, magic states and decoding are the hard engineering problems.

Helpful first: Quantum Gates, Quantum Algorithms, Shor’s Algorithm.

The problem and the classical idea

A classical computer handles errors with redundancy. To protect one bit, store it three times. If one copy flips, the majority still gives the right answer. This is the repetition code, and it works because bits can be copied and read freely.

Worked example

How much does classical repetition help?

  1. Suppose each copy flips independently with probability p. The majority vote is wrong only if at least two of three copies flip.
  2. P(fail) = 3p²(1 − p) + p³ = 3p² − 2p³.
  3. For p = 0.01 this is 3(0.0001) − 2(0.000001) = 0.000298, about 3 × 10⁻⁴. The error has dropped by a factor of about 34.
  4. For p = 0.1 it is 0.028, a drop of only 3.6. For p = 0.5 the code gives 0.5, no improvement at all. Repetition helps only when p is small, and it helps more the smaller p is, because the failure rate scales as p².

Three things look like they stop us from doing the same with qubits.

  1. No cloning. You cannot copy an unknown state α|0⟩ + β|1⟩ into three copies. The theorem from Level 1 forbids it.
  2. Continuous errors. A classical bit either flips or does not. A qubit can drift by any small angle, so there seem to be infinitely many errors to correct.
  3. Measurement destroys superposition. Reading the three copies to take a majority vote would collapse the state we are trying to protect.

Error correction exists because each of these has a workaround. Instead of copying the state, we spread it over several qubits by entanglement. Instead of reading the data, we measure only parities between qubits, which reveal where an error is without revealing the encoded value. And the continuous errors turn out to collapse to a small discrete set when the parities are measured.

The three-qubit bit-flip code

Encode a logical qubit as |0_L⟩ = |000⟩ and |1_L⟩ = |111⟩. A general state α|0⟩ + β|1⟩ becomes α|000⟩ + β|111⟩. This is not three copies of the state, which would be (α|0⟩ + β|1⟩)⊗3. It is an entangled state, made by two CNOTs from the first qubit onto the other two, and it does not violate no-cloning.

To detect a bit flip we use two ancilla qubits. The first ancilla measures the parity of data qubits 1 and 2 (their XOR), and the second measures the parity of data qubits 2 and 3. In the stabilizer language, these are the operators Z₁Z₂ and Z₂Z₃. The pair of outcomes is the syndrome.

data 1data 2data 3anc 1anc 2Syndrome (anc 1, anc 2)0 0no error1 0flip on data 11 1flip on data 20 1flip on data 3Ancillas learn parities, never the data values themselves.
Two ancillas read the parities of neighbouring data qubits. The data values are never measured.
Error onParity 1 and 2Parity 2 and 3SyndromeCorrection
Nonesamesame0 0none
Data 1differentsame1 0flip data 1
Data 2differentdifferent1 1flip data 2
Data 3samedifferent0 1flip data 3

Each single bit flip gives a different syndrome, so it can be located and undone.

Worked example

A flip on the middle qubit

  1. The encoded state is α|000⟩ + β|111⟩. Suppose an X error hits data qubit 2, giving α|010⟩ + β|101⟩.
  2. Parity of qubits 1 and 2: in |010⟩ they differ, in |101⟩ they also differ. Both terms give parity 1, so the measurement returns 1 with certainty and does not distinguish the two terms.
  3. Parity of qubits 2 and 3: in |010⟩ they differ, in |101⟩ they also differ. Again both terms give 1.
  4. The syndrome is 1 1, which points to data qubit 2. Apply X to qubit 2 to restore α|000⟩ + β|111⟩.
  5. The crucial point: both terms of the superposition gave the same syndrome, so the measurement did not collapse the superposition. The coefficients α and β survive untouched. This is how parity measurement avoids destroying the data.

How well does it work?

The code fails when two or more qubits flip, because then the syndrome points to the wrong qubit and the correction adds an error instead of removing one. The probability is the same as for the classical code: 3p² − 2p³ for p the flip probability per qubit. For p = 0.01 that is about 3 × 10⁻⁴, an improvement by a factor of 34. This is the first example of the pattern that runs through the whole subject: the logical error rate scales as a higher power of the physical error rate, so it wins when the physical rate is small.

What this code cannot do

It protects only against bit flips (X errors). A phase flip (Z error) on any qubit changes α|000⟩ + β|111⟩ into α|000⟩ − β|111⟩ and leaves both parities unchanged, so it goes unnoticed. A full quantum code must handle both kinds of error at once.

Run this circuit

Three-qubit bit-flip code: error on qubit 1

q0q1q2XX

Bit order: q0 is the rightmost digit of each result, as in Qiskit. All qubits start in |0⟩ unless marked. This is an ideal simulator with no hardware noise.

Predict first: The logical |1⟩ is encoded as 111, then an X error hits qubit 1. After decoding with CNOTs and a Toffoli, is qubit 0 still 1?

Press Run to simulate. Results appear here with a short explanation.

Run this circuit

Three-qubit bit-flip code: two errors

q0q1q2XXX

Bit order: q0 is the rightmost digit of each result, as in Qiskit. All qubits start in |0⟩ unless marked. This is an ideal simulator with no hardware noise.

Predict first: Now two qubits (1 and 2) are flipped. The code only promises to fix one error. What happens to qubit 0?

Press Run to simulate. Results appear here with a short explanation.

Why continuous errors become discrete

Real errors are rarely clean flips. A control pulse that is slightly too strong rotates the qubit by a small extra angle. Does that mean we need to correct a continuum?

No. Any single-qubit error can be written as a combination of the four Pauli operators I, X, Y, Z, because those four matrices span all 2 × 2 matrices. Suppose a small rotation error acts on one qubit of the code state. Then the state becomes a superposition of the unaffected state and the state with an X error:

e^(−iεX) = cos ε · I − i sin ε · X

When we measure the syndrome, the superposition collapses. With probability cos²ε the syndrome says no error and the state is untouched. With probability sin²ε the syndrome says X error, and the correction then removes it exactly. Either way the data ends up correct. The continuous error has been digitised by the measurement.

Worked example

A small over-rotation

  1. Take ε = 0.1 radians on one qubit of the three-qubit code.
  2. The probability that the syndrome reports an X error is sin²(0.1) = 0.00997, about 1%.
  3. With probability 0.99 the syndrome reports nothing and the state is exactly as it was before the error,. The coherent over-rotation has been turned into an incoherent 1% bit-flip chance.
  4. That 1% is now the quantity that matters, and it is exactly the type of error the code handles. Note the effect: the error probability is ε² (about 0.01), not ε (0.1). Digitisation helps by squaring a small angle.

This is why quantum error correction needs to handle only a finite list of error types on a finite number of qubits. A code that corrects all single-qubit errors (X, Y and Z on any one qubit) automatically corrects arbitrary single-qubit errors, however they arose.

Phase flips, and the first full quantum codes

A Hadamard gate swaps the roles of X and Z, so a bit flip in the Hadamard basis is a phase flip in the ordinary basis. That gives a direct way to protect against phase flips: use the same three-qubit structure, but encode in the |+⟩, |−⟩ basis. Define |0_L⟩ = |+++⟩ and |1_L⟩ = |−−−⟩. Now a Z error flips |+⟩ and |−⟩, and parity checks in the X basis (the operators X₁X₂ and X₂X₃) locate it, exactly as before.

Peter Shor combined the two ideas in 1995 into a nine-qubit code. Take each of the three qubits of the phase-flip code and replace it with a three-qubit bit-flip code. The inner codes catch bit flips, the outer code catches phase flips, and because a Y error is a combined X and Z, it is caught as well. The result protects one logical qubit against an arbitrary error on any single physical qubit. This was the discovery that error correction is possible at all in the quantum setting.

Andrew Steane found a smaller code in 1996. It uses 7 qubits and is built from the classical Hamming code, which is a classical code that corrects any single bit flip in 7 bits using 3 parity checks.

The Steane code in detail

The Hamming parity-check matrix has the numbers 1 to 7 written in binary as its columns:

H = [ 0 0 0 1 1 1 1 ]
    [ 0 1 1 0 0 1 1 ]
    [ 1 0 1 0 1 0 1 ]
Column j is the number j in binary. I checked that H·Hᵀ = 0 mod 2 and that the smallest non-zero codeword has weight 3.

The Steane code measures three X-type checks and three Z-type checks, each built from a row of H. The three Z-type measurements detect bit flips and the three X-type measurements detect phase flips. Because H·Hᵀ = 0, every X-check commutes with every Z-check, which is the condition that all six can be measured together without disturbing each other.

Worked example

Locating an error in the Steane code

  1. Suppose an X error strikes qubit 5. The three Z-type check outcomes form the syndrome.
  2. The syndrome equals the column of H for qubit 5, which is 101 (reading the three rows top to bottom).
  3. 101 in binary is 5, so the syndrome literally spells out the position of the faulty qubit. For qubit 3 it would be 011, for qubit 7 it would be 111, and 000 means no error.
  4. A phase flip on qubit 5 is found the same way using the X-type checks. A Y error is both, so both syndromes are non-zero and both point to qubit 5.

The notation [[n, k, d]]

A quantum code is described by three numbers: n physical qubits, k logical qubits, and distance d. The distance is the smallest number of physical qubits on which an error can act and change the logical state without being detected. A code with distance d detects up to d − 1 errors and corrects up to ⌊(d − 1)/2⌋ of them.

Code[[n, k, d]]CorrectsComment
Three-qubit bit-flipdistance 3 against X, 1 against Zone X errorNot a full quantum code
Shor[[9, 1, 3]]any single-qubit errorFirst quantum code, 1995
Steane[[7, 1, 3]]any single-qubit errorFrom the classical Hamming code
Surface, distance d[[d², 1, d]]up to ⌊(d − 1)/2⌋ errorsPlus d² − 1 measure qubits

Counts of data qubits only; the surface code also needs measure qubits.

Distance 3 means one error is corrected. Two errors on the right pair of qubits fool the code, which is why distance must grow for harder tasks. The aim is a family of codes where the distance can be raised, and the logical error rate falls rapidly as it is.

Stabilizers: the compact language

Writing down code states and syndromes by hand does not scale. The stabilizer formalism does. A stabilizer code is defined by a list of commuting Pauli operators, the stabilizers. The code space is the set of states that every stabilizer leaves unchanged, meaning each has eigenvalue +1. The three-qubit bit-flip code has stabilizers Z₁Z₂ and Z₂Z₃. The state α|000⟩ + β|111⟩ is in the +1 eigenspace of both.

An error that anticommutes with a stabilizer flips that stabilizer’s measured value from +1 to −1. The list of flipped stabilizers is the syndrome. A good code has the property that different likely errors give different syndromes, so that a decoder can infer what happened.

  • Measuring a stabilizer reveals whether an error occurred, not what the logical state is, so the encoded information is not disturbed.
  • n physical qubits with n − k independent stabilizers leave a code space of dimension 2ᵏ, so k logical qubits. For the Steane code, 6 stabilizers on 7 qubits leave 2¹.
  • Logical operators commute with all stabilizers but are not in their group. They act on the encoded qubit. The distance is the weight of the lightest logical operator.

Why this matters

Almost every practical code, including the surface code, is a stabilizer code. A computer measures the stabilizers over and over, and everything that follows is about how fast and how accurately it can do so.

The surface code

The surface code is the leading candidate for real machines because it needs only a flat grid of qubits with nearest-neighbour interactions and has a high error threshold. It was developed through work including Kitaev’s toric code and the 2012 paper by Fowler, Mariantoni, Martinis and Cleland, whose abstract I opened: it describes surface codes on a two-dimensional array of physical qubits and estimates the size and speed of a surface code quantum computer.

In the layout shown below, data qubits sit on the vertices of a grid, and measure qubits sit in the middle of each square. Each measure qubit checks the four data qubits around it (two at the boundary). There are two kinds of checks. Z-type checks detect bit flips. X-type checks detect phase flips. They alternate like a checkerboard.

data qubit (9)Z check (4)X check (4)Each check circle is ameasure qubit: 9 + 8 = 17.General distance d: d² data qubits and d² − 1 checks, so 2d² − 1 qubits.
Distance 3: nine data qubits, eight checks. Each check measures the parity of its neighbouring data qubits.

Every cycle, all the checks are measured, and the results are compared with the previous cycle. A change in a check’s value signals an error nearby. A single error flips one or two neighbouring checks. A chain of errors flips the checks only at its two ends, which is the key to the code: an error chain is invisible in its interior and shows up only at its endpoints. Decoding means looking at all the flipped checks over time and finding the most likely set of error chains that explains them.

Worked example

Counting qubits in a surface code patch

  1. A distance-d patch has d × d data qubits and d² − 1 measure qubits.
  2. d = 3: 9 + 8 = 17 qubits. d = 5: 25 + 24 = 49. d = 7: 49 + 48 = 97. d = 11: 121 + 120 = 241.
  3. In general the total is 2d² − 1. One logical qubit therefore costs about 2d² physical qubits.
  4. Google’s distance-7 experiment used a 105-qubit chip. The paper describes 49 data qubits and 48 measure qubits, which is 97, plus 4 qubits used to remove leakage, so 101 qubits in all. The arithmetic matches 2d² − 1 = 97.

How the logical error rate falls

A logical error happens when an error chain stretches all the way across the patch, which takes at least (d + 1)/2 errors to fool the decoder. If the physical error rate is well below the threshold, each increase of the distance by 2 reduces the logical error rate by a fixed factor Λ:

ε_d ≈ C / Λ^((d + 1)/2)      so      ε_(d+2) = ε_d / Λ

The number Λ (Greek capital lambda) is the error suppression factor. If Λ is larger than 1, adding more qubits helps, and every step up in distance wins a factor Λ. If Λ is below 1, adding qubits makes things worse. Λ = 1 is the break-even point, which is why Λ greater than 1 is the signature of operating below threshold.

The threshold theorem

Error correction is itself made of noisy gates. Every syndrome measurement can introduce new errors. So the real question is whether correcting errors with imperfect operations can ever come out ahead. The answer, proved in the 1990s by several groups, is the threshold theorem: if the physical error rate per operation is below a certain threshold, then arbitrarily long computations can be done reliably, with only a modest overhead in the number of qubits and time. Above the threshold, correction creates errors faster than it removes them.

The simplest way to see the logic is concatenation. Encode each qubit in a code. Then encode each of those qubits again in the same code, and so on. If a code at one level turns an error rate p into roughly p_th·(p/p_th)², then each level squares the ratio p/p_th. Starting below threshold, the ratio shrinks doubly exponentially with the number of levels.

Worked example

A concatenation recursion with a toy threshold

  1. Take an illustrative threshold p_th = 1% and a physical error rate p = 0.1%, so p/p_th = 0.1. This is an assumed number for illustration, not a measured threshold of any specific code.
  2. Level 1: p₁ = p_th (p/p_th)² = 10⁻² × (0.1)² = 10⁻⁴.
  3. Level 2: p₂ = 10⁻² × (10⁻⁴/10⁻²)² = 10⁻² × 10⁻⁴ = 10⁻⁶.
  4. Level 3: p₃ = 10⁻² × (10⁻⁶/10⁻²)² = 10⁻² × 10⁻⁸ = 10⁻¹⁰.
  5. Each level costs a constant factor more qubits (for a 7-qubit code, about 7 times), so three levels need about 7³ = 343 physical qubits per logical qubit. The error rate fell by a factor of 10 million.
  6. Now start above threshold, say p = 2%. Then p/p_th = 2 and level 1 gives 10⁻² × 4 = 4%, which is worse than before. Each further level makes it worse. The same recursion that gives doubly exponential improvement below threshold gives doubly exponential blow-up above it.

The surface code does not concatenate, but it behaves the same way: the logical error rate falls exponentially with the distance d if the physical rate is below its threshold, and a rule of thumb is that Λ is about the ratio of the threshold to the physical error rate. Published numerical estimates of the surface-code threshold are around 1% for circuit noise under favourable assumptions, which is why 10⁻³ is the standard working number. I did not find a specific threshold value on the abstract page of the Fowler paper, so treat the 1% as an approximate figure from the literature rather than one I verified here.

The practical reading

Below threshold, you can trade qubits for reliability at a favourable exchange rate. Above it, you cannot. The goal of hardware work in the last decade has been to get every operation below threshold at the same time: single-qubit gates, two-qubit gates, measurement and reset.

What Google measured below threshold

In 2024 Google Quantum AI published an experiment, “Quantum error correction below the surface code threshold” (arXiv 2408.13687), that is the clearest demonstration so far of the scaling law above. I opened the paper and the numbers below are as stated in it.

QuantityValue reported
Processor for the largest code105 qubits; distance-7 code using 101 of them
Processor for real-time decoding72 qubits; distance-5 code
Surface code cycle time1.1 µs
Logical error per cycle at d = 70.143% ± 0.003% (neural-network decoder)
Same, ensembled matching decoder0.171% ± 0.003%
Error suppression factor Λ2.14 ± 0.02 (neural network), 2.04 ± 0.02 (matching)
Logical lifetime at d = 7291 ± 6 µs
Best single physical qubit lifetime119 ± 13 µs (median 85 ± 7 µs)
Real-time decoder latency, d = 563 ± 17 µs average, stable to 10⁶ cycles
Repetition code Λ, distances up to 298.4 ± 0.1; error floor about 10⁻¹⁰

From the paper’s abstract and results as retrieved.

1e-31e-61e-91e-12371115192327measured d = 7Λ = 2.14Λ = 4Λ = 10code distance dlogical error per cycleOnly Λ = 2.14 is measured; the other lines are hypothetical.
The measured point at d = 7 and what different values of Λ would imply. Only Λ = 2.14 is measured.

What this shows

  • Each step up in distance, from 3 to 5 to 7, reduced the logical error by about a factor of two (Λ ≈ 2). Adding qubits made the memory better, which is exactly what below threshold means. Earlier experiments had shown error correction working but had not shown the logical error falling consistently as the code grew.
  • The distance-7 logical qubit lived 291 µs against 119 µs for the best physical qubit on the chip, a ratio of 2.4 ± 0.3. This is called beyond break-even: the encoded qubit outlasts every one of its parts. I confirm the ratio: 291/119 = 2.45.
  • The decoder kept up in real time at distance 5, with an average latency of 63 µs per the paper, so that decoding did not pile up a backlog over a million cycles (about 1.1 seconds of experiment).

What it does not show

  • It is a quantum memory. The experiment keeps a logical qubit alive. It does not run logic gates between logical qubits or a computation on them.
  • Λ of about 2 is far from the larger values that large machines will need. A logical error of 10⁻³ per cycle is far from the 10⁻¹² or so that long algorithms need.
  • The best neural-network decoder was run offline and was far slower than real time (24 µs per cycle against the 1.1 µs cycle), whereas the real-time decoder used simpler methods and had a somewhat worse logical error (0.35% at d = 5 against 0.269%).
  • The repetition code reached an error floor near 10⁻¹⁰, traced in the paper to rare correlated error bursts roughly once an hour. Rare events like these limit how low logical error rates can go on current devices.

Worked example

From the measured Λ to a qubit bill

  1. Anchor on the measured point: ε₇ = 1.43 × 10⁻³ per cycle at d = 7, and Λ = 2.14. Each step of 2 in distance divides the error by Λ.
  2. Implied errors: d = 9: 6.7 × 10⁻⁴. d = 11: 3.1 × 10⁻⁴. d = 13: 1.5 × 10⁻⁴. For comparison going down from d = 7: d = 5 would be about 3.1 × 10⁻³, in the same range as the 0.27% to 0.35% the paper reports at d = 5.
  3. To reach 10⁻¹² per cycle we need ε₇ / Λ^((d − 7)/2) = 10⁻¹², so (d − 7)/2 = ln(1.43 × 10⁹)/ln 2.14 = 27.7, giving d ≈ 62.4, so d = 63. Qubits per logical qubit: 2 × 63² − 1 = 7,937.
  4. If Λ were 4, the needed distance would be 37.4, round up to the odd value 39, costing 3,041 qubits. If Λ were 10, it would be 25.3, round up to 27, costing 1,457 qubits. If Λ = 2, d = 69 and 9,521 qubits.
  5. So the same target costs 1,457 qubits per logical qubit at Λ = 10 and 7,937 at Λ = 2.14, a factor of 5.4. This is why hardware progress that raises Λ matters so much. These are extrapolations of an idealised scaling law, not predictions of what a real device will do.

The value 1,457 is the figure that appears in the previous lesson’s Shor error budget, where a distance of 27 and about 1,458 physical qubits per logical qubit came from assuming a physical error of 10⁻³ and a threshold near 1%, which corresponds to Λ of about 10. Today’s measured Λ is much smaller, so the gap between the assumption and the hardware is a real one.

Doing computation on encoded qubits

Keeping a qubit alive is the easy half. A computer must also apply gates to logical qubits without exposing them to uncorrected errors. This is where most of the complexity of fault-tolerant design lives.

Transversal gates and their limit

The simplest way to apply a logical gate is to apply the physical gate to each qubit of the code separately, a transversal gate. A single error then cannot spread through the block, because each physical gate touches only one qubit from each block. For the Steane code, the Hadamard, the S gate and the CNOT are all transversal. But a known result, the Eastin–Knill theorem, says that no code can implement a universal set of gates transversally. At least one gate in a universal set must be done another way. I give this as the standard statement; I did not reopen the paper.

Lattice surgery for Clifford operations

In the surface code, two-qubit gates are done by merging and splitting patches of lattice. Two logical qubits sit as neighbouring patches, and temporarily measuring the checks across the boundary joins them, which implements a measurement of a joint logical operator. Sequences of these merges and splits perform CNOT gates and other Clifford operations using only the nearest-neighbour measurements the hardware already does. The cost is time and space on the chip, not any new kind of hardware.

The T gate and magic states

Clifford gates alone can be simulated efficiently on a classical computer, so a quantum advantage needs a non-Clifford gate such as T. In the surface code the T gate is performed by consuming a special resource state, a magic state, prepared separately. A raw magic state is noisy, so it is purified by distillation: many noisy copies go in, fewer, cleaner copies come out. Distillation factories can occupy a large share of the machine.

Gidney’s 2025 factoring estimate that we used earlier credits a technique called magic state cultivation among its savings, which makes cleaner magic states more cheaply than distillation. That is one of the reasons the estimate for breaking RSA-2048 fell from about 20 million qubits (Gidney and Ekerå, 2019) to under one million (Gidney, 2025), under the same assumptions about hardware.

Why the T-count matters

Each T gate costs a magic state, and each magic state costs many physical qubits and cycles of distillation. This is why algorithm papers report the number of T or Toffoli gates, and why the ‘gate count’ in a resource estimate is dominated by non-Clifford gates.

Decoding: the classical half of the machine

A surface-code machine produces a stream of check measurements every cycle. For a distance-d patch that is d² − 1 bits per cycle per logical qubit. A classical decoder must read this stream and decide, fast enough to keep up, which errors probably happened. With a cycle of 1.1 µs, as in the Google device, the classical electronics have about a microsecond per cycle of budget on average.

Worked example

How much data does the decoder see?

  1. Take d = 27, so 27² − 1 = 728 check bits per cycle per logical qubit.
  2. With a 1 µs cycle that is 728 million bits per second per logical qubit. For 6,000 logical qubits it is 4.4 × 10¹² bits per second, which is 4.4 terabits per second of syndrome data.
  3. The decoder cannot afford to fall behind: if it takes longer than one cycle per cycle of data on average, a backlog builds without limit. The Google experiment reports a decoder latency of 63 µs at distance 5, which is fine as long as the throughput keeps up and the latency does not hold up gates that depend on the result.
  4. These figures are an illustration of scale, computed from the stated assumptions, not a specification of any real machine.

The standard decoders are based on minimum-weight perfect matching, which pairs up flipped checks along the shortest error chains, and the Google paper used an ensemble of matching-based decoders and a neural-network decoder. Better decoders lower the logical error rate for free, with no extra qubits, which is why the same experiment gives a Λ of 2.14 with one decoder and 2.04 with another.

Other error types

  • Leakage: a qubit that leaves the two computational levels. Standard parity checks do not see it. The Google chip used extra qubits dedicated to removing leakage (4 in the 105-qubit device, per the paper).
  • Correlated errors: bursts that hit many qubits together, such as the rare events behind the 10⁻¹⁰ floor in the repetition-code runs. Error correction theory assumes mostly independent errors, so these are particularly dangerous.
  • Measurement errors: a wrong check result looks like an error that is not there. Repeating the checks over many cycles and comparing them over time handles this, which is why decoding is done in space and time together.

Other codes and other platforms

The surface code is not the only option. Its drawback is its overhead: one logical qubit takes about 2d² physical qubits, and the useful distance may be well into the tens. Codes from the family known as quantum low-density parity-check (LDPC) codes aim to encode many logical qubits per block with a much better ratio, at the price of needing long-range connections between qubits, which suits some platforms (neutral atoms that can be moved, for example) better than a fixed chip.

Experiments are already moving beyond a single surface-code memory. The Harvard-led team (Bluvstein et al., Nature, 2023) used reconfigurable arrays of neutral atoms. According to the abstract I opened, they used up to 280 physical qubits to run logical qubits in surface codes, colour codes and a three-dimensional [[8, 3, 2]] code. They scaled the surface code from distance 3 to 7 and saw improved two-qubit logic fidelity, operated 40 colour-code qubits, and sampled circuits with up to 48 logical qubits using 228 logical two-qubit gates and 48 logical CCZ gates.

A careful reading of the Harvard result

The abstract states that the logical encoding outperformed physical qubits ‘with error detection’. Error detection is weaker than full error correction because detected errors are discarded rather than fixed. So this is evidence that logical qubits can be manipulated at scale, not a demonstration of a full fault-tolerant computation.

The honest summary of the field is that three separate milestones are in sight, and none has been joined to the others at scale yet: a logical memory below threshold (done on a small scale, by Google), logical operations between encoded qubits (demonstrated in several forms, partly with error detection), and a full algorithm running at useful scale with all of these together (not yet done).

Common misunderstandings

MisunderstandingCorrection
Error correction copies the qubit three timesCopying is forbidden. The state is entangled across the code and only parities are measured.
Measuring the syndrome collapses the encoded stateThe syndrome reveals where an error is, not the logical value, so the superposition survives.
Quantum errors are continuous and cannot be corrected exactlyMeasuring a syndrome projects a continuous error onto a discrete Pauli, which can then be undone.
More qubits always means a better logical qubitOnly below threshold. Above it, a bigger code is worse.
The Google experiment showed a fault-tolerant quantum computerIt showed a logical memory improving with code size, with Λ ≈ 2. It did not run logical computations.
A logical qubit is about 1,000 physical qubitsThe ratio depends on the physical error rate, the target logical error and the code. The extrapolation here gives about 1,500 to 8,000 for the surface code depending on Λ.
Error correction removes the need for good hardwareIt needs hardware below threshold, and the better the hardware the lower the overhead.

Practice problems

Check yourself

For the three-qubit bit-flip code with p = 0.05, what is the probability of a logical error?

3p² − 2p³ = 3(0.0025) − 2(0.000125) = 0.0075 − 0.00025 = 0.00725, so about 0.7%, which is lower than the 5% of an unprotected qubit.

The syndrome in the three-qubit code is 0 1. Which qubit do you correct?

Data qubit 3. The second parity (qubits 2 and 3) is odd and the first is even, which means qubit 3 flipped.

In the Steane code the Z-type syndrome is 101. Where is the X error?

On qubit 5, since 101 in binary is 5.

How many physical qubits does a distance-9 surface code patch use? And distance 11?

2d² − 1: 161 for d = 9 and 241 for d = 11.

With ε₇ = 1.43 × 10⁻³ and Λ = 2.14, estimate the logical error at d = 11.

Two steps of distance, so divide by Λ² = 4.58: about 3.1 × 10⁻⁴.

A distance-5 repetition code (5 qubits, corrects 2 flips) is used with p = 0.01. What is the failure probability?

At least 3 of 5 flip: 10p³(1−p)² + 5p⁴(1−p) + p⁵ ≈ 9.85 × 10⁻⁶. Much better than the 3-qubit code’s 3 × 10⁻⁴.

Using the concatenation recursion with p_th = 1% and p = 0.2%, what are the first three levels?

p₁ = 10⁻² × 0.2² = 4 × 10⁻⁴. p₂ = 10⁻² × 0.04² = 1.6 × 10⁻⁵. p₃ = 10⁻² × (1.6 × 10⁻³)² = 2.56 × 10⁻⁸.

1,000 logical qubits at distance 27 need roughly how many physical qubits?

1,000 × (2 × 27² − 1) = 1,000 × 1,457 ≈ 1.46 million, before magic state factories and routing space.

Why can an error that anticommutes with no stabilizer be dangerous?

It gives a trivial syndrome, so it goes undetected. If it also acts non-trivially on the logical qubit, it is a logical error. The distance measures how many qubits such an error must touch.

Why must Λ be larger than 1 for error correction to help?

Each step up in distance divides the logical error by Λ. If Λ were below 1, a bigger code would have a higher logical error, so more qubits would hurt.

References and further reading

I opened the Google Quantum AI paper on error correction below the surface code threshold (arXiv 2408.13687) and took every experimental number from it as stated: distances, Λ, cycle time, lifetimes, decoder latency. I opened the abstract of Fowler et al. on surface codes and the abstract of the Harvard–QuEra logical processor paper. The Shor, Steane and Knill–Laflamme codes, the threshold theorem and the Eastin–Knill theorem are standard textbook material that I did not reopen for this page. The three-qubit code, the Steane syndrome table, the scaling extrapolations and the concatenation recursion were computed directly. Extrapolations are illustrations, not predictions.

  1. Quantum error correction below the surface code threshold (arXiv 2408.13687, Google Quantum AI, 2024) Opened. Source of all numbers in the Google section: Λ, logical error per cycle, cycle time, lifetimes, decoder latency.
  2. Surface codes: Towards practical large-scale quantum computation (arXiv 1208.0928, Fowler, Mariantoni, Martinis, Cleland; Phys. Rev. A 86, 032324 (2012)) Abstract opened. Introduces surface code computing on a two-dimensional array; the abstract page gives no threshold figure.
  3. Logical quantum processor based on reconfigurable atom arrays (arXiv 2312.03982, Bluvstein et al., Nature, 2023) Abstract opened. Up to 280 physical qubits, up to 48 logical qubits, with error detection.
  4. How to factor 2048 bit RSA integers in less than a week with less than a million noisy qubits (arXiv 2505.15917, C. Gidney, 2025) Used for the comparison of resource estimates. Opened earlier in this course.
  5. How to factor 2048 bit RSA integers in 8 hours using 20 million noisy qubits (arXiv 1905.09749, C. Gidney and M. Ekerå, 2019) Used for the 20 million qubit figure. Opened earlier in this course.
  6. Physics 219 Quantum Computation: lecture notes (John Preskill, Caltech) Free notes with a full treatment of stabilizer codes, the threshold theorem and fault tolerance. Not reopened for this page.