Computing Library › Quantum Error Correction
Quantum Error Correction

Syndrome Extraction Circuits

An ancilla qubit and a few controlled gates measure a multi-qubit stabilizer as one classical bit without collapsing the logical state.

Reading a Pauli with an ancilla

To measure a stabilizer such as Z Z Z Z, prepare an ancilla in |0>, apply a controlled-Z-parity from each data qubit onto the ancilla (implemented with CNOTs), then measure the ancilla in the computational basis. The ancilla outcome is the parity: 0 for +1 eigenvalue, 1 for -1. The data qubits are projected onto the corresponding stabilizer eigenspace but are otherwise undisturbed.

python
# Measure Z0 Z1 Z2 Z3 into ancilla a
circuit.reset(a)
for q in (0,1,2,3):
    circuit.cx(q, a)   # accumulate Z-parity onto ancilla
circuit.measure(a, syndrome_bit)
Kronos motion — classical vs quantum

For an X-type stabilizer such as X X X X, sandwich the ancilla coupling in Hadamards, or use an ancilla prepared in |+> with the control and target roles swapped, so the ancilla accumulates X-parity instead.

Order and hazards

The order of the controlled gates matters. A poorly scheduled circuit lets a single ancilla fault spread into a multi-qubit error on the data, defeating the code. This is why practical designs use carefully ordered CNOT schedules and, for fault tolerance, more elaborate ancilla preparations.

Fault tolerance of the extraction itself

Because a single ancilla shared across a high-weight stabilizer can turn one gate error into many data errors, fault-tolerant protocols use verified cat states, flag qubits, or Shor- and Steane-style ancillas so that any single fault produces a correctable error. See fault-tolerant syndrome extraction. In the surface code, each stabilizer touches only four data qubits with a fixed CNOT schedule, keeping extraction simple and local.

Because measurements are noisy, extraction is repeated many times and the time-ordered syndromes are decoded jointly.