Intelligent quantum backend selection for Qiskit circuits
Project description
Enhanced Quantum Backend Selector
Intelligent quantum backend selection for Qiskit circuits using transpilation-based error analysis.
Overview
Quantum computing users typically rely on simplistic backend selection methods like least_busy(), which only considers queue depth. This library provides intelligent backend selection by transpiling your circuit to each backend and calculating the actual expected error rates:
- Transpilation-Based: Circuits are transpiled to each backend's native gate set
- Real Error Calculation: Sums actual error rates for the specific qubits and gates used
- Multiple Runs: Averages over multiple transpilation runs for stability (default: 3, configurable)
- Direct Quality Metric: Score = negative total error (higher is better)
Installation
pip install enhanced-quantum-backend-selector
Or with Poetry:
poetry add enhanced-quantum-backend-selector
Quick Start
from enhanced_quantum_backend_selector import BackendSelector
from qiskit import QuantumCircuit
from qiskit_ibm_runtime import QiskitRuntimeService
# Get available backends
service = QiskitRuntimeService()
backends = service.backends()
# Create your circuit
qc = QuantumCircuit(3)
qc.h(0)
qc.cx(0, 1)
qc.cx(1, 2)
qc.measure_all()
# Select the best backend
selector = BackendSelector(backends)
best = selector.select_backend(qc)
print(f"Recommended: {best.backend.name}")
print(f"Score: {best.score_data.score:.3f}") # Negative error sum
print(f"Expected error: {-best.score_data.score:.2%}") # As percentage
print(f"Reasons: {', '.join(best.score_data.reasons)}")
Features
- ✅ Transpilation-Based Scoring: Calculates actual error rates for your specific circuit
- ✅ Fractional Gates Support: Automatically evaluates with/without fractional gates for chemistry circuits
- ✅ Provider Agnostic: Works with any Qiskit BackendV2 provider (IBM, Aer, etc.)
- ✅ Multiple Run Averaging: Configurable transpilation runs (default: 3) for stable scoring
- ✅ Smart Caching: 1-hour TTL cache minimizes backend queries
- ✅ Parallel Processing: Scores multiple backends concurrently (up to 10 workers)
- ✅ Comprehensive Type Hints: Full mypy strict mode compliance
- ✅ Extensive Documentation: Detailed docstrings with examples
Rank All Backends
# Get full ranking
rankings = selector.rank_backends(qc, top_n=5)
for rec in rankings:
error_pct = -rec.score_data.score * 100
print(f"#{rec.rank}. {rec.backend.name}: {rec.score_data.score:.4f} ({error_pct:.2f}% error)")
Development
See CONTRIBUTING.md for development setup and guidelines.
# Clone repository
git clone https://github.com/sevetseh28/enhanced_quantum_backend_selector.git
cd enhanced-quantum-backend-selector/enhanced-quantum-backend-selector
# Install with development dependencies
poetry install --with dev,docs
# Run tests
poetry run pytest
# Run type checking
poetry run mypy src/
# Format code
poetry run ruff format .
Benchmarking
The library includes a comprehensive benchmarking suite with real-world quantum circuits to evaluate backend selector performance using mock backends that simulate real IBM Quantum processors (Heron R1, Heron R2, Heron R3, and Nighthawk):
# Run full benchmark suite
poetry run python benchmarks/run_benchmarks.py
# Run example benchmarks
poetry run python examples/run_benchmarks.py
# Run benchmark tests
poetry run pytest tests/test_benchmarks.py -v
Benchmark Circuits:
- GHZ: Multi-qubit entanglement testing
- Bernstein-Vazirani: Parallel operations and phase kickback
- Mirror_5k: Device benchmarking (circuit inversion)
- LUCJ Ansatz: Quantum chemistry applications
- QAOA: Combinatorial optimization
Mock Backends (based on real IBM processors):
- IBM Heron R1: 133 qubits, heavy-hex topology, 1,800 gate capacity
- IBM Heron R2: 156 qubits, heavy-hex topology, 5,000 gate capacity
- IBM Heron R3: 156 qubits, heavy-hex topology, improved error rates
- IBM Nighthawk: 120 qubits, square lattice, superior connectivity
See Benchmarking Guide for detailed methodology, metrics, and references.
Documentation
- User Guide
- API Reference
- Benchmarking Guide
- Examples
- Contributing Guidelines
- Release Process
- Changelog
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Citation
If you use this library in your research, please cite:
@software{enhanced_quantum_backend_selector,
title = {Enhanced Quantum Backend Selector},
author = {sevetseh28},
year = {2025},
url = {https://github.com/sevetseh28/enhanced_quantum_backend_selector}
}
Contributing
Contributions are welcome! Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file enhanced_quantum_backend_selector-0.1.0.tar.gz.
File metadata
- Download URL: enhanced_quantum_backend_selector-0.1.0.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef9f8500dc0ac992109d05c90fa13e8d3ae2e000ef38e69d5b7f462565cf135f
|
|
| MD5 |
72b9b885071538190757564fe862ebd7
|
|
| BLAKE2b-256 |
0fb334603b107bc95a8fc0a76350a68b5ea2aec50bdeb7806afd7d5499d417b4
|
Provenance
The following attestation bundles were made for enhanced_quantum_backend_selector-0.1.0.tar.gz:
Publisher:
publish.yml on sevetseh28/enhanced_quantum_backend_selector
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
enhanced_quantum_backend_selector-0.1.0.tar.gz -
Subject digest:
ef9f8500dc0ac992109d05c90fa13e8d3ae2e000ef38e69d5b7f462565cf135f - Sigstore transparency entry: 836529246
- Sigstore integration time:
-
Permalink:
sevetseh28/enhanced_quantum_backend_selector@f6ab0aaa13dd2efa40e33143eddcc80447d798b9 -
Branch / Tag:
refs/tags/v0.0.0 - Owner: https://github.com/sevetseh28
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f6ab0aaa13dd2efa40e33143eddcc80447d798b9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file enhanced_quantum_backend_selector-0.1.0-py3-none-any.whl.
File metadata
- Download URL: enhanced_quantum_backend_selector-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae99b1e5f143c942f3f36c758592b23342afd3a047e435623c0faf554f3a10c4
|
|
| MD5 |
def730103b7d3c0d6aef3b68b18ac463
|
|
| BLAKE2b-256 |
e548ea89d328ec4673d4a17dc0b067cc9cbd5a80473b37ecf8f4be7011f56b93
|
Provenance
The following attestation bundles were made for enhanced_quantum_backend_selector-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on sevetseh28/enhanced_quantum_backend_selector
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
enhanced_quantum_backend_selector-0.1.0-py3-none-any.whl -
Subject digest:
ae99b1e5f143c942f3f36c758592b23342afd3a047e435623c0faf554f3a10c4 - Sigstore transparency entry: 836529249
- Sigstore integration time:
-
Permalink:
sevetseh28/enhanced_quantum_backend_selector@f6ab0aaa13dd2efa40e33143eddcc80447d798b9 -
Branch / Tag:
refs/tags/v0.0.0 - Owner: https://github.com/sevetseh28
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f6ab0aaa13dd2efa40e33143eddcc80447d798b9 -
Trigger Event:
push
-
Statement type: