← Quantum Store · Guides · Lessons · Glossary · Packages · About · Türkçe
Noise and quantum error correction course · Lesson 4 / 5 · 12 min
The surface code and the threshold: the road to fault-tolerant quantum computers
The surface code arranges qubits on a grid and measures parities only between neighbours. Learn about the error threshold, the code distance and the below-threshold error correction Google showed in 2024.
Qubits on a grid
In the surface code the data qubits sit on a d × d grid like a chessboard, with measurement qubits placed between them. Each measurement qubit measures the ZZZZ or XXXX parity of the four (two at the edges) data qubits around it. These are called stabiliser measurements, and they are a large generalisation of the ZZ = +1 parity of a Bell state.
The syndromes are measured again every round, and a classical computer, the “decoder”, works out which errors occurred. Because it only needs operations between neighbouring qubits, the surface code suits superconducting chips very well.
Distance and threshold
d is called the distance of the code: the code can correct (d − 1)/2 errors. It needs 17 physical qubits for d = 3, 49 for d = 5 and 97 for d = 7 (2d² − 1). If the physical error rate p is below a value called the threshold (about 1% for the surface code), increasing d shrinks the logical error exponentially. Above the threshold, adding more qubits makes things worse.
The code below makes a rough estimate for p = 0.1% and a 1% threshold: every time d grows by 2 the logical error drops tenfold.
p, p_th = 0.001, 0.01 # physical error rate and threshold
for d in [3, 5, 7, 9]:
qubits = 2 * d**2 - 1
logical = 0.1 * (p / p_th) ** ((d + 1) / 2)
print(d, qubits, f'{logical:.0e}')
# 3 17 1e-03
# 5 49 1e-04
# 7 97 1e-05
# 9 161 1e-06
Below the threshold
In 2023 Google showed that a d = 5 code was slightly better than d = 3. In 2024, with its Willow chip, it tried codes with d = 3, 5 and 7: every time d grew by 2 the logical error roughly halved, and the d = 7 logical qubit lived longer than its best physical qubit. This was the first clear demonstration of error correction working below the threshold.
Useful algorithms need the logical error to fall to around one in a billion and hundreds or thousands of logical qubits. That means millions of physical qubits. This is why new codes that need fewer qubits (for example IBM’s qLDPC codes) are being researched intensively.
Try it yourself
In a Bell state the two bits always agree: the ZZ parity is always +1. The measurement qubits of the surface code also measure parities like this, without looking at individual bits. Remove the CNOT: the bits become independent, 01 also appears and the parity is no longer fixed.
Open the circuit in your browserThe circuit playground is in Turkish. Button guide: “1000 kez ölç” = measure 1000 times, “Durum vektörünü göster” = show the state vector, “Bu devrenin Qiskit kodu” = this circuit’s Qiskit code, “Geri al” = undo, “Temizle” = clear. Click a gate in the circuit to remove it.
Key points
- The surface code arranges qubits on a grid and measures ZZZZ and XXXX parities between neighbours.
- A distance-d code corrects (d − 1)/2 errors and uses about 2d² − 1 physical qubits.
- If the physical error is below the threshold (about 1%), increasing d reduces the logical error exponentially.
- Google’s Willow chip showed below-threshold error correction in 2024.
Test yourself
What happens when the code distance d is increased while the physical error rate is below the threshold?
- The logical error grows
- The logical error falls exponentially
- Nothing changes
Show the answer
The logical error falls exponentially. Below the threshold every extra layer of correction helps; the logical error falls roughly like (p/p_threshold)^((d+1)/2).
← The phase-flip code and Shor’s nine-qubit code · Error mitigation: better results from today’s noisy devices →