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.

Test

pytest tests/ -v   # 49 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-0.2.1.tar.gz (20.3 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-0.2.1-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for autoq_qec-0.2.1.tar.gz
Algorithm Hash digest
SHA256 c3526f5bcbfd68812dedf12148dd06c0b72340e8a6347955deb1318fa019c08b
MD5 55e9414699b4444a9e7b5c30509615a4
BLAKE2b-256 6ac9511a7da2eea91358e4adfcfde2546f153e761e33e869e909e32c25640e6a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: autoq_qec-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 15.1 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-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1ccb6e3b0c0b14610b0d4a5d4cf6edc708be5c160824d41c0a1c2edfb41f7569
MD5 0382330dc88488eecf4e4561a9467baf
BLAKE2b-256 7f4aab1ca178dee0e6411a63a01f9c48d53afb2f33641c0d29315bdd33b69d74

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