Surface codes. Decoded in real time.
The surface code is the leading candidate for fault-tolerant quantum computing on near-term hardware. QECSync turns the theory into a working runtime.
Plaquette stabilizer measurement
A surface code arranges physical qubits on a 2D lattice. Interspersed between the data qubits are ancilla qubits that perform stabilizer measurements — checking parity conditions on neighboring data qubits without disturbing their quantum state.
Each measurement cycle produces a syndrome: a bit string indicating which stabilizer measurements returned the wrong parity. An error — a bit flip or phase flip — perturbs adjacent stabilizers and leaves a detectable signature. The decoder's job is to infer the most likely error configuration from this syndrome.
The surface code's key property: errors must form connected paths to cause a logical failure. As long as the physical error rate stays below the fault-tolerance threshold (~1%), increasing the code distance (the lattice size) exponentially suppresses the logical error rate. This is the engineering ladder to practical fault-tolerant computation.
Syndrome measurement is performed by a Hadamard + CNOT + measurement circuit on each ancilla qubit each cycle. The measurements are imperfect — ancilla errors also appear in the syndrome — which is why temporal redundancy (repeated measurement rounds) is essential and why the decoder must process a 3D syndrome history (space + time).
MWPM and Union-Find
QECSync supports both leading surface-code decoder architectures. Device type, code distance, and latency budget determine which is optimal.
MWPM Decoder
Formulates syndrome decoding as a minimum-weight perfect matching problem on a syndrome graph. Vertices are syndrome events; edges have weights derived from the hardware error model. The Blossom V algorithm finds the minimum-weight matching in polynomial time.
- Near-optimal logical error rates
- Scales as O(n³) — latency-sensitive at large code distance
- Best for: high-accuracy requirements, moderate code distances
Union-Find Decoder
A near-linear time decoder that grows clusters around each syndrome event and merges them until all syndrome events are paired. Sacrifices a small amount of logical accuracy in exchange for dramatically lower decode latency.
- Near-linear complexity — sub-millisecond at code distance 7
- Accuracy ~0.1–0.5% below MWPM depending on noise model
- Best for: latency-constrained hardware, large code distances
Why ~1% physical error rate is the threshold
The fault-tolerance threshold is the physical error rate below which increasing the code distance reduces the logical error rate. Above the threshold, more qubits make things worse — not better.
The surface code threshold is typically quoted at ~1% for depolarizing noise. This is the theoretical limit for an ideal, hardware-agnostic decoder. Real devices have non-depolarizing, spatially correlated noise — which shifts the effective threshold.
QECSync's per-device decoder tuning incorporates measured gate error rates, T1/T2 coherence times, crosstalk maps, and readout fidelity into the decoder's edge weights. This brings the effective threshold of a calibrated QECSync instance above the generic 1% estimate for devices with spatially non-uniform noise.
Per-device noise modeling
Generic surface-code decoders assume uniform depolarizing noise. Real quantum hardware has spatially non-uniform error rates — qubit Q₃ may have a 2× higher T1-decay rate than Q₇, and gate G₂₃ may have a crosstalk contribution not present in G₁₂. A decoder blind to this structure will make systematically worse matching decisions than one that accounts for it.
QECSync accepts per-qubit and per-gate calibration data to construct device-specific edge weights in the MWPM syndrome graph — and the equivalent weighted Union-Find variant. The calibration pipeline accepts:
- —Per-qubit T1, T2* relaxation times from direct Ramsey/inversion-recovery experiments
- —Per-gate randomized benchmarking fidelities (single-qubit and two-qubit)
- —Readout assignment error matrices (per ancilla qubit)
- —Crosstalk characterization data (ZZ-coupling maps) where available
Dig deeper into the theory
Academic foundations →Ready to implement?
Read the integration guide and API reference to integrate QECSync with your hardware control stack.
Read the Docs