|q⟩ Bad Qubits

advanced · Programming · Implementing the Surface Code

Detecting Errors as Syndromes

A single stabilizer measurement returns one bit. The full set of those bits, read together, is the syndrome — the code's report on what kind of error (if any) has occurred. The decoder never sees the data qubits; it sees only this stream of parity bits.

What a flipped check means

In the previous lesson a quiet Z0Z1Z_0 Z_1 check returned 00. Now suppose a bit-flip error X0X_0 strikes data qubit 00 between rounds. The data parity becomes odd, so when the ancilla copies it,

CNOT0aCNOT1a  X0000a=101a,\text{CNOT}_{0\to a}\,\text{CNOT}_{1\to a}\;X_0|00\rangle|0\rangle_a = |10\rangle\,|1\rangle_a,

and the syndrome bit reads 11. The check has fired. An XX error on either data qubit of a ZZ-type check flips that check; an XX error on a qubit shared by two ZZ-checks flips both. This is the whole detection mechanism: errors live on qubits, but they announce themselves on the checks that touch them.

Syndromes are differences in time

A subtle but essential point: a decoder does not act on the raw value of a check, but on whether it changed from the previous round. A check that reads 11 in two consecutive rounds usually signals a stable measurement artefact, not a freshly arrived error. So the detection event a decoder actually consumes is

detector=stst1,\text{detector} = s_t \oplus s_{t-1},

the XOR of a check's outcome in successive rounds. A new error produces a pair of detection events in spacetime — one when the error appears and one when it is later corrected or leaves — and matching those pairs is the job of the decoder we meet next.

Try it

Reproduce a single fired check. Inject a bit-flip on data qubit 00 with c.x(0), then run the Z0Z1Z_0 Z_1 extraction (c.cx(0, 2), c.cx(1, 2)) into ancilla qubit 22 and measure it. The data is now 10|10\rangle and the ancilla reports parity 11, so the only outcome is 101|101\rangle — syndrome bit 11, the check has fired.

Run your code to see the quantum state.

Compare with the quiet round of the previous lesson: there the bar sat at 000000; here it moves to 101101, and the ancilla bit has flipped from 00 to 11.

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