Surface code

On this page 7

The surface code is a topological stabilizer code that encodes one logical qubit in a two-dimensional grid of physical qubits and detects errors through repeated measurements of local four-qubit parity checks. It is the leading candidate for quantum error correction in superconducting quantum computing because it needs only nearest-neighbor interactions on a square lattice and tolerates physical error rates close to 1 percent, the highest threshold among practical codes.

The surface code descends from Alexei Kitaev’s toric code, with the periodic boundaries replaced by open edges so that the layout fits on a flat chip. Its price is overhead: protecting a single logical qubit to useful levels typically requires hundreds to over a thousand physical qubits.

How the surface code detects errors

The surface code places data qubits on a lattice and interleaves them with measurement qubits (also called ancilla qubits). Each measurement qubit repeatedly checks the parity of its four neighboring data qubits in either the X basis or the Z basis, without revealing the encoded quantum information.

These checks are the stabilizers of the code. In the absence of errors every stabilizer returns the same value round after round; a change in a value, called a detection event, signals that an error occurred nearby. The table below lists the two stabilizer types and what they catch.

StabilizerOperatorErrors detected
Z-type (plaquette)Z⊗Z⊗Z⊗Z on four data qubitsBit-flip (X) errors
X-type (vertex)X⊗X⊗X⊗X on four data qubitsPhase-flip (Z) errors
Boundary checksWeight-two operators at the edgesErrors on edge data qubits
Stabilizer types in the surface code

Because a Y error is a combination of X and Z, it triggers both stabilizer types. The full record of detection events across many rounds, the syndrome history, is passed to a classical decoder that infers the most likely set of errors.

Code distance, threshold and logical error rate

The code distance d is the smallest number of physical errors that can change the logical state without being detected. A distance-d rotated surface code uses d² data qubits and d² − 1 measurement qubits, so roughly 2d² physical qubits in total, and corrects any combination of up to (d − 1)/2 errors.

The logical error rate per round follows an approximate scaling law: p_L ≈ A (p/p_th)^((d+1)/2), where p is the physical error rate and p_th is the threshold. Below threshold, each increase of d by two suppresses logical errors by a factor often called Λ. The following table shows how qubit counts grow with distance.

Code distancePhysical qubitsErrors corrected
d = 3171
d = 5492
d = 7973
d = 251,24912
Rotated surface code size by distance

The threshold of about 1 percent applies to circuit-level noise with an efficient decoder; idealized models give higher values, while realistic noise with leakage and correlated errors lowers it. In practice, hardware must operate well below threshold, around 0.1 to 0.3 percent, for the suppression factor to be large enough to be useful.

Decoding the syndrome in real time

Syndrome decoding converts detection events into a correction. The standard approach is minimum-weight perfect matching, which pairs detection events along the shortest paths in a graph built from the noise model. Alternatives include union-find decoders, which trade a little accuracy for near-linear speed, and neural network decoders trained on device data.

Decoding must keep pace with the hardware. Superconducting processors complete a syndrome round in about one microsecond, so the decoder must process data at that rate, or a backlog builds up and stalls logical operations that depend on earlier corrections. Corrections are usually tracked in software as a Pauli frame rather than applied physically.

Logical operations on surface code qubits

Computation with the surface code relies on a small set of fault-tolerant techniques. Some gates are cheap, while others require substantial extra resources, and the table below summarizes the main ones.

OperationTechniqueRelative cost
Pauli X and ZTracked in the Pauli frameEssentially free
CNOTLattice surgery or braiding of defectsAbout d rounds
Hadamard and SPatch rotation or lattice surgeryModerate
T gateMagic state distillation and injectionDominant cost
Logical operations and their cost

Lattice surgery merges and splits code patches by measuring joint stabilizers along their boundaries, which has replaced defect braiding in most architecture studies. The non-Clifford T gate cannot be implemented transversally, so it relies on magic state distillation, whose factories can occupy a large share of the chip.

Strengths and limitations compared with other codes

The surface code is favored for its high threshold and planar layout, but it encodes only one logical qubit per patch. Competing codes address this inefficiency at the cost of harder connectivity, as the comparison below shows.

CodeConnectivityEncoding rateNotable property
Surface codeNearest neighbor, degree 41 logical qubit per patchHighest practical threshold
Color codeNearest neighbor, degree up to 61 logical qubit per patchTransversal Clifford gates
Quantum LDPC codeLong-range linksMany logical qubits per blockFar lower qubit overhead
Steane codeAll-to-all within block1 logical qubit per 7Small, low threshold
Surface code compared with related codes

Known weaknesses include leakage out of the computational subspace, correlated errors from cosmic rays that can wipe out large regions, and the sheer number of physical qubits required. Practitioners counter these with leakage-reduction units, careful chip design and decoders that model correlated noise.

The short version

Quantum bits are fragile and pick up errors constantly. The surface code protects them by spreading one reliable qubit across a grid of many unreliable ones. Small helper qubits keep checking their neighbors, like smoke detectors placed in every room.

When a detector changes its reading, a fast classical computer works out where the fault probably happened and keeps track of the fix. A bigger grid means fewer mistakes, as long as each individual qubit is already good enough. That is why the surface code is the standard route to a dependable quantum computer.

Where it makes a difference

A hardware team operating a superconducting processor with about one hundred qubits wants to prove that error correction actually works on its chip. The team implements surface code memories at distances 3, 5 and 7, running up to one hundred syndrome rounds at roughly one microsecond each, with a real-time matching decoder on dedicated classical hardware.

With physical two-qubit gate error near 0.3 percent, the measured logical error per round falls by a factor of about two each time the distance increases by two. The distance-7 logical qubit outlives the best physical qubit on the chip, the milestone known as operating below threshold. Based on that suppression factor, the team estimates that a distance around 25 would be needed for algorithms requiring logical error rates near one in a million.