Skip to content
aiqbenchAI & Quantum Intelligence
NewsInsightsBenchmarksSkillsAsk AILearnAbout
...Loading your session
NewsInsightsBenchmarksSkillsAsk AILearnAbout
  1. Future Jobs
  2. ›
  3. Quantum Error Correction Engineer
  4. ›
  5. Lesson 3 of 8

The Surface Code: Lattice, Distance, Syndromes and Logical Operators

Advanced¶ Read · 5 min⚑ Mission · 40 min◆ Test · 5 questions✓ Checked Nov 23, 2026

You'll be able to:

You can draw a distance-3 rotated surface code, label data and measure qubits, state the X and Z stabilizer of each plaquette, trace the logical X and Z strings, explain why distance equals the shortest logical operator, and count physical qubits as 2d²−1.

A code you can draw on graph paper

The surface code is the code most hardware roadmaps are built around, and the reason is geometric rather than mathematical: every check involves only a qubit's immediate neighbours on a 2D grid, which is exactly what a superconducting chip can offer. Dennis, Kitaev, Landahl and Preskill worked out its memory properties in 2001; Fowler and colleagues' 2012 paper is the engineering manual most people learn from.

The lattice

Take the rotated version (the one in Google's experiments). Place d × d data qubits on a square grid. Between them sit the measure qubits, one per face of the checkerboard plus a few on the boundary, alternating between two types:

  • An X-type measure qubit checks the product X⊗X⊗X⊗X of its four surrounding data qubits.
  • A Z-type measure qubit checks Z⊗Z⊗Z⊗Z of its four surrounding data qubits.

On the boundary the faces are cut in half and the checks have weight 2. Count them up for distance d: d² data qubits plus d² − 1 measure qubits, so 2d² − 1 physical qubits in total. Distance 3 needs 17, distance 5 needs 49, distance 7 needs 97.

Adjacent X and Z plaquettes always share exactly two data qubits, and two Paulis that overlap on an even number of qubits commute. That is the whole reason the checks can be measured together without disturbing each other.

Logical operators

With d² data qubits and d² − 1 generators there is exactly one logical qubit per patch. Its logical Z is a string of Z operators running from one Z-type boundary to the opposite one; its logical X is a string of X operators running between the other two boundaries. The two strings cross on exactly one data qubit, which is why they anticommute, as a logical X and Z must. The shortest such string has length d — hence the name "distance". A longer wiggly string is the same logical operator multiplied by some stabilizers, so the decoder treats all of them as equivalent.

What an error looks like in the syndrome

Here is the picture to internalise. A single Z error on a data qubit anticommutes with the X-type checks on either side of it, so two adjacent X-type measure qubits report −1. A single Z error on a boundary data qubit lights only one check, because its other neighbour is off the edge of the patch. A chain of Z errors along a path lights only the two checks at the chain's endpoints; everything in the middle cancels because each interior check sees two errors.

So the syndrome does not tell you where the errors are. It tells you where the endpoints of error chains are. Decoding (module 4) is the problem of pairing endpoints up with the cheapest chains, and it fails when the pairing you choose, combined with the actual error, wraps a string from one boundary to the other — a logical error.

Worked procedure: one round of syndrome extraction

For each measure qubit, in parallel:

  1. Reset the measure qubit to |0⟩ (and apply H if it is X-type).
  2. Apply four CNOTs between the measure qubit and its four data qubits, in a fixed order — all X-type plaquettes use one zigzag pattern, all Z-type plaquettes the mirrored one.
  3. Undo the H if X-type, then measure the measure qubit.

Step 2's ordering is not cosmetic. A fault in the middle of the four CNOTs can leave an error on two data qubits at once (a "hook" error). The standard orderings are chosen so that the hook's two qubits lie perpendicular to the logical operator that check protects, so a single fault still only costs one unit of distance. Get the ordering wrong and your distance-5 code behaves like distance 3.

On a superconducting processor one round takes on the order of a microsecond. The measurements themselves are noisy, so a round is repeated d times and the decoder works on the 3D space-time volume of results: a measurement error shows up as a check that flips in one round and flips back in the next, which looks like a chain in the time direction. Tools like Stim therefore report detectors — the comparison of a check with its previous-round value — rather than raw syndromes, so that an error-free run gives all zeros.

The trade-off that made the surface code the default

The surface code wins on two counts: nearest-neighbour connectivity in two dimensions, and a high threshold — roughly 0.7–1% per operation under circuit-level depolarising noise with a matching decoder, though the exact number depends on the noise model and decoder. What it costs is encoding rate. Each patch stores one logical qubit in ~2d² physical qubits, and realistic algorithms need d in the 20s. A thousand logical qubits at distance 25 is more than a million physical qubits before you count magic-state factories (module 6). The codes in module 7 exist because people want that number to come down.

What to remember

  • Rotated surface code of distance d: d² data qubits, d² − 1 measure qubits, 2d² − 1 total; one logical qubit per patch.
  • X-type checks measure XXXX on a face; Z-type checks measure ZZZZ; neighbours share two qubits and therefore commute.
  • Logical X and Z are boundary-to-boundary strings that cross on one qubit; the shortest string has length d.
  • The syndrome shows the endpoints of error chains, not the errors.
  • CNOT ordering in syndrome extraction decides whether a single fault costs one or two units of distance.
  • Rounds are repeated and decoded in space-time, because measurements are errors too.

Curated Materials

2.7h

The deep work happens here — the lesson is your briefing.

  • Surface codes: Towards practical large-scale quantum computation (Fowler, Mariantoni, Martinis, Cleland)Paper· 75 min
  • Topological quantum memory (Dennis, Kitaev, Landahl, Preskill)Paper· 60 min
  • Error Correction Zoo: Kitaev surface codeDocs· 25 min

Live on aiqbench

This lesson's subject on the rest of the site, today.

In the news, last 30 days

  • GPU decoder keeps pace with a superconducting qubit clock on a continuous stream, with NVIDIA NVQLink interconnectAlice & Bob · Dec 1
  • Classiq and Diraq Collaborate to Advance Fault-Tolerant Quantum Computing on SiliconHPCwire · Dec 1
  • NVIDIA Strengthens US Quantum Leadership With Groq 3 LPX Breakthrough in Quantum Error CorrectionNVIDIA · Dec 1
More news on this subject →

Go further

  • Quantum vendors comparedQubits, fidelities and roadmaps, each with its source.
  • Ask AI about this lessonOpens Ask AI with a question about this lesson, answered from the news archive with sources.

Test your knowledge

5 questions in 100 seconds, on a page of its own. Read everything above first.

Test your knowledge →

Module Mission

35–45 min

Draw a distance-3 rotated surface code on squared paper: 9 data qubits on a 3×3 grid, 8 measure qubits (4 X-type, 4 Z-type, including the four boundary half-plaquettes). Shade the X and Z plaquettes, draw one logical Z string and one logical X string, and show they share exactly one qubit (so they anticommute). Then draw a single Z error on the centre data qubit and mark which two X-type stabilizers light up. Repeat for a Z error on a boundary qubit and explain why only one stabilizer lights up.

Loading your work…

← Previous lesson2. Stabilizer Formalism, Shor's 9-Qubit Code and the Steane CodeNext lesson →4. Decoders: Matching, Union-Find, Neural Nets and the Real-Time Budget
aiqbench
AI & Quantum Intelligence© aiqbench. All rights reserved.

Feeds:RSS·JSON Feed

LanguageEnglish·Românăbeta
NewsAI & TechQuantumInsights
ExploreBenchmarksLearn
CompanyAboutTrustLegal noticeTerms of ServicePrivacy PolicyCopyright noticesData erasureReport content

The aiqbench take, the insights, the daily digest and Ask answers are written by AI models from the sources shown, without editorial review before publication. They may contain errors — check the source. How the model is used →

  • News
  • Insights
  • Ask AI
  • Benchmarks
  • Account