qecscreen / M0 interactive GitHub ↗
Empirical Benchmark · Quantum LDPC Screening

Why Φ = kd²/n Picks the Wrong Quantum Codes

Automated quantum code discovery loops generate thousands of candidate LDPC codes, then filter them with a static math shortcut. qecscreen measures real circuit-level logical error rates across 242 bivariate bicycle codes to test what actually separates strong codes from noisy traps.

Pushkar Kumar · MIT ADT University 242 BB codes (n ≤ 72, p = 0.002) 76.3 CPU core-hours · Stim + BP+OSD
Pre-Registered Headline Criterion · FAIL

Can LightGBM catch the top 10 codes inside its top 30 picks better than Φ? On a strict leave-one-program-out split, the model caught 2/10 (0.200 [0.000, 0.600]) while Φ caught 0/10 (0.000). Because the 95% bootstrap interval for Model − Φ includes zero, we record an honest FAIL — never rounded up.

Kill Condition Not Met · PROCEED to M1

Shutting the project down required Φ to already rank codes well and the model's lead to vanish. Neither happened: across all 242 codes, LightGBM's Spearman correlation is 0.871 vs. Φ's 0.242 — proving cheap structural features carry strong circuit-level signal while exposing a single-template bottleneck in M0.

01 · The Screening Bottleneck

Cheap Static Math vs. Real Circuit-Level Noise

Physical qubits fail constantly from gate errors, stray heat, and noisy measurements. A quantum error-correcting (QEC) code protects a smaller number of reliable logical qubits by spreading them across many noisy physical data qubits, watched over by helper ancilla qubits that repeatedly check parity without reading the quantum state itself.

Modern search loops — including AI- and RL-guided discovery — can propose thousands of candidate quantum LDPC codes in hours. Properly testing even one candidate at the circuit level (simulating tens of thousands of noisy runs in Stim and decoding every syndrome with BP+OSD) takes minutes to hours. Measuring just 242 small codes in M0 took 76.3 CPU core-hours.

To cope, search loops screen candidates first with a back-of-the-envelope formula: Φ = k · d² / n. The catch is that Φ is blind to hardware reality — it rewards packing more logical qubits k while ignoring how heavy, deep, and noisy the error-checking circuit becomes.

n
Data Qubits
Physical qubit budget storing the code (M0 exhaustively covers n ≤ 72).
k
Logical Qubits
Protected qubits encoded inside the block, computed by exact GF(2) rank.
d_upper
Distance Bound
Randomized search upper bound (true d ≤ d_upper; never called exact, INV-5).
Φ = kd²/n
Incumbent Proxy
Fast algebraic score. Rewards high k while ignoring check weight and gate depth.
true_ler
Measured LER
Real failure rate per round, per logical qubit under circuit noise. Lower is better.
Interactive Lab 01 · Static Proxy vs. Gate Reality
The Φ = kd²/n Trap Calculator
Pick a real measured M0 code or drag the sliders. Watch Φ stay completely blind as check weight w doubles the noisy two-qubit CX gates per round.
Static Proxy Φ (what old search loops see) 1.36 / 7.50
Circuit Gate-Noise Pressure (CX gates / round) 288 CX · 10 ticks
Static Proxy Φ
1.36
k · d_upper² / n
CX Gates / Round
288
n · w noisy 2-qubit gates
Round Depth
10 ticks
2w + 2 pinned schedule
M0 Measured LER
1.80e-4
Measured at p = 0.002
02 · Structural & Circuit Physics

Tanner Graphs, Short Cycles & Syndrome-Extraction Depth

Every CSS quantum LDPC code is defined by two sparse binary parity-check matrices over GF(2): H_X (detects Z phase flips) and H_Z (detects X bit flips). Drawn as a network, each matrix forms a Tanner graph connecting data qubits to parity checks.

Computing the 28 features in m0_features.parquet takes milliseconds per code, yet captures the physical mechanisms that Φ misses:

Interactive Lab 02 · Graph Topology & Circuit Playhead
Clickable Tanner Graph, 4-Cycles & Live Round Schedule
Click data qubits (q0–q7) to toggle bit-flip faults, switch between light and heavy check layouts, highlight a 4-cycle loop, or hit Animate 1 Round to watch CX layers execute across ticks.
Data Qubit (click) Fault / Fired Check 4-Cycle Loop Active CX Tick
Check Weight (w)
4.0
Data qubits per check
4-Cycles in Graph
4
Short BP-stalling loops
Fired Checks
2 / 4
Odd-parity alarms
Round Depth
10 ticks
X-phase then Z-phase
Pinned Syndrome-Extraction Schedule (bb_monomial_matching_xz_phased_v2)
03 · Ground-Truth Measurement & Cost Asymmetry

Why the Best Codes Cost 40× More to Verify

Every M0 label was measured under one exact, hashed protocol (protocol_hash 6230a7a8…): uniform depolarizing noise at p = 0.002, Z-basis memory for r = d_upper rounds, sampled in Stim 1.16.0 and decoded with ldpc 2.4.1 BP+OSD (min-sum, 30 iterations, scaling 0.625, OSD-CS order 10).

To keep statistical error bars tight without wasting CPU hours on weak codes, each code runs in 256-shot batches until it records at least 100 logical failures, stopping at a cap of 40,960 shots. If a code hits 40,960 shots with fewer than 100 failures, INV-3 refuses to report a thin point estimate: the row is marked censored (true_ler = null), excluded from regression training, and ranked conservatively by its 95% Wilson upper bound (true_ler_ub).

This creates a stark cost asymmetry: across all 242 codes, the median code finished in just 1,024 shots — whereas the 10 best codes required 24,320 to 40,960 shots each. Good screening prevents burning those 40,000-shot budgets on bad candidates.

Interactive Lab 03 · Adaptive Sampling & INV-3 Censoring
Live 256-Shot Batch Sampler & Convergence Curve
Compare how quickly weak M0 codes finish against the top #1 code and the censored #2 code (93 failures in 40,960 shots). Watch the live normalized LER (INV-4) converge inside its 95% Wilson band.
Observed Logical Failures (stop at 100) 0 / 100
Simulated Shots (hard cap: 40,960 = 160 batches) 0 / 40,960
Normalized LER (INV-4)
—
Waiting for batches…
Row Status (INV-3)
READY
M0 median: 1,024 · Top 10: 24k–41k
LIVE ESTIMATE & 95% WILSON BAND 0 batches
Running LER Estimate 95% Wilson CI Band True Underlying Rate
04 · Real Milestone 0 Measurements

Watch the Top 10 Codes Glide Across Screening Scores

M0 exhaustively enumerated every admissible BB code with n ≤ 72 and d_upper ≥ 3 across 11 templates (244 codes; two mixed_3_5 codes with l = 2 had cancelling monomials x³ = x and were excluded under D-036, leaving 242 measured rows).

Below are 40 real M0 codes taken verbatim from evidence/m0-verdict/2026-10-03-1131f10/m0_results.json — including all 10 true top-10 codes (★). Switch the horizontal axis and watch every dot animate to its new rank: under Φ = kd²/n, all 10 winners pile up on the far left; switch to −Check Weight and watch them glide straight toward the bottom-right ideal corner.

Interactive Lab 04 · Real M0 Dataset Explorer (40 Measured Codes)
Static Proxy Φ vs. Single Structural Features vs. Ground Truth
Switch the X-axis to watch all 40 codes smoothly re-sort. Hover for quick telemetry or click any point to pin its exact m0_results.json record below.
★ True Top-10 (all pair_2_2, w=4, k=2) Lighter templates (w = 4–5) Medium templates (w = 6–7) Heavy template (mixed_3_5, w = 8, above threshold)

Official M0 Scoreboard (All 242 Codes, Leave-One-Program-Out)

Exact numbers from spec/evals.md §7 and m0_results.txt (95% paired bootstrap over codes, 1,000 resamples, seed 20261001; label-noise ceiling over 1,000 Beta draws, seed 20261002).

Metric (242 codes, leave-one-program-out) LightGBM Model Φ (from d_upper) Model − Φ
Recall@30-of-top-10 (pre-registered headline) 0.200 [0.000, 0.600] 0.000 [0.000, 0.000] 0.200 [0.000, 0.600]
Recall@30-of-top-10 (censored code excluded) 0.100 0.000 —
Spearman rank correlation (global ordering) 0.871 [0.838, 0.894] 0.242 [0.118, 0.354] +0.629 [0.521, 0.750]
Spearman (censored code excluded) 0.870 0.243 —
Label-noise ceiling (Recall@30-of-top-10) 1.000 [1.000, 1.000] — —
05 · Diagnosis of the Headline Fail

One Held-Out Fold Decided All Ten Winners

Why did LightGBM score an impressive 0.871 Spearman across all 242 codes, yet catch only 2 of the top 10? The answer is structural — not measurement noise (the label-noise ceiling is a perfect 1.000).

Because random row splits leak near-duplicate siblings from the same polynomial recipe (INV-2), M0 evaluates strictly leave-one-program-out across the 11 construction programs. As it turned out, all 10 of the lowest-error codes came from one single template, bb_v1_pair_2_2 (weight 4, k = 2). When pair_2_2 is held out, LightGBM trains exclusively on heavier templates (w ≥ 5) and must extrapolate cold to every single top-10 winner in one fold.

Meanwhile, Φ scored exactly 0.000 because every top-10 code has k = 2 and Φ ≤ 1.64 — buried behind at least 70 higher-k, higher-Φ codes with worse error rates.

Interactive Lab 05 · Evaluation Hygiene & Threshold Diagnostic
Leave-One-Program-Out Fold Explorer & Per-Template Size Scaling
Click any of the 11 M0 construction programs to hold it out as the test fold (vermilion) while LightGBM trains on the other 10 (cobalt). Notice how pair_2_2 alone holds 10/10 winners — and compare each template's sub-threshold scaling ρ(d_upper, true_ler) below.
Training folds: 177 codes (10 programs) Held-out test: 65 codes (pair_2_2)
Per-Template Size Scaling Diagnostic · ρ(d_upper, true_ler) ← Negative = clean sub-threshold · Positive / 0 = fails →
06 · Scientific Rigor & What Comes Next

Six Automated Invariants & the Path to M1

Scientific ML benchmarks rarely fail loudly; they fail silently through data leakage, mixed simulation settings, or rounded-up claims. Every core rule in CONTRACT.md is enforced automatically by pytest (427 default tests passing):

INV-1 · Truth ≠ Surrogate

Separated Measurements

true_* labels and pred_* model outputs never share a file or column. A prediction is never presented as a real error rate.

INV-2 · Leakage Guard

Grouped Splits Only

Random train_test_split on code rows is blocked by source-grep tests. Splits group by construction_program_id (and by family from M2).

INV-3 · Censoring

Bounds, Not Thin Guesses

Fewer than 100 failures triggers censored = True and true_ler = null; excluded from fits and ranked by true_ler_ub.

INV-4 · Normalization

One LER Formula

1 − (1 − P_L)^(1/(r·k)) lives exclusively inside protocol.py, guarded by a self-tested source-grep check.

INV-5 · Distance Honesty

Bounds Never Called Exact

Randomized search produces d_upper (d ≤ d_upper). d_exact stays null unless provably exact; proxy is phi_from_d_upper.

INV-6 · Protocol Hash

No Mixed Protocols

Every row carries a SHA-256 protocol_hash. Metric and training functions raise ValueError if two protocols are ever combined.

Roadmap (Plans, Not Results — M1 Has Not Started)

Milestone Planned Scope How It Resolves M0 Findings
M1 · Dataset v0.1 (Next) Generalized Bicycle (GB) & Hypergraph Product (HGP) codes · 3 qubit budgets · 3 values of p · ~2,000 rows · Zenodo DOI Eliminates the single-template top-10 bottleneck; filters colliding monomials before pinning; measures decode cost per new regime.
M2 · Benchmark & Baselines Frozen cross-family splits · scoring CLI · research preprint Establishes held-out code family as the headline metric and measures model refit variance explicitly.
M3 · GNN Surrogate Tanner-graph GNN evaluated head-to-head against LightGBM and Φ Tests whether message passing directly on the bipartite parity-check graph beats tabular features out-of-family.
M4 · Package & Outreach Pip-installable score(code) API · worked search-loop example Drops circuit-aware screening straight into automated QEC code-discovery pipelines.