Skip to content
Tushar Pandey

A course in eight interactive lessons

Quantum error correction in practice

How quantum error correction works, one lesson at a time: from a row of qubits guarded by parity checks to logical gates between surface code patches.

What is this, and why does it matter?How the course works

Errors and decoding

The repetition code

An X error on q2 fires the two checks beside it

Open

Errors and decoding

A surface code patch

An X error on q4 fires two Z checks

Open

Errors and decoding

Errors, syndromes and decoding

Two X errors fire two Z checks; one cluster joins them

Open

Errors and decoding

The threshold

Logical against physical error rate: d = 3, 5, 7 cross at the threshold

Open

Computing with logical qubits

Logical CNOT between two patches

Nine CNOTs, A to B, make a Bell pair

Open

Computing with logical qubits

Preparing a T state

All checks hold, neither logical does

Open

Computing with logical qubits

Teleporting the T state

Logical CNOT A to B, before the readout

Open

Computing with logical qubits

Lattice surgery

Merged: three seam qubits and their checks join A and B

Open
Errors and decoding
An X error on q2 fires the two checks beside it

The repetition code

Step 1

Flip qubits in a row, watch the parity checks between neighbours fire, and decode them, which on a line is a majority vote. Then simulate the logical error rate against the physical error rate for d = 1, 3, 5 and 7 and set it beside the exact curve.

Errors and decoding
An X error on q4 fires two Z checks

A surface code patch

Step 2, Lesson 1

Step through the encoder that puts |0⟩ on nine qubits, watched by eight checks, then inject an X, Y or Z error on any qubit and see which checks fire and whether the readout survives.

Errors and decoding
Two X errors fire two Z checks; one cluster joins them

Errors, syndromes and decoding

Step 3

Place X, Z and Y errors on a d = 3, 5 or 7 patch and watch a union-find decoder grow clusters step by step. See how (d+1)/2 errors fool it, and why measurement errors need repeated rounds.

Errors and decoding
Logical against physical error rate: d = 3, 5, 7 cross at the threshold

The threshold

Step 4

Run Monte Carlo in the browser to draw the logical against the physical error rate for d = 3, 5, 7 and up and watch the curves cross. Read off the crossing and the suppression factor, switch on measurement errors, and compare with reference numbers from stim and pymatching.

Computing with logical qubits
Nine CNOTs, A to B, make a Bell pair

Logical CNOT between two patches

Step 5, Lesson 2

Nine physical CNOTs between two patches act as one logical CNOT and leave a logical Bell pair. Then run the circuit live in the browser with your own noise level and an injected error.

Computing with logical qubits
All checks hold, neither logical does

Preparing a T state

Step 6, Lesson 3

Make the T state on one qubit with H and T, encode it as |T⟩⁠L, and compare the simulated readouts in X and Y with the ideal 14.6%.

Computing with logical qubits
Logical CNOT A to B, before the readout

Teleporting the T state

Step 7, Lesson 4

Teleport |T⟩⁠L from patch A to patch C through a logical Bell pair on B and C, with a Pauli fix from the measured bits.

Computing with logical qubits
Merged: three seam qubits and their checks join A and B

Lattice surgery

Step 8

Merge two patches along an edge and split them again: the seam checks measure Z⁠L Z⁠L without reading either logical qubit. Step through it on 21 simulated qubits and run 200 shots.

The course

What is this, and why does it matter?

Quantum computers are built from qubits, and qubits lose their information easily: small disturbances from their surroundings flip them, and nothing announces that it happened.

Error correction stores one reliable qubit in many unreliable ones. Checks keep comparing the qubits for disagreement without ever looking at the stored data, and a decoder uses the disagreements to find and undo errors.

This course lets you try that by hand, from a row of five qubits to the operations a future machine would run: gates between protected qubits, teleportation and lattice surgery.

The course

How the course works

The course is for readers who know what a qubit is and have met the H, T and CNOT gates; the checks, the decoders and the patches are introduced as they appear, and the glossary collects the terms. The figures run in your browser with nothing to install. The repetition code, decoding and threshold pages decode with a union-find decoder, and the threshold page also compares it with stored reference results from stim and pymatching. Lesson 1, the live run in lesson 2 and the stored results of lessons 1 to 4 correct with a lookup table of single errors instead. The live run in lesson 2 and the lattice surgery page simulate their circuits with a stabilizer simulator, and lessons 1 to 4 each end with a table of stored results from a noisy simulation in Qiskit Aer.

Four of the eight steps are the numbered lessons, Lessons 1 to 4, which share a step-through player and a results table; the other four are essays with their own figures. Each page has its text written out in full. Later steps build on earlier ones, so take them in order.

Tushar Pandey's own work in quantum error correction goes further, from an error-correction algorithm for the doubled semion model to surgery on qLDPC codes: see his research. For one family of qLDPC codes there is also the bivariate bicycle code explorer.

How to cite T. Pandey, Quantum Error Correction in Practice (2026), https://pandey-tushar.com/qec-in-practice/