Skip to content

[P8-16] Use explicit binomial bounds for logical-error reports - #570

Merged
ruslan-splynx merged 1 commit into
mainfrom
codex/p8-16-logical-error-intervals
Oct 13, 2026
Merged

ruslan-splynx merged 1 commit into
mainfrom
codex/p8-16-logical-error-intervals

Conversation

@ruslan-splynx

Copy link
Copy Markdown
Collaborator

Closes #566.

Zero observed logical errors currently produce a Wald 0 ± 0, overstating the evidence. Add explicit two-sided, equal-tailed 95% Clopper–Pearson bounds for direct independent Bernoulli tallies: 0/1000 now yields [0, 0.003682], while zero shots yield [0, 1] and no estimate.

The existing Rust result fields and valid-input Wald half-width remain compatible. Add a checked tally constructor and reject invalid/numerically unreliable bound evaluations; the legacy infallible constructor preserves invalid counts with NaN sentinels. Quantiles use bounded bisection over statrs' checked beta function, with stable analytic boundary formulas. statrs with default features disabled is the only new lockfile package.

Threshold CSV appends explicit endpoints/method/evidence metadata. Its plot prefers asymmetric endpoints, omits zero-shot estimates, and shows zero-failure limits separately from the rate curve. Historical CSV widths retain their original meaning with a legacy notice. Comparison reports use named marginal overlap, without equivalence claims; the shared-shot MWPM/PyMatching report retains discordant pairs and uses a conditional exact binomial test instead of assuming independent rates. No weighted/correlated estimator or GPU/hardware API is silently reinterpreted.

Validation:

  • 7 Rust interval tests (including randomized counts and exact finite-sum coverage), 5 experiment tests, zero-noise memory integration test, and 2 doctests passed.
  • 3 Python CSV migration tests passed; actual 32-row zero-shot threshold CSV checked; zero-event/asymmetric-bound plot rendered and inspected.
  • 3633 intervals independently compared with SciPy 1.16.2, including rare-event counts at one billion shots: maximum endpoint difference 6.24e-13. Exact coverage minimum 0.9556901; 10 repeated-sampling points × 20,000 trials reported with simulation standard errors. No numerical rejections in the campaign.
  • Workspace all-target clippy, final QEC all-target clippy, rustfmt and diff checks passed.
  • The broad local QEC debug suite was intentionally interrupted after >7 minutes to release Mac CPU; it is not claimed as passed. Full CI remains pending.

See docs/qec/binomial-intervals.md for the migration inventory, statistical/numerical limits and reproduction commands, and docs/perf/data/p8-16-binomial-coverage.json for raw coverage/provenance. This is a statistical-correctness fix, with no execution-speed claim or GPU benchmark requirement. Independent branch from main; no draft #569 changes included. Draft pending CI and final review; no merge requested here.

Preserve valid-input Wald fields while providing explicit direct-sampling confidence endpoints. Validate boundary and rare-event coverage, migrate threshold reports, and retain paired decoder comparisons.
@ruslan-splynx
ruslan-splynx marked this pull request as ready for review October 13, 2026 17:08
@ruslan-splynx
ruslan-splynx merged commit 8c9223f into main Oct 13, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P8-16] Use valid logical-error intervals for zero and rare observed failures

1 participant