wai-quantum 0.3.30: qLDPC memory at circuit level, re-derived from the circuit up #150

Merged
dcharlot merged 1 commit from wai-quantum-ldpc into main 2026-10-05 05:07:17 -04:00
Owner

Stacked on #148 (→ #147). Merge those first; this diff then reduces to the one commit.

What

This PR adds quantum_ldpc (wai-quantum 0.3.30). It re-derives the logical failure rates of bivariate-bicycle qLDPC memories (arXiv:2308.07915) from the circuit up.

  • Codes. Each code is built from its two polynomials: the check matrices, k by GF(2) rank, and a basis of logical operators. The five published presets all come out with their published k.
  • Circuit.
    • The depth-8 syndrome cycle is written as circuit text, in the published CNOT order.
    • Noise is circuit-level depolarizing on every CNOT, idle, preparation and measurement.
    • Two noiseless cycles close the run.
    • quantum_frame samples the circuit and derives its error model.
  • Decoder. BP-OSD, in f64 with in-crate logarithms, so a decode is the same bits on every machine.
    • Min-sum belief propagation in the log domain, with adaptive scaling.
    • On non-convergence, ordered statistics with a combination sweep of order 7.
  • Experiments. Runs are split into fixed chunks across threads (one thread on wasm32), and the tally does not depend on the thread count.

CLI: wai-quantum ldpc … and wai-quantum ldpc --circuit …. Example: ldpc_memory.

Checked against the source's own Apache-2.0 simulation software

  • Error model. For [[72,12,6]] over six cycles at p = 0.003, the source's decoding-matrix columns are reproduced exactly: 2,268 for X faults and 2,232 for Z faults.

    • Half the probabilities agree to 1e-13.
    • The largest gap is 0.94%, on merged faults: the source adds their probabilities, while this crate combines them as independent events.
  • Decoder. On identical syndromes and error model, the source's decoder makes the same decision as BpOsd on all 1,500 of 1,500 shots.

  • Failure rates per run on [[72,12,6]] (this crate combines the two halves as independent):

    p This crate Source's software
    0.003 0.028 0.034
    0.004 0.090 0.086
    0.005 0.230 0.209

    In the source's software the two halves fail together in 2.9% of runs, against 1.3% if they were independent. That accounts for most of the gap at p = 0.005.

  • Half by half at p = 0.005.

    • The Z-type half agrees: 0.122 against 0.118.
    • The X-type half is 0.121 here (20,000 shots) against 0.111 (9,000 runs), a 2.3σ difference.
    • Swapping in the source's priors makes no difference (476 against 478 failures out of 4,000), and both samplers match the exact detector rates. The residual is therefore in sampling. It is documented as open, not explained away.
  • [[144,12,12]].

    • Per run: 0.034 and 0.180 here, against 0.039 and 0.193 from the source's software, at p = 0.004 and 0.005.
    • Per cycle, the rates land on the published fit: 2.90e-3 against 3.15e-3, and 1.64e-2 against 1.54e-2.
  • Determinism.

    • The new pin holds natively and under wasm32-wasip2; all 15 pins pass.
    • CLI output is byte-identical natively and under WASI, including threaded against not threaded.
    • This caught a wasm32 thread-spawn panic, now fixed by running one thread on wasm32.
  • Lint and prose. Clippy is clean on the new code, and the comparative-prose and vanity-metric checks pass.

🤖 Generated with Claude Code

Stacked on #148 (→ #147). Merge those first; this diff then reduces to the one commit. ## What This PR adds `quantum_ldpc` (wai-quantum 0.3.30). It re-derives the logical failure rates of bivariate-bicycle qLDPC memories (arXiv:2308.07915) from the circuit up. - **Codes.** Each code is built from its two polynomials: the check matrices, `k` by GF(2) rank, and a basis of logical operators. The five published presets all come out with their published `k`. - **Circuit.** - The depth-8 syndrome cycle is written as circuit text, in the published CNOT order. - Noise is circuit-level depolarizing on every CNOT, idle, preparation and measurement. - Two noiseless cycles close the run. - `quantum_frame` samples the circuit and derives its error model. - **Decoder.** BP-OSD, in `f64` with in-crate logarithms, so a decode is the same bits on every machine. - Min-sum belief propagation in the log domain, with adaptive scaling. - On non-convergence, ordered statistics with a combination sweep of order 7. - **Experiments.** Runs are split into fixed chunks across threads (one thread on wasm32), and the tally does not depend on the thread count. CLI: `wai-quantum ldpc …` and `wai-quantum ldpc --circuit …`. Example: `ldpc_memory`. ## Checked against the source's own Apache-2.0 simulation software - **Error model.** For `[[72,12,6]]` over six cycles at `p = 0.003`, the source's decoding-matrix columns are reproduced exactly: 2,268 for X faults and 2,232 for Z faults. - Half the probabilities agree to 1e-13. - The largest gap is 0.94%, on merged faults: the source adds their probabilities, while this crate combines them as independent events. - **Decoder.** On identical syndromes and error model, the source's decoder makes the same decision as `BpOsd` on all 1,500 of 1,500 shots. - **Failure rates per run on `[[72,12,6]]`** (this crate combines the two halves as independent): | p | This crate | Source's software | |---|---|---| | 0.003 | 0.028 | 0.034 | | 0.004 | 0.090 | 0.086 | | 0.005 | 0.230 | 0.209 | In the source's software the two halves fail together in 2.9% of runs, against 1.3% if they were independent. That accounts for most of the gap at `p = 0.005`. - **Half by half at `p = 0.005`.** - The Z-type half agrees: 0.122 against 0.118. - The X-type half is 0.121 here (20,000 shots) against 0.111 (9,000 runs), a 2.3σ difference. - Swapping in the source's priors makes no difference (476 against 478 failures out of 4,000), and both samplers match the exact detector rates. The residual is therefore in sampling. It is documented as open, not explained away. - **`[[144,12,12]]`.** - Per run: 0.034 and 0.180 here, against 0.039 and 0.193 from the source's software, at `p = 0.004` and `0.005`. - Per cycle, the rates land on the published fit: 2.90e-3 against 3.15e-3, and 1.64e-2 against 1.54e-2. - **Determinism.** - The new pin holds natively and under wasm32-wasip2; all 15 pins pass. - CLI output is byte-identical natively and under WASI, including threaded against not threaded. - This caught a wasm32 thread-spawn panic, now fixed by running one thread on wasm32. - **Lint and prose.** Clippy is clean on the new code, and the comparative-prose and vanity-metric checks pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
wai-quantum 0.3.28: the dense state vector at any angle, the same bits threaded or not
Some checks failed
standards workspaces build + test / proof-rs (pull_request) Successful in 1m13s
standards workspaces build + test / joule-code-rs (pull_request) Successful in 1m20s
standards workspaces build + test / joulecontract-rs (pull_request) Successful in 50s
standards workspaces build + test / sandbox-rs (pull_request) Successful in 2m10s
standards workspaces build + test / map-rs (pull_request) Successful in 59s
standards workspaces build + test / mesh-rs (pull_request) Successful in 44s
standards workspaces build + test / smart-byte-rs (pull_request) Successful in 3m38s
standards workspaces build + test / openpay (pull_request) Successful in 3m11s
WAI conformance / cargo-class corpora · linux (pull_request) Successful in 3m56s
WAI conformance / v2 vocabulary · manifests validate as stated (pull_request) Successful in 13s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Successful in 5m6s
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Successful in 2m11s
WAI conformance / cross-arch byte-equality · linux (pull_request) Successful in 24s
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Successful in 38s
WAI conformance / C2PA manifest emission · signed, read back, validated (pull_request) Successful in 44s
WAI energy receipts / energy receipts · linux (pull_request) Successful in 1m13s
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Successful in 2m7s
WAI JPEG-AI whole decode (pinned inputs, required) / fetch pinned JPEG-AI inputs → whole decode + pixel hash, required (pull_request) Successful in 57s
WAI neural sink gates / model-free refusals of the neural sink (pull_request) Successful in 1m2s
WAI mbt2018_mean integer decode (regenerated vectors) / regenerate mbt2018_mean integer vectors → Rust decode, required (pull_request) Successful in 3m57s
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Successful in 1m44s
standards workspaces build + test / arl-rs (pull_request) Successful in 23m30s
standards workspaces build + test / joule-ui-rs (pull_request) Successful in 28m45s
standards workspaces build + test / jouledesk-rs (pull_request) Successful in 23m46s
standards workspaces build + test / joulehook-rs (pull_request) Successful in 22m26s
standards workspaces build + test / sense-rs (pull_request) Successful in 18m49s
standards workspaces build + test / macOS energy backends (pull_request) Failing after 13m54s
WAI conformance / cargo-class corpora · macos (pull_request) Successful in 25m26s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 1m17s
WAI energy receipts / energy receipts · macos (pull_request) Successful in 12m58s
38a205ee33
The byte-exact simulator is fixed-point and dyadic by design. quantum_sv is
the general state vector for everything else (arbitrary rotations, sqrt W,
fSim, random unitaries), and the ground truth approximate methods are
measured against, up to about 30 qubits.

- Split real and imaginary arrays; qubit 0 most significant, as in the
  tensor networks.
- Kernels: unrolled one- and two-qubit, general k-qubit, and a diagonal
  fast path.
- Fusion around multi-qubit gates: pending one-qubit gates join the next
  multi-qubit gate on their qubit, trailing ones the last, and above width 2
  adjacent multi-qubit gates merge. Each move only crosses gates on other
  qubits.
- Threads, with no unsafe code: block-aligned slices, and for gates on the
  top qubits a split at the top target bit, or into four quarters for
  adjacent pairs.
- Every path computes each amplitude through one row sum in one order, so
  threading never changes a bit. The native-vs-WASI pin caught a path whose
  sum ran in a different order; the fix is the shared row_dot, and a test
  now forces 1/2/3/8/32 threads and demands identical states (falsified by
  reversing one kernel's sum).
- Reductions (norm, Pauli expectations, sorted-uniform sampling) are summed
  in fixed chunks.

gates: Gate moves here from quantum_tn (re-exported there), with the
standard gates by name: H, X, Y, Z, S, T, sqrt X/Y/W, RX/RY/RZ, phase, CX,
CZ, SWAP, iSWAP, CPhase, RZZ, fSim.

Checked:
- final states of random circuits on 8, 12 and 16 qubits agree with an
  independent simulator to 2e-16 at fusion widths 0, 2 and 4;
- tensor-network amplitudes equal the state vector's to 1e-12 on 18 qubits
  (tests/tn_vs_sv.rs);
- a 26-qubit, depth-20, 770-gate circuit runs in about 9 s at width 2, in
  double precision.

CLI: wai-quantum sv --file CIRCUIT.jsonl [--fuse --top --sample --expect
--json]; tn shares its circuit reader. Byte-identical natively and under
wasm32-wasip2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
wai-quantum 0.3.29: the architecture around the code, priced, and the 2025 factoring machine re-run
All checks were successful
no-vanity-metrics / WAI public text names no company or product (pull_request) Successful in 3s
standards workspaces build + test / mesh-rs (pull_request) Successful in 35s
standards workspaces build + test / eoc-rs (pull_request) Successful in 1m54s
standards workspaces build + test / openpay (pull_request) Successful in 2m8s
standards workspaces build + test / jcp-rs (pull_request) Successful in 1m27s
standards workspaces build + test / proof-rs (pull_request) Successful in 1m13s
standards workspaces build + test / sandbox-rs (pull_request) Successful in 2m25s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Successful in 4m43s
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Successful in 33s
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Successful in 1m33s
standards workspaces build + test / smart-byte-rs (pull_request) Successful in 3m43s
WAI conformance / cargo-class corpora · linux (pull_request) Successful in 3m57s
WAI conformance / v2 vocabulary · manifests validate as stated (pull_request) Successful in 13s
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Successful in 2m15s
WAI conformance / cross-arch byte-equality · linux (pull_request) Successful in 23s
WAI conformance / C2PA manifest emission · signed, read back, validated (pull_request) Successful in 44s
WAI energy receipts / energy receipts · linux (pull_request) Successful in 1m15s
WAI JPEG-AI whole decode (pinned inputs, required) / fetch pinned JPEG-AI inputs → whole decode + pixel hash, required (pull_request) Successful in 1m2s
WAI neural sink gates / model-free refusals of the neural sink (pull_request) Successful in 1m5s
WAI mbt2018_mean integer decode (regenerated vectors) / regenerate mbt2018_mean integer vectors → Rust decode, required (pull_request) Successful in 3m52s
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Successful in 1m49s
standards workspaces build + test / arl-rs (pull_request) Successful in 15m11s
standards workspaces build + test / joule-ui-rs (pull_request) Successful in 10m2s
standards workspaces build + test / jouledesk-rs (pull_request) Successful in 15m36s
standards workspaces build + test / joulehook-rs (pull_request) Successful in 11m32s
standards workspaces build + test / sense-rs (pull_request) Successful in 10m53s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 14m5s
WAI conformance / cargo-class corpora · macos (pull_request) Successful in 12m15s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 43s
WAI energy receipts / energy receipts · macos (pull_request) Successful in 2m44s
80335672ed
quantum_arch prices what has cut projected fault-tolerant cost since 2023
without a better qubit:

- Yoked storage (arXiv:2312.04522): plain, row-yoked and grid-yoked patches,
  cold and hot, under the published path-counting fits (SI1000, uniform,
  and the refit used by arXiv:2505.15917). The layout search matches the
  source's own footprint tool on all 915 layouts it produces (three fit sets,
  61 targets, five storage kinds): distance, block shape, check period and
  qubits per logical qubit.
- Whole-block storage plans: copies of one shape plus one remainder block,
  capped at the block sizes the fits were drawn from.
- Magic-state cultivation (arXiv:2409.17595), read off the published
  end-to-end curves (Apache-2.0 data), interpolated log-linearly; refuses
  unsimulated noise strengths.
- 8T-to-CCZ factories and a clock set by the slowest of lattice surgery, the
  CCZ supply and the control loop; it says which one binds.
- The factoring workload of arXiv:2505.15917: its operation tallies, logical
  qubits and Toffoli counts. Under the source's counting rule the counts match
  its reference implementation to its rounding of half operations, for every
  tabulated key size (1024 to 8192 bits).

Re-running the 2048-bit estimate reproduces its 897,864 qubits from its
layout and its 429.03 qubits per cold logical qubit from its fit. It also
finds six places where the source disagrees with itself:
- its tallies at its stated durations give 10.62 h per shot, not 12.07 h;
- its hot-storage count (131) sits below its own peak formula (152);
- its reference counting code prices a 6-bit phaseup at 0.25 Toffolis, not
  8 (+1.7%);
- loop 4's table swaps additions and lookups relative to its code;
- its 30,000 qubit-rounds per 10^-7 T state is 22,600 in the data behind the
  figure;
- 1280 cold qubits need seven whole blocks (582,624 qubits), not 550,400.
With every correction the machine is 958,480 qubits and 4.3 days: the
conclusion holds.

CLI: wai-quantum arch factoring|storage|cultivate [--json]. Example:
arch_factoring. Pinned bit for bit natively and under wasm32-wasip2; CLI
output byte-identical across the two.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
wai-quantum 0.3.30: qLDPC memory at circuit level, re-derived from the circuit up
All checks were successful
standards workspaces build + test / joulecontract-rs (pull_request) Successful in 57s
standards workspaces build + test / jcp-rs (pull_request) Successful in 1m31s
standards workspaces build + test / map-rs (pull_request) Successful in 1m0s
standards workspaces build + test / mesh-rs (pull_request) Successful in 53s
standards workspaces build + test / proof-rs (pull_request) Successful in 1m17s
standards workspaces build + test / sandbox-rs (pull_request) Successful in 2m16s
standards workspaces build + test / openpay (pull_request) Successful in 3m21s
standards workspaces build + test / smart-byte-rs (pull_request) Successful in 3m42s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Successful in 6m17s
WAI conformance / cargo-class corpora · linux (pull_request) Successful in 3m55s
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Successful in 46s
WAI conformance / v2 vocabulary · manifests validate as stated (pull_request) Successful in 14s
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Successful in 1m49s
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Successful in 2m11s
WAI conformance / cross-arch byte-equality · linux (pull_request) Successful in 27s
WAI conformance / C2PA manifest emission · signed, read back, validated (pull_request) Successful in 51s
WAI energy receipts / energy receipts · linux (pull_request) Successful in 1m16s
WAI JPEG-AI whole decode (pinned inputs, required) / fetch pinned JPEG-AI inputs → whole decode + pixel hash, required (pull_request) Successful in 59s
WAI neural sink gates / model-free refusals of the neural sink (pull_request) Successful in 1m1s
WAI mbt2018_mean integer decode (regenerated vectors) / regenerate mbt2018_mean integer vectors → Rust decode, required (pull_request) Successful in 3m55s
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Successful in 1m49s
standards workspaces build + test / arl-rs (pull_request) Successful in 5m19s
standards workspaces build + test / joule-ui-rs (pull_request) Successful in 14m5s
standards workspaces build + test / jouledesk-rs (pull_request) Successful in 8m51s
standards workspaces build + test / joulehook-rs (pull_request) Successful in 9m50s
standards workspaces build + test / sense-rs (pull_request) Successful in 7m24s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 15m33s
WAI conformance / cargo-class corpora · macos (pull_request) Successful in 10m57s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 1m0s
WAI energy receipts / energy receipts · macos (pull_request) Successful in 4m13s
c403edbbdc
quantum_ldpc re-derives the logical failure rates of bivariate-bicycle
memories (arXiv:2308.07915) from scratch:

- Codes from their two polynomials: check matrices, k by GF(2) rank, a basis
  of logical operators. Presets [[72,12,6]], [[90,8,10]], [[108,8,10]],
  [[144,12,12]] and [[288,12,18]] all come out with their published k.
- The depth-8 syndrome cycle as circuit text: the published CNOT order, X and
  Z checks interleaved, circuit-level depolarizing noise on every CNOT, idle,
  preparation and measurement, two noiseless closing cycles, observables from
  the logical basis. quantum_frame samples it and derives its error model.
- BP-OSD: min-sum belief propagation in the log domain with adaptive scaling
  1 - 2^-t, then ordered statistics on non-convergence (information set in
  posterior order, combination sweep of order 7, cost sum ln(1/p)), in f64
  with in-crate logarithms.
- Memory experiments in fixed 64-shot chunks across threads (one on wasm32);
  the tally does not depend on the thread count.

Checked against the source's own Apache-2.0 simulation software:
- the error model for [[72,12,6]] (six cycles, p = 0.003) has its columns
  exactly, 2,268 X-fault and 2,232 Z-fault; half the probabilities agree to
  1e-13, the largest gap is 0.94% (merged faults: sums vs independent);
- on identical syndromes and error model, its decoder makes the same
  decision as BpOsd on 1,500 of 1,500 shots;
- failure rates per run on [[72,12,6]]: 0.028/0.090/0.230 here vs
  0.034/0.086/0.209 at p = 0.003/0.004/0.005 (halves combined as
  independent; the source's halves fail together 2.9% vs 1.3%);
- half by half at p = 0.005 the Z-type agrees (0.122 vs 0.118); the X-type is
  0.121 here (20,000 shots) vs 0.111 (9,000 runs), 2.3 sigma. Priors make no
  difference (476 vs 478 of 4,000) and both samplers match the exact detector
  rates, so the residual is in sampling and is documented as open;
- [[144,12,12]] per run 0.034 / 0.180 vs 0.039 / 0.193 at p = 0.004 / 0.005;
  per cycle on the published fit (2.90e-3 vs 3.15e-3, 1.64e-2 vs 1.54e-2).

CLI: wai-quantum ldpc [--code --p --cycles --shots --basis --max-iter
--osd-order --threads --seed --json] and ldpc --circuit. Example:
ldpc_memory. Pinned bit for bit natively and under wasm32-wasip2 (15 pins);
CLI output byte-identical across the two, including threaded vs not.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Transaction-Science/open-standards!150
No description provided.