ZKSF logo, a neon quantum brainZKSF
← All articles

Simulating Quantum Error Correction: How Logical Qubits Are Tested

· 6 min read · ZKSF team

A logical qubit is not a single physical qubit. It is one reliable qubit built from many noisy ones, protected by a quantum error correction (QEC) code that detects and reverses errors faster than they accumulate. Because today's physical qubits carry gate error rates around 0.1 to 1 percent, QEC is the bridge every hardware roadmap must cross to reach useful, fault-tolerant machines.

Interactive diagramInside the surface codeA distance-5 lattice, a live error → syndrome → decode → correct cycle, and the threshold plot where increasing code distance flips from suppressing errors to amplifying them

The lattice on the left is a distance-5 surface code: 25 physical qubits protecting a single logical qubit. A physical error strikes a data qubit and flips two neighboring stabilizer checks, then a minimum-weight perfect matching decoder pairs up the flipped checks and applies the correction. The plot on the right tracks logical error rate against physical error rate for three code distances and shows the crossover near 1 percent: below that threshold a larger code suppresses errors more, above it a larger code makes things worse.

That bridge is not tested on quantum hardware first. It is tested in simulation, at scales real devices will not reach for years. Understanding why that simulation is possible at all is central to the field.

Why QEC circuits are simulable

Most error correction circuits, including the surface code that leads current hardware efforts, are built almost entirely from Clifford gates: Hadamard, phase, and CNOT, together with measurement in the computational basis. The Gottesman-Knill theorem proves that circuits restricted to these gates simulate on a classical computer in polynomial time, regardless of qubit count.

This is a notable exception to the usual 2^n memory wall. A distance-d surface code protecting one logical qubit uses on the order of d-squared physical qubits, repeated over many measurement rounds; a serious study can involve thousands of qubits and hundreds of thousands of measurements. Statevector simulation cannot reach that scale. Stabilizer simulation completes it in a fraction of a second.

What researchers measure

The dominant open-source tool is Stim, a stabilizer circuit simulator that samples measurement outcomes for circuits with millions of qubits and gates. A typical workflow builds a noisy surface-code circuit, generates a detector error model describing which error events flip which measurements, samples many shots, and feeds those samples to a decoder such as minimum-weight perfect matching. The output is a logical error rate.

Repeating this across code distances and physical error rates produces the figure the field tracks most closely: the threshold.

  • Below the threshold physical error rate, increasing code distance drives the logical error rate down exponentially.
  • Above the threshold, adding qubits makes performance worse, not better.
  • The surface code threshold sits near 1 percent, which is why hardware teams work specifically to push gate errors below that figure.
Code distance d   Physical qubits (~d^2)   Below threshold          Above threshold
3                 ~9                        error rate falls          error rate rises
5                 ~25                       error rate falls further  error rate rises further
7                 ~49                       error rate falls further  error rate rises further

From threshold to engineering

This is where simulation stops being an academic exercise and becomes engineering. Decoder speed, code layout, biased noise, and leakage all shift the threshold, and each variation is a simulation experiment before it is ever a hardware experiment. A researcher can characterize a code, tune a decoder, and estimate the qubit budget for a target logical error rate without spending any hardware time.

The stabilizer engine on this platform is built for exactly this workload: Clifford circuits at thousands to millions of qubits, returning exact results in milliseconds, through the same API used for every other backend. For work on logical qubits, the simulator is not a preliminary step. It is the laboratory.

Run your own 100-qubit circuit, with an error bar.