69. Project 4 — Error Correction Laboratory
Implement: three-qubit code, five-qubit code, Steane code, surface code, syndrome extraction, decoder, logical error measurement. (Chapters 32–37; Ch. 37's project spec is the deep version.)
Specification. A package qec with: (1) stabilizer formalism utilities (Pauli strings, tableau or commutation checks); (2) the codes — 3-qubit repetition (bit-flip), 5-qubit perfect code, Steane [[7,1,3]], and rotated surface code at d=3 and d=5 (distance-3 buildable by hand; d=5 via stim-generated circuits); (3) syndrome extraction circuits — ancilla-measure blocks per stabilizer (verify: measuring the syndrome doesn't disturb the encoded logical state beyond the correctable subspace); (4) decoders: lookup table for the small codes, and MWPM (minimum-weight perfect matching — via PyMatching or your own blossom-lite, plus a maximum-likelihood decoder for d=3 where brute-force works) for the surface code; (5) logical error measurement: prepare |0⟩_L or |+⟩_L, run memory rounds under circuit-level noise, decode, measure logical failure rate vs. distance and physical error rate.
Milestones. M1: 3-qubit code corrects all single bit flips; logical error measured, matches theory (p_L ≈ 3p²). M2: 5-qubit and Steane codes encode/decode correctly; distance-3 error correction verified exhaustively (all 1-qubit Paulis). M3: surface-code d=3 syndrome circuits correct; MWPM decoding above break-even. M4: d=3 vs. d=5 logical-error curves under depolarizing circuit noise — threshold behavior visible or its absence explained. M5: performance — 10⁴+ shots per point in minutes (numpy-vectorized or stim-backed), and the Λ factor (error suppression ratio per distance step) computed.
Acceptance criteria. Every code passes its distance-based guarantee test; logical-vs-physical error plots exist with ≥4 physical-error values × 2 distances, error bars, and fitted threshold estimate (expect ~0.5–1% for circuit-level depolarizing with your setup — and your README explains any deviation from literature values honestly); decoders benchmarked (accuracy vs. speed).
What it proves. Part X operationalized — you have personally measured error correction working and failing, the experience entire roadmaps are built on. Effort: 4–6 weekends; the most valuable project in this part.