Degenerate Errors: Different Faults Can Need the Same Recovery
A four-qubit example shows when identical syndromes are harmless and when they hide a logical phase error. Test both cases with the Knill-Laflamme condition in NumPy.
A syndrome is often introduced as an error's address: measure the checks, look up the fault, apply its inverse.
That picture is useful, but it hides an important feature of quantum codes. Two different physical faults can act identically on every encoded state. A decoder does not need to tell those faults apart. Other faults can share a syndrome while changing the logical information in different ways, which is a genuine problem.
The trick is knowing which kind of ambiguity you have. Let's build a small example where both appear.
A four-qubit code with a deliberately limited job
Number the physical qubits from left to right, q1 through q4. Encode one logical qubit using
|0L> = (|0000> + |1111>) / sqrt(2)
and
|1L> = (|0011> + |1100>) / sqrt(2).
Both codewords have eigenvalue +1 under the three commuting stabilizer generators
XXXX, ZZII, and IIZZ.
Here a string means a tensor product, and I means identity. The three independent checks on four qubits leave a two-dimensional code space, enough for one logical qubit. Any encoded state is alpha |0L> + beta |1L>.
This is a distance-2 code. It can detect any single-qubit Pauli error, but it cannot correct an arbitrary unknown single-qubit error. We will first give it a narrower noise model: either no error occurs, or a Z fault occurs on q1 or q2. The limited promise matters throughout this example.
IBM's stabilizer-code lesson explains how commuting checks define the code space, and why error detection is not the same as successful correction.
Two faults that do not need separate labels
Write Z1 for ZIII and Z2 for IZII. Their product is
Z1 Z2 = ZZII.
That is one of our stabilizers, so it acts as identity on every encoded state. Multiplying that fact by Z1 gives
Z2 |psiL> = Z1 |psiL>.
This is stronger than saying the errors produce the same measurement result. They produce the same corrupted state for every logical input, including an unknown superposition.
Both faults anticommute with XXXX and commute with the two Z-type checks. Their syndrome, in our chosen generator order, is therefore (-1, +1, +1).
After that syndrome, applying Z1 repairs either fault. If the actual fault was Z1, the total operation is identity. If it was Z2, the total operation is ZZII, which is also identity on the code space.
This is the useful ambiguity called degeneracy relative to the error set: different physical errors need not have distinguishable effects on the encoded information. We are not claiming that this distance-2 code corrects all single-qubit faults or meets a stronger, distance-based definition of a degenerate code. Our claim concerns the specified errors {I, Z1, Z2}.
Same syndrome, but now a logical mistake
Now allow Z3, meaning IIZI, instead of assuming phase faults are confined to q1 and q2.
Z3 also anticommutes with XXXX and commutes with ZZII and IIZZ. Its syndrome is exactly the same as Z1's. However, their product is
Z1 Z3 = ZIZI.
This product leaves |0L> unchanged and multiplies |1L> by -1. It acts as a logical Z, not as a stabilizer. Applying the old Z1 recovery after a Z3 fault therefore gives
alpha |0L> - beta |1L>
instead of the original logical state. The syndrome has returned to (+1, +1, +1), yet the logical phase can be wrong.
For a logical |+L> input, the output is the orthogonal state |-L>. For |0L> alone, this test would reveal nothing. Testing a code only on its logical basis states can miss a phase error.
No recovery can perfectly correct the unknown alternatives Z1 and Z3 on every logical state. It is not just that our particular lookup table picked badly. The error-correction condition shows why.
The matrix test behind the intuition
Let C be the encoding isometry whose columns are |0L> and |1L>. Exact correction of an error set requires
C† Ea† Eb C = c_ab I
for every pair of errors Ea and Eb, where c_ab is a scalar that can depend on the pair. This is the Knill-Laflamme condition, stated equivalently using a code-space projector in the Error Correction Zoo.
The scalar does not have to be zero when the error labels differ. In our harmless pair, C† Z1† Z2 C = I. Requiring distinct errors always to have orthogonal images would incorrectly reject this valid restricted-noise correction scheme.
For the harmful pair, C† Z1† Z3 C = diag(1, -1). That is not proportional to identity, so the condition fails. The ambiguity now depends on the logical state rather than merely on which physical label we assigned to an equivalent error.
Verify it in NumPy
The following code uses leftmost-qubit-first tensor products and exact state evolution, up to floating-point precision. It checks all error pairs in each proposed set, not just one selected input.
import numpy as np
I = np.eye(2, dtype=complex)
X = np.array([[0, 1], [1, 0]], dtype=complex)
Z = np.diag([1, -1]).astype(complex)
paulis = {"I": I, "X": X, "Z": Z}
def op(word):
out = np.array([[1]], dtype=complex)
for letter in word:
out = np.kron(out, paulis[letter])
return out
basis = np.eye(16, dtype=complex)
zeroL = (basis[:, 0] + basis[:, 15]) / np.sqrt(2)
oneL = (basis[:, 3] + basis[:, 12]) / np.sqrt(2)
C = np.column_stack([zeroL, oneL])
checks = [op(w) for w in ["XXXX", "ZZII", "IIZZ"]]
Z1, Z2, Z3 = [op(w) for w in ["ZIII", "IZII", "IIZI"]]
assert np.allclose(C.conj().T @ C, I)
assert all(np.allclose(S @ C, C) for S in checks)
def syndrome(E):
return tuple(1 if np.allclose(S @ E, E @ S) else -1
for S in checks)
def correctable(errors):
for A in errors:
for B in errors:
block = C.conj().T @ A.conj().T @ B @ C
scalar = np.trace(block) / 2
if not np.allclose(block, scalar * I):
return False
return True
print("Z1, Z2, Z3 syndromes:",
[syndrome(E) for E in [Z1, Z2, Z3]])
print("{I, Z1, Z2} correctable:",
correctable([np.eye(16), Z1, Z2]))
print("{I, Z1, Z3} correctable:",
correctable([np.eye(16), Z1, Z3]))
plusL = (zeroL + oneL) / np.sqrt(2)
for label, E in [("Z2", Z2), ("Z3", Z3)]:
recovered = Z1 @ E @ plusL
fidelity = abs(np.vdot(plusL, recovered)) ** 2
print(f"Z1 recovery after {label}: fidelity {fidelity:.3f}")
The syndromes are all (-1, 1, 1). The first error set passes the condition, while the second fails. Recovery after Z2 has fidelity 1.000; recovery after Z3 has fidelity 0.000 for the logical-plus test state.
What a decoder really needs to identify
A decoder's job is not necessarily to reconstruct the exact physical fault. It needs a correction whose product with the actual Pauli fault is a stabilizer, up to an irrelevant overall phase.
That is why a shared syndrome can be either perfectly acceptable or dangerous. Stabilizer-equivalent faults need the same repair. Faults that differ by a nontrivial logical operator can require incompatible repairs even when all the checks agree.
The noise model decides which possibilities the decoder must handle. Our small code works exactly for the promised set and fails when that promise is broadened. On real hardware, noisy check extraction and imperfect recovery add further issues; none of those are included in this ideal calculation.
The useful question is not simply, "Did two errors get the same syndrome?" It is, "Do those errors differ only by something that acts trivially on the encoded information?"