|q⟩ Bad Qubits

intermediate · Programming · Quantum Error Detection (Intro)

Detecting vs Correcting

Error correction and error detection are often used interchangeably in conversation, but they represent genuinely different capabilities with different resource requirements. Telling them apart is essential before studying codes of any complexity.

Two distinct goals

A quantum error-correcting code does two things: it senses that an error has occurred (detection) and then it reverses that error (correction). Detection alone is cheaper — a code can signal "something went wrong here" without having enough information to undo the damage.

More precisely:

The same syndrome circuit can serve both purposes — the difference is in what the decoder does with the outcome.

Code distance ties the two together

Every stabilizer code has a distance dd, the minimum weight of any undetectable error (i.e., the smallest number of single-qubit errors that map one codeword to another without triggering any syndrome flag).

A distance-dd code can:

detect up to d1 errors,correct up to d12 errors.\text{detect up to } d - 1 \text{ errors,} \qquad \text{correct up to } \left\lfloor \tfrac{d-1}{2} \right\rfloor \text{ errors.}

The asymmetry arises because correction requires the decoder to assign every detected syndrome to a unique error — and that assignment breaks down as soon as two distinct errors produce the same syndrome. Detection is more forgiving: it only needs to distinguish "inside the codespace" from "outside."

A concrete comparison: distance-3 vs distance-5

Consider two codes protecting one logical qubit against bit-flip errors only.

| Code | Physical qubits | Distance | Detects | Corrects | |------|----------------|----------|---------|---------| | Three-qubit repetition | 3 | 3 | 2 errors | 1 error | | Five-qubit repetition | 5 | 5 | 4 errors | 2 errors |

The five-qubit code uses two more physical qubits per logical qubit to buy a factor-of-two improvement in both thresholds. This trade-off — more redundancy for stronger guarantees — is the central design tension of quantum error correction.

When detection is enough

Detection without correction is useful in several practical settings:

  1. Post-selection: if the syndrome flags an error, discard that run entirely. For low error rates this wastes few shots and keeps the surviving data clean. Many near-term quantum experiments use this strategy.
  2. Heralded errors: some hardware (e.g., ion traps with fluorescence detection) can announce that a qubit was lost or depolarised, converting a random error into a known erasure. An erasure is easier to correct than an unknown Pauli, so heralded detection enables correction with a smaller code.
  3. Threshold arguments: fault-tolerant thresholds for concatenated codes often assume that errors detected below the threshold are either corrected locally or removed by post-selection before being passed up the concatenation hierarchy.

What syndrome measurement actually gives you

Recall that a syndrome measurement projects the physical state onto an eigenspace of each stabiliser generator without disturbing the encoded logical information. The syndrome bits form a syndrome vector s{0,1}nk\mathbf{s} \in \{0, 1\}^{n-k} for an [[n,k,d]][[n, k, d]] code (encoding kk logical qubits into nn physical qubits).

For a distance-3 code, each single-qubit error pattern produces a unique non-zero syndrome, so the mapping from syndrome to recovery is unambiguous — correction works. For a distance-2 code, only detection is guaranteed: the syndromes can tell you that something went wrong, but not uniquely which qubit was affected.

The [[4,2,2]][[4, 2, 2]] code: a detection-only example

The smallest quantum code that detects any single-qubit error but cannot correct it is the [[4,2,2]][[4, 2, 2]] code, encoding 2 logical qubits into 4 physical qubits with distance 2. Its stabilisers are XXXXXXXX and ZZZZZZZZ. Any single-qubit Pauli anticommutes with at least one stabiliser, so a single error is always detected. However, two-qubit errors can map one codeword to another, so correction is impossible with this code alone.

The [[4,2,2]][[4, 2, 2]] code is widely used in near-term experiments precisely because it catches single errors cheaply — it is a minimal "smoke alarm" for the logical subspace, even though it cannot put out the fire.

Summary

| Property | Detection | Correction | |----------|-----------|-----------| | What it requires | d2d \geq 2 | d3d \geq 3 | | What it delivers | Flags an error | Reverses the error | | Typical response | Discard the shot | Apply recovery gate | | Minimum overhead | Cheaper (smaller dd) | More physical qubits |

Every quantum error-correcting code is also a quantum error-detecting code, but not vice versa. When you see a code described by its distance, the two formulas above immediately tell you both what it can detect and what it can correct.

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