Skip to main content

Fault-tolerant algorithms, run end to end

CI

Shor's algorithm and molecular phase estimation, compiled to Clifford + T + Toffoli and run end to end on a simulated surface-code quantum computer whose every logical error rate was measured by circuit-level simulation. The results are success probabilities as functions of code distance, physical error rate and magic-state source, with error budgets that say which operations make the algorithm fail, and the same error model extrapolated to RSA-2048 and FeMoco.

  • Explainer site with a live demo (Shor for N = 15 and H₂ phase estimation running in your browser on WebAssembly): ft.jaspersands.com (source in site/).
  • Technical report: report/report.html · PDF. Every number in it is computed from the committed data by tools/report.py.

What is in it

layer what where
physical rotated surface code, SD6 circuit noise; memory, lattice-surgery merges and CNOTs simulated and decoded (correlated matching) stabilizer-qec
logical each operation's Pauli channel, extracted with baselines pushed through the operation; fits in d and p; logical Y from a reference-qubit experiment python/ftalgo/calib/
program Shor with full modular exponentiation (textbook Cuccaro, and windowed with measurement-based uncomputation); STO-3G chemistry from scratch for H₂ and HeH⁺, a PySCF CASSCF active space for LiH; iterative QPE with Suzuki-4 steps; gridsynth rotations python/ftalgo/{shor,arith,arith_modern,phase,qpe,synth}.py, chem/
machine per-qubit clocks, measured idle channel for every gap, decoder reaction time, magic-state factories (cited) python/ftalgo/{arch,schedule}.py
run ftsim: Rust state-vector Monte Carlo (sparse and dense), feed-forward, seeded, stratified by the exact number of faults; Python module and WebAssembly src/

Results

Calibration: 316 circuit-level experiments, 0.82 billion shots. Whole surgery experiments predicted from calibrated parts: 0.93–1.26× the measured failure rate (median 1.04×). Stim + PyMatching cross-check: 36 of 36 within 2.2σ.

Shor (Textbook Cuccaro) (p = 0.1%, cultivated magic states; peak probability = share of runs on one of the r ideal peaks):

N logical qubits Toffolis noiseless peak d for 90% of it physical qubits run time
15 18 3,360 1.000 13 55.4 k 225 ms
21 21 6,250 0.790 13 58.1 k 418 ms
35 24 10,440 0.790 15 63.4 k 808 ms
77 27 16,170 0.774 15 67 k 1.25 s
143 30 23,680 0.774 15 70.8 k 1.81 s

Shor (Modern Windowed + MBU) (p = 0.1%, cultivated magic states; 2.6–3.0× fewer Toffolis):

N logical qubits Toffolis noiseless peak d for 90% of it physical qubits run time
15 23 1,248 1.000 11 46.1 k 107 ms
21 27 2,390 0.793 13 47 k 298 ms
35 31 3,528 0.784 13 50.2 k 447 ms

Phase estimation (p = 0.1%, cultivated magic states; success = energy within chemical accuracy, 1.6 mHa, of the exact ground state of the Hamiltonian simulated):

molecule system qubits T gates per run noiseless d for 90% of it run time
H2 2 1.79e7 0.92 19 7.2 min
HeH+ 2 4.37e7 0.97 21 20.3 min
LiH, CAS(2, 2) 2 4.32e7 0.88 23 21.9 min

H₂ and HeH⁺ in STO-3G are simulated whole (tapered to 2 qubits). LiH is a deliberately small active space: Li 1s² frozen, two electrons in two CASSCF orbitals, 9 Pauli terms on 2 qubits; its exact energy is 1.3 mHa above full STO-3G FCI at R = 1.595 Å.

RSA-2048, this work's circuits (p = 0.1%, cultivated magic states, E[faults] ≤ 0.1; operation counts exact, schedule fitted on compiled instances, error rates extrapolated):

arithmetic calibration logical qubits Toffolis d physical qubits run time
Textbook Cuccaro separate measure and reset layers 6,150 3.44e11 35 32.5 M 1.96 years
Textbook Cuccaro one measure-and-reset layer 6,150 3.44e11 33 29 M 1.85 years
Modern windowed + MBU separate measure and reset layers 8,199 8.61e10 35 43.2 M 298 days
Modern windowed + MBU one measure-and-reset layer 8,199 8.61e10 33 38.5 M 281 days

Published estimates under the measured model (p = 0.1%; each at its authors' failure budget; distances only, since their qubit totals use layouts this model does not include):

workload failure budget published d d, measured model d, recalibrated with one measure-and-reset layer
RSA-2048, Gidney 2025 (one shot) 6.7% 25 29 27
FeMoco (THC), Lee et al. 2021 1.0% 31 31 29

Gidney 2025 picks d = 25 because his projection of surface-code memory reaches 1e-15 errors per patch per round there. The measured model (SD6 noise, correlated matching) reaches it at d = 29 (d = 27–29 within the fit's 1σ band). At the measured distances its rates are already 3.4–6.5× his projection, and the gap widens with d because the fitted suppression per two units of distance (Λ = 10.1 and 10.9 for the two bases) is below the projection's 12.25; at d = 25 the fit extrapolates to 1.30e-14 per patch-round (1σ: 9.95e-15–1.70e-14). One shot of his algorithm through the estimator needs d = 29 at his budget (d = 27 at 90%); the same estimator with his projection in place of the measured model returns d = 25. The table below shows how much of that gap is the circuit and noise model rather than his design.

Which memory model? Memories at p = 0.1% under other circuits and noise models, each decoded by correlated matching and fitted the same way (per-round rates from d and 3d rounds), against the projection:

memory model Λ (Z, X) measured to d rate ÷ projection there d, worse basis ≤ 1e-15 d, either basis ≤ 1e-15 d, one shot at his budget
SD6, as calibrated: separate measure and reset layers 10.8, 10.5 9 5.9× 27 29 27
SD6, one measure-and-reset layer 12.0, 11.8 9 3.2× 27 27 27
SI1000 on CZ, one measure-and-reset layer 11.6, 12.3 9 2.1× 27 27 27
uniform depolarizing, Stim's generated circuit 20.4, 15.9 9 0.3× 23 23 23
Gidney 2025 projection, 3.5^−d/40 12.25 — 1× 25 25 25

The distance that reaches 1e-15 per patch-round at p = 0.1% runs from d = 23 to d = 29 across these circuit-level models, and Gidney's d = 25 lies inside that range. SI1000, the noise model of the yoked-surface-code paper's simulations (arXiv:2312.04522), has the projection's slope here (Λ = 11.6–12.3) but a 2.1× higher rate at d = 9, and needs d = 27. Gidney 2025 labels the projection uniform depolarizing; Stim's generated circuit with every parameter at p, one reading of that which leaves qubits idle during gate layers noiseless, is below it. The calibration's circuit is the most pessimistic of the four: it depolarizes idle qubits in every layer and measures and resets the ancillas in separate layers, so data qubits idle through two of them each round. Merging them alone lowers the d = 9 rates 1.7–2.0× and raises Λ to ≈ 12, so every result here leans pessimistic by about that. (The SD6 row is the calibration's own memories fitted like the others, over d ≤ 9; with all its memory lengths and d = 11 the calibrated model needs d = 29.)

Recalibrated with one measure-and-reset layer. Every calibration experiment was rerun on the same circuits with each reset layer folded into the measurement layer before it (tools/calibrate.py --mr; data/calibration/raw_mr/, model_mr.json). Idling then has Λ = 11.6–12.5, reaches 1e-15 per patch-round at d = 27 (d = 27 at either 1σ edge), and one shot of Gidney's algorithm needs d = 27 at his budget. The tables above show both calibrations; the simulated algorithm runs (Shor, phase estimation) use the original one.

How it is checked

  • ftsim against Qiskit Aer (100 random circuits' amplitudes; exact noisy distributions, plain and stratified), dense against sparse, WebAssembly against native.
  • Arithmetic verified on every input by an independent bit-level simulator; Shor's noiseless output against the exact phase-estimation distribution; every synthesized rotation as a matrix.
  • Windowed arithmetic verified on every input the same way, including the measurement-based carry uncomputation and its feed-forward CZ fixups.
  • Scaling: the Toffoli and qubit counts used at RSA-2048 equal the compiled circuits' for every simulated N; the estimator, given Gidney 2025's own error projection and budget, returns his d = 25.
  • Chemistry against PySCF (integrals, HF and FCI to 1e-8 Ha) and Szabo & Ostlund; the LiH active-space Hamiltonian's ground energy equals PySCF's CASSCF(2, 2) to 1e-9 Ha.
  • Calibration against Stim + PyMatching; the reference-qubit experiment against plain memories; composition: whole surgery experiments predicted from their parts vs measured.
cargo test --lib --features parallel     # engine
.venv/bin/python -m pytest -q tests      # everything else
node tools/wasm-smoke.mjs                # WebAssembly = native

Reproduce

python3 -m venv .venv && .venv/bin/pip install maturin numpy scipy matplotlib pytest hypothesis \
    stabilizer-qec stim pymatching qiskit qiskit-aer pygridsynth pyscf
tools/build.sh                           # Rust engine → python/ftalgo/_ftsim.abi3.so
.venv/bin/python tools/calibrate.py      # circuit-level experiments (resumable, ~hours)
.venv/bin/python tools/fit_model.py      # data/calibration/model.json
.venv/bin/python tools/compose_check.py && .venv/bin/python tools/xcheck.py
.venv/bin/python tools/noise_models.py && .venv/bin/python tools/noise_models.py --summary   # SI1000, uniform (~1 h)
.venv/bin/python tools/run_shor.py && .venv/bin/python tools/run_shor_modern.py
.venv/bin/python tools/run_qpe.py && .venv/bin/python tools/run_lih.py
.venv/bin/python tools/scale.py && .venv/bin/python tools/sensitivity.py
.venv/bin/python tools/site_data.py && .venv/bin/python tools/report.py && .venv/bin/python tools/readme_tables.py
cargo build --release --target wasm32-unknown-unknown --lib && cp target/wasm32-unknown-unknown/release/ftsim.wasm site/wasm/

Every dataset records its seed and the versions that produced it.

Assumptions

Magic-state error rates and factory footprints (Litinski 2019; Gidney, Shutty & Jones 2024; Gidney 2025), the H and S operation model of the fast-block layout, 1 µs rounds and a 10 µs decoder reaction time are cited inputs, not measured here. Logical channels are measured up to d = 11 (idling) and d = 9 (surgery) at p = 0.1%; runs at larger distances use extrapolated channels and are marked as such, and every RSA-2048 and FeMoco number is an extrapolation. The calibrated circuit is stabilizer-qec's SD6 memory, which measures and resets ancillas in separate layers; with one measure-and-reset layer the same noise errs about half as often at d = 9 (see "Which memory model?"), so results lean pessimistic. See the report's Limitations.

MIT licensed. To cite it, see CITATION.cff.

Metadata

Release files for ftalgo 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ftalgo 0.1.0
File Size Uploaded Provenance Actions
ftalgo-0.1.0.tar.gz 196.9 kB With provenance Details for ftalgo-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for ftalgo 0.1.0
File Actions
ftalgo-0.1.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for ftalgo-0.1.0-cp39-abi3-win_amd64.whl
ftalgo-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details for ftalgo-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl
ftalgo-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl CPython 3.9 abi3 Linux musl 1.2+ ARM64 Details for ftalgo-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl
ftalgo-0.1.0-cp39-abi3-manylinux_2_28_aarch64.whl CPython 3.9 abi3 Linux glibc 2.28+ ARM64 Details for ftalgo-0.1.0-cp39-abi3-manylinux_2_28_aarch64.whl
ftalgo-0.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for ftalgo-0.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
ftalgo-0.1.0-cp39-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 10.12+ x86-64, macOS 10.12+ universal2 (ARM64, x86-64), macOS 11.0+ ARM64 Details for ftalgo-0.1.0-cp39-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl

Total release size: 5.6 MB

Release files / ftalgo-0.1.0.tar.gz

Download URL ftalgo-0.1.0.tar.gz
Size 196.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d9264b57e23e78cf1812006fc32f3c44589e044cbcb16e64a1b6db54ff93cf70
BLAKE2b-256 checksum
How to use checksums
6d9d9099b212242946cb2616ddab11d3a99a3bb6d6d1c66e946a3001e5d16470
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Release files / ftalgo-0.1.0-cp39-abi3-win_amd64.whl

Download URL ftalgo-0.1.0-cp39-abi3-win_amd64.whl
Size 423.2 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
edf84fddfed9cac277bf3ba8988c402b7e49f53a2a8fe41fc486ed6a0ec7eb04
BLAKE2b-256 checksum
How to use checksums
22bf0b15a56e384edd7d20aef241dbd5dfd2c8cffbe1f1f1a2f6933caddf0b59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Release files / ftalgo-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL ftalgo-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl
Size 1.1 MB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
ad106c6ae6f9d4ad7b1c2ccdd97019021e1e81d3c3ce50e1c946ad25c9a42a34
BLAKE2b-256 checksum
How to use checksums
a275f08a6dd6886ffc408b90faa0f6b799ed635da7022e84ab5f7168d4e145b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Release files / ftalgo-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL ftalgo-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl
Size 1.1 MB
Tags CPython 3.9 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
7254f11872b0e7c5dc899afbe611e7db9c5bc4add749a371a8161bbc24afd20b
BLAKE2b-256 checksum
How to use checksums
8fbd973a388d4e957b4090b2845182452b60099708a3346110daf880509c8883
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Release files / ftalgo-0.1.0-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL ftalgo-0.1.0-cp39-abi3-manylinux_2_28_aarch64.whl
Size 920.8 kB
Tags CPython 3.9 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
52a92c597de9d670016f11edc2be3f25665d90cf8b4d31ba2313a6d8eb8196ed
BLAKE2b-256 checksum
How to use checksums
428ac2c64686971b833e39d7a35bf2d91286559459e23cb77b86eabab9ea71e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Release files / ftalgo-0.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL ftalgo-0.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 988.9 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
4be726b68d5fc787852e28e2d2cbb16db33fcd9afe839cbb7243e38c8e17cb15
BLAKE2b-256 checksum
How to use checksums
bc5bd00a60411685ba4fc75e69c6e6567673011c95b51a038ac1b8804f7956cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Release files / ftalgo-0.1.0-cp39-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl

Download URL ftalgo-0.1.0-cp39-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl
Size 864.7 kB
Tags CPython 3.9 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
9fc5391e461b7c6c1cb02648fb142ebbe0f2b57b43a4023b74771e23b871fdec
BLAKE2b-256 checksum
How to use checksums
e9bb6f4dadc943d9fdbbe3a578d2dcec8e150313059a6be57e8aa2f9225681c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Security for ftalgo 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 7 files in this release have been uploaded with provenance metadata.

Select from 7 files

Attestation for ftalgo-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

7 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page