Backend-agnostic benchmarking toolkit for local quantum circuit simulators. The package runs the same benchmark definitions across local simulator adapters such as Cirq, PennyLane, Amazon Braket LocalSimulator, Qiskit Aer, CUDA-Q, pyQuil QVM, and QuTiP, then reports standardized runtime, structural, and distribution metrics. pytket is used for circuit analysis and compilation-style metrics, not as an execution backend.
See USAGE.md for a task-oriented guide to the CLI and Python API, and CHANGELOG.md for release notes. For research workflows and interpretation, see PROBLEM.md, THEORY.md, METHODOLOGY.md, SCHEMA.md, and LIMITATIONS.md.
- Features
- Backend Support
- Installation
- GitHub Codespaces
- Quickstart
- Benchmark Suite
- Python API
- Project Layout
- Development
- Notes
- Author
- License
- Unified
BenchmarkSpecabstraction for reusable benchmark definitions - Local-first execution backends with no cloud credentials required
- Built-in benchmarks for GHZ, Bernstein-Vazirani, Deutsch-Jozsa, QFT, random circuits, quantum-volume-style circuits, Grover search, Hamiltonian simulation, QAOA MaxCut, and noise sweeps
- Standardized metrics including depth, gate counts, runtime, success probability, and total variation distance
- CLI commands for discovery, backend capability reporting, single runs, backend comparison, presets, reports, and noise sweeps
- Experiment manifests with environment capture and repeated runtime statistics
- Named benchmark suites for smoke, standard, and scaling runs
- Native circuit drawing through Cirq, PennyLane, Braket, and pytket renderers
- JSON/CSV export, summary rankings, and matplotlib plot generation
- Installable in GitHub Codespaces with Python 3.11+
| Backend | Execution | Notes |
|---|---|---|
| Cirq | cirq.Simulator |
Supports depolarizing noise injection in this project |
| PennyLane | default.qubit / default.mixed |
Uses local devices only |
| Amazon Braket | LocalSimulator only |
Offline execution, no AWS credentials required |
| Qiskit Aer | AerSimulator |
Local Aer simulation with depolarizing noise injection support |
| NVIDIA CUDA-Q | local simulator target | Optional local CUDA-Q execution adapter |
| pyQuil QVM | local QVM/quilc runtime | Requires local Forest runtime support |
| QuTiP | local statevector simulation | Useful for physics-oriented local simulation coverage |
| pytket | Analysis only | Used for depth and gate metrics, not execution |
| qBraid | Discovery only | Optional interop/runtime SDK; not used as a local execution backend |
| Q# / QDK | Discovery only | Optional language/runtime SDK; not used as a circuit backend |
Install from PyPI:
python -m pip install quantum-backend-benchInstall execution backends as needed:
python -m pip install "quantum-backend-bench[cirq]"
python -m pip install "quantum-backend-bench[pennylane]"
python -m pip install "quantum-backend-bench[braket]"
python -m pip install "quantum-backend-bench[qiskit]"
python -m pip install "quantum-backend-bench[cudaq]"
python -m pip install "quantum-backend-bench[pyquil]"
python -m pip install "quantum-backend-bench[qutip]"
python -m pip install "quantum-backend-bench[yaml]"
python -m pip install "quantum-backend-bench[all]"
python -m pip install "quantum-backend-bench[full]"The default package and .[dev] workflow are self-contained Python installs. The all
extra is the practical Python-only comparison stack and intentionally excludes CUDA-Q
and pyQuil. Use full only when you explicitly want every Python SDK extra, including
heavy or external-runtime-backed adapters.
Install from a local checkout:
python -m pip install --upgrade pip
python -m pip install -e .For development tools:
python -m pip install -e .[dev]For the practical local test matrix:
python -m pip install -e ".[all,dev]"For the exhaustive optional SDK matrix:
python -m pip install -e ".[full,dev]"The pyQuil execution test also requires local qvm and quilc executables on PATH.
Those are external Rigetti runtime tools and are not installed by pip extras.
The repository includes a Codespaces-ready .devcontainer/devcontainer.json using a Python 3.11 base image. On container creation it installs the package in editable mode with development dependencies.
List available benchmarks, suites, and local integrations:
quantum-bench list
quantum-bench info
quantum-bench doctor
quantum-bench recommend --use-case research
quantum-bench validateRun a single benchmark:
quantum-bench run ghz --backend cirq --n-qubits 5
quantum-bench run ghz --backend cirq --n-qubits 5 --repeats 5Compare a benchmark across all execution backends and print summary rankings:
quantum-bench compare qft --backends cirq pennylane braket_local qiskit_aer qutip --n-qubits 5 --summaryRun a random circuit:
quantum-bench run random-circuit --backend braket_local --n-qubits 4 --depth 10 --seed 42Run Grover:
quantum-bench run grover --backend pennylane --n-qubits 3 --marked-state 101Run Bernstein-Vazirani:
quantum-bench run bernstein-vazirani --backend cirq --n-qubits 4 --secret-string 101Run Deutsch-Jozsa:
quantum-bench run deutsch-jozsa --backend cirq --n-qubits 4 --oracle-type balanced --bitmask 101Run Hamiltonian simulation:
quantum-bench run hamiltonian-sim --backend cirq --n-qubits 4 --time 1.0 --trotter-steps 2Run QAOA MaxCut:
quantum-bench run qaoa-maxcut --backend cirq --n-qubits 4 --graph ring --gamma 0.8 --beta 0.4Run a noise sweep:
quantum-bench noise-sweep ghz --backend cirq --n-qubits 5Run a quantum-volume-style circuit:
quantum-bench run quantum-volume --backend cirq --n-qubits 4 --depth 4 --seed 42Draw a circuit with a native SDK renderer:
quantum-bench draw ghz --backend cirq --n-qubits 5
quantum-bench draw qft --backend pennylane --n-qubits 5 --save-path artifacts/qft_pennylane.png
quantum-bench draw ghz --backend tket --n-qubits 5 --save-path artifacts/ghz_tket.txtSave JSON and plots:
quantum-bench compare ghz --backends cirq pennylane braket_local --n-qubits 5 --save-json artifacts/ghz.json --save-plot artifacts/ghz.pngSave distribution, heatmap, noise-quality, and suite plots:
quantum-bench run grover --backend cirq --n-qubits 3 --marked-state 101 --save-distribution artifacts/grover_distribution.png
quantum-bench compare ghz --backends cirq pennylane --n-qubits 4 --save-heatmap artifacts/ghz_heatmap.png
quantum-bench noise-sweep ghz --backend cirq --n-qubits 4 --save-quality-plot artifacts/noise_quality.png
quantum-bench suite smoke --backends cirq --save-suite-plot artifacts/smoke_runtime.pngSave CSV:
quantum-bench compare ghz --backends cirq pennylane --n-qubits 5 --save-csv artifacts/ghz.csvCompare saved results and fail on regressions:
quantum-bench diff artifacts/baseline.json artifacts/current.json --relative-threshold 0.05 --fail-on-regression
quantum-bench diff artifacts/baseline.csv artifacts/current.csv --metric runtime_secondsGenerate a Markdown report:
quantum-bench report artifacts/current.json --output artifacts/current_report.mdUse packaged comparison presets:
quantum-bench preset list
quantum-bench preset show algorithmic --save-json artifacts/algorithmic_manifest.json
quantum-bench preset run runtime --backends cirq pennylane qiskit_aer --save-report artifacts/runtime_report.mdRun a named suite:
quantum-bench suite smoke --backends cirq --summary
quantum-bench suite standard --backends cirq pennylane braket_local --save-csv artifacts/standard.csv
quantum-bench suite standard --list-cases --save-json artifacts/standard_manifest.jsonRun a reproducible experiment manifest:
quantum-bench experiment run examples/manifests/runtime_scaling.jsonFor more complete workflows, result interpretation, and Python examples, see USAGE.md.
Generates GHZ states for configurable qubit counts. Ideal output is concentrated on 00...0 and 11...1.
Implements the Quantum Fourier Transform for structural and runtime comparisons.
Recovers a hidden bitstring with one oracle query. The final qubit is used as the oracle work qubit, so --secret-string must have length --n-qubits - 1.
Runs constant or linear balanced oracle cases. Balanced cases use --bitmask; constant cases use --oracle-type constant --constant-value 0|1.
Builds reproducible random circuits using a fixed gate set and explicit seed control.
Builds reproducible shuffled-pair random layers inspired by quantum volume workloads. This is a portable workload, not a formal quantum volume certification routine.
Implements a small search benchmark for 2 to 4 qubits and reports marked-state success probability.
Implements first-order Trotterized evolution for a simple Ising-style Hamiltonian:
H = sum_i Z_i Z_{i+1} + 0.5 * sum_i X_i
Builds a single-layer QAOA circuit for line or ring MaxCut instances and reports success probability as probability mass on optimal cut bitstrings.
Wraps a base benchmark and sweeps depolarizing noise levels. Noise behavior differs by backend and is reported in result metadata. Cirq, PennyLane, and Qiskit Aer inject depolarizing noise in this project; other adapters may report the request without applying noise.
from quantum_backend_bench.benchmarks.ghz import build_benchmark
from quantum_backend_bench import build_suite, run_benchmark, summarize_results
benchmark = build_benchmark(n_qubits=5)
results = run_benchmark(benchmark, ["cirq", "pennylane", "braket_local"], shots=1024)
suite_results = [
result
for benchmark in build_suite("smoke")
for result in run_benchmark(benchmark, ["cirq"], shots=128)
]
summary = summarize_results(suite_results)quantum_backend_bench/
├── backends/
├── benchmarks/
├── core/
├── utils/
└── cli.py
Example scripts live in examples/, with a run order and expected outputs documented in examples/README.md. They include backend comparison, GHZ execution, oracle benchmarks, quantum-volume-style execution, suite export, plot generation, circuit diagram export, research manifest generation, repeated-runtime analysis, schema inspection, Markdown report generation, backend capability inspection, and a Cirq noise sweep demo. The plot gallery example uses larger circuits, more shots, and multiple backends so the generated images show non-trivial distributions.
Run formatting and linting:
black quantum_backend_bench tests examples
ruff check quantum_backend_bench tests examplesRun tests:
pytestBuild and inspect release artifacts:
python -m build
python -m twine check dist/*Continuous integration is handled by .github/workflows/ci.yml, which runs formatting, linting, tests, build, and distribution checks. Publishing is handled by .github/workflows/publish.yml when a version tag such as v0.1.3 is pushed. The workflow expects PyPI trusted publishing to be configured for this repository.
- The project targets standard
pipenvironments with Python 3.11 or newer. - No AWS account, cloud credentials, GPUs, or paid services are required.
- The internal circuit model is intentionally simple to keep backend translation maintainable.
Sid Richards
- LinkedIn: sid-richards-21374b30b
- GitHub: SidRichardsQuantum
MIT. See LICENSE.