Skip to main content

Multi-code QEC resource estimator for arbitrary Qiskit circuits

Project description

AutoQ QEC Estimator

DOI

Multi-code fault-tolerant quantum error correction estimator for arbitrary Qiskit circuits.

Given any Qiskit circuit and a set of hardware profiles, AutoQ QEC returns a ranked comparison of QEC codes (Surface Code, Floquet Code, Bacon-Shor, Steane [[7,1,3]]) with physically grounded resource estimates: physical qubit count, execution time, and circuit fidelity.

What this does that nothing else does

Tool Multi-code Arbitrary circuit Analytic model Hardware-agnostic
Azure Resource Estimator ❌ Surface Code only ❌ Azure only
stim ❌ needs rewrite ❌ simulation
qiskit-qec ❌ no estimator
AutoQ QEC

Install

pip install autoq-qec
# With IBM Quantum integration:
pip install "autoq-qec[ibm,sim]"

Quickstart

from qiskit import QuantumCircuit
from autoq_qec import compare, rank
from autoq_qec import HARDWARE_PROFILES, CalibratedHardware, HardwareProfile

# Any Qiskit circuit
circuit = QuantumCircuit(4)
circuit.h(0); circuit.cx(0,1); circuit.cx(1,2); circuit.cx(2,3)

# Hardware profiles (built-in or custom)
hardwares = [
    HardwareProfile("IBM_Eagle",     t_gate_ns=391,   p_phys=0.0062, topology="heavy-hex"),
    HardwareProfile("IBM_Heron",     t_gate_ns=100,   p_phys=0.003,  topology="heavy-hex"),
    HardwareProfile("Quantinuum_H2", t_gate_ns=100e3, p_phys=0.00029,topology="all-to-all"),
]

# One call — returns all codes × all hardwares
result = compare(circuit, hardwares, fidelity_target=0.99)

# Pass hardware_calibrations to exclude combinations that violate T1
# (t_circuit >= 0.5×T1) — matches by name or by (t_gate_ns, p_phys)
recommendations = rank(result, hardware_calibrations=HARDWARE_PROFILES)

for r in recommendations[:3]:
    print(f"#{r.rank} {r.hardware} + {r.code}: "
          f"{r.total_physical_qubits}q, {r.execution_time_us:.1f}µs, "
          f"fidelity={r.fidelity_circuit:.4f}")

With real IBM calibration data

from autoq_qec.real_hardware import from_ibm_backend, noise_model_from_ibm

# Pulls today's calibration — T1, T2, CX error per qubit pair
hw = from_ibm_backend("ibm_brisbane", token="YOUR_IBM_TOKEN")

# Simulate locally with real noise model (no queue, no cost)
sim = noise_model_from_ibm("ibm_brisbane", token="YOUR_IBM_TOKEN")

Physical models

Code Model Reference
Surface Code $p_L \approx A(p/p_{th})^{(d+1)/2}$, $q=2d^2-1$, overhead $=d^3$ Fowler et al., PRA 86, 032324 (2012)
Floquet Code $p_L \approx 0.07(p/p_{th})^{(d+1)/2}$, $q=4d^2+8(d-1)$, overhead $=\lfloor d/2\rfloor$ Gidney & Fowler, arXiv:2202.11829
Bacon-Shor $p_L \approx (p/p_{th})^d$, $q=d^2$ Aliferis & Cross (2007)
Steane [[7,1,3]] $p_L \approx 21p^2$, $q=13$ Steane, PRL 77, 793 (1996)

Thresholds are enforced: p ≥ p_th raises ValueError — no silent wrong results.

Algorithm Estimator

Order-of-magnitude T-count estimates for known algorithms, without building the full circuit:

from autoq_qec import AlgorithmEstimator

est = AlgorithmEstimator.shor(2048)
print(est.t_count_estimate, est.t_count_uncertainty)  # ±5x — build the real circuit for precise numbers

Covers shor, grover, qft, vqe. These are rough estimates (±2×–±10× depending on the algorithm) — use extract_circuit_profile() on a real circuit whenever possible.

Hardware profiles

Includes Google_Willow (105q, Acharya et al., Nature 638, 964-971, 2025) and IBM_Heron_r3 (ibm_pittsburgh, Q4 2025), alongside IBM_Eagle_r3, IBM_Heron_r2, Quantinuum_H2, IonQ_Aria, Google_Sycamore.

Visualization

pip install "autoq-qec[viz]"
from autoq_qec.visualizer import plot_tradeoff

result = compare(circuit, hardwares, fidelity_target=0.99)
plot_tradeoff(result, output="tradeoff.png")  # log-log qubits × time, color = fidelity

Test

pytest tests/ -v   # 56 tests, all verify physics not arithmetic

What the tests check (unlike most QEC tools)

  • p ≥ threshold raises ValueError, not wrong overhead
  • d is always odd for Surface Code (rotated lattice requirement)
  • p_L ≤ p_L_target guaranteed after distance selection
  • Noisier hardware requires larger d (monotonicity)
  • Circuit with 0 gates raises ValueError (destroyed by transpiler)
  • Fidelity scales correctly with t_gate

Author

Ronaldo Rodrigues — ORCID: 0009-0006-7449-1190

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autoq_qec-3.0.0.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autoq_qec-3.0.0-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file autoq_qec-3.0.0.tar.gz.

File metadata

  • Download URL: autoq_qec-3.0.0.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for autoq_qec-3.0.0.tar.gz
Algorithm Hash digest
SHA256 5bb040a373dbbc70cc92b4a8d21da718dcdbe6ded9f769c80bb8aa4a9e17e7dc
MD5 9870a344e0af6342360b3de377c2baca
BLAKE2b-256 51a713ebb5b5c290a9bc1067bf389969966f5ae30a17bcaab67b48aa2dc81cca

See more details on using hashes here.

File details

Details for the file autoq_qec-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: autoq_qec-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for autoq_qec-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5f13d06c3e6900acb6b6048252be25313800c702104f8d428212b1b41096e59d
MD5 1ac3b49751752bf7de4d35892e6333a3
BLAKE2b-256 94c98f024f4890b80e340309396c1e3065219216cceed5188e9419481274f692

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page