Measuring Code Performance
A code is only as good as its logical error rate — the probability that, after a full encode–error–correct cycle, the logical qubit comes out wrong. Designing a code is one thing; measuring whether it actually helps on a given noise level is another. The standard tool is Monte Carlo sampling: run the cycle many times and count logical failures.
Defining the logical error rate
Let be the probability that one QEC cycle leaves the logical qubit in the wrong state. We estimate it empirically. Run independent shots, each consisting of: prepare a known logical state, subject it to noise, run syndrome extraction and correction, then measure the logical value. If shots come out wrong,
with a binomial standard error of . To resolve a logical rate of you need on the order of shots — sampling cost grows as the code improves, which is itself a sign the code is working.
The pseudo-threshold
The point of QEC is that the encoded qubit should fail less often than a bare one. Compare:
- Unencoded: a single physical qubit fails with probability (the physical error rate).
- Encoded: the logical qubit fails with , which for a distance-3 code scales like at small — quadratic suppression, because two independent errors are needed to fool the decoder.
The crossover where is the pseudo-threshold. Below it, encoding wins; above it, the extra qubits and gates make things worse. Plotting versus and finding the crossover is the canonical benchmark of a code (Fowler et al., arXiv:1208.0928, for the surface code).
A single clean trial
To see the mechanism without statistics, the exercise runs one cycle with exactly one (correctable) error and reads out the result. Because a single bit flip is always inside the correctable set, this trial never produces a logical error — the data qubit comes out as logical 0 with certainty. In a real benchmark you would instead inject errors randomly with probability per qubit and tally the fraction of trials where the data qubit flips, building up shot by shot.
Reading the histogram
After the cycle, measuring all three qubits gives a deterministic outcome: qubit 0 (the recovered logical bit) reads 0, while qubits 1 and 2 carry the syndrome of the error that was fixed. A logical failure would instead show qubit 0 reading 1. Counting how often that happens, over many randomized trials, is precisely how the logical error rate is estimated on hardware.
Try it
Run the full single-error cycle and measure. The grader checks the measurement distribution: the logical qubit must survive, so all the weight sits on a single outcome with qubit 0 equal to 0.
Open the Probabilities tab: one bar at 010 carries everything. Its qubit-0 bit is 0 — the
logical zero survived the error, a logical error rate of exactly zero for this correctable case.
Sign in on the full site to ask questions and join the discussion.