|q⟩ Bad Qubits

advanced · Programming · Implementing the Surface Code

The Surface-Code Lattice

The surface code is the leading candidate for building a fault-tolerant quantum computer on hardware with only nearest-neighbour connectivity. Unlike the small codes of the previous module — the three-qubit, Steane, and Shor codes — the surface code is defined on a two-dimensional lattice that can be grown to arbitrary size, and every check it measures involves only a handful of physically adjacent qubits.

Two species of qubit

A surface-code patch is a checkerboard of qubits that come in two roles:

In the common rotated layout, the qubits sit on the vertices of a square grid, and the data and ancilla qubits alternate so that every ancilla has data qubits as its immediate neighbours. A patch encoding one logical qubit at distance dd uses

ndata=d2,nancilla=d21,n_{\text{data}} = d^2, \qquad n_{\text{ancilla}} = d^2 - 1,

for a total of 2d212d^2 - 1 physical qubits. The smallest useful patch, d=3d = 3, therefore needs 99 data qubits and 88 ancilla qubits — 1717 in all.

Why two dimensions

The defining feature of the surface code is locality. Every check the code performs reads only the qubits touching one ancilla — typically four data qubits in the bulk and two at the boundary. Nothing requires a qubit on the left edge to interact directly with one on the right. This matches real superconducting and neutral-atom hardware, where two qubits can only be coupled if they are physically close.

Compare this to the Steane or Shor codes, whose stabilizer generators can span qubits that are far apart on a chip. Those codes are excellent for understanding the principles of error correction, but their long-range checks are awkward to implement at scale. The surface code trades a higher qubit count for the priceless property that every operation is local and identical, so the same control hardware tiles across the whole lattice.

Reading the checkerboard

It helps to picture the lattice as coloured tiles between the data qubits:

Every data qubit in the bulk touches two ZZ-tiles and two XX-tiles. Detecting an error becomes a question of which tiles light up when their parity changes — a picture we will turn into running code over the next several lessons.

What comes next

With the lattice and its two qubit species in hand, the next lesson makes the checks concrete: we will write down the XX-type and ZZ-type stabilizer operators that each tile measures, and see why they all commute — the property that lets us measure them together without disturbing the logical state.

Sign in on the full site to ask questions and join the discussion.