A quantum algorithm is not fairly benchmarked by reporting a single runtime or the best result from one run. This guide gives you a repeatable workflow for choosing quality metrics, setting classical baselines, controlling random variation, comparing simulators with hardware, and writing a benchmark report that another developer can reproduce.
Overview
Quantum algorithm benchmarking means measuring an algorithm against a clearly defined task, reference method, and experimental setup. The goal is not simply to show that a circuit produces an answer. It is to determine how reliably, efficiently, and accurately the method performs under stated conditions.
A useful benchmark separates at least four questions:
- Quality: How close is the result to the target, known optimum, or reference distribution?
- Resource use: How many qubits, gates, circuit layers, shots, and classical optimization steps are required?
- Operational performance: How long does compilation, queueing, execution, post-processing, and optimization take?
- Robustness: Does the result remain stable across seeds, problem instances, shot budgets, and execution environments?
These dimensions should not be collapsed into one score unless the weighting is explicitly justified. A method can produce a high-quality answer while using more shots, deeper circuits, or more classical computation than its competitor. Report those trade-offs instead of hiding them behind an aggregate metric.
For practical quantum computing work, begin with a small benchmark suite that can run on a simulator and, when appropriate, on real hardware. Record the circuit before and after transpilation, the execution configuration, and the classical baseline. For background on circuit resources and compilation, see the quantum circuit resource estimation guide and the quantum circuit transpilation guide.
How to estimate
Use the following workflow before running a quantum algorithm benchmark.
1. Define the task and success condition
State the input format, problem size, output format, and what counts as success. For a search algorithm, success might mean measuring a marked item. For an optimization algorithm, it might mean returning a solution within a chosen gap of the best known objective value. For a sampling algorithm, success may involve matching a target distribution rather than selecting one correct bit string.
A vague goal such as “the algorithm performs well” cannot produce a useful benchmark. Write the success condition as a measurable rule before collecting results.
2. Select metrics that match the workload
| Workload | Primary quality metric | Useful secondary metrics |
|---|---|---|
| Search | Probability of measuring a valid target | Queries, shots, depth, success confidence |
| Optimization | Objective value or approximation error | Optimality gap, success probability, iterations, circuit depth |
| Sampling | Distance from the target distribution | Number of shots, statistical uncertainty, classical post-processing time |
| Quantum machine learning | Held-out task metric | Training cost, inference shots, parameter count, variance across seeds |
Common quality measures include absolute error, relative error, approximation ratio, total variation distance, and state or process fidelity. Use a metric only when its interpretation is clear for the task. Fidelity, for example, can be informative for state preparation but may not capture whether an optimization result is useful to an end user.
3. Establish a classical baseline
Compare the quantum method with a relevant classical reference, not merely with an intentionally weak implementation. The baseline could be an exact solver for small instances, a heuristic, a randomized method, a classical approximation, or a conventional machine-learning model. Document its algorithm, software environment, stopping rule, hardware, and parameter settings.
For small problem sizes, an exact classical result is valuable because it provides a known reference. At larger sizes, use the best practical baseline available to the project and label it accurately as a baseline rather than a proof of optimality.
4. Run controlled repetitions
Quantum experiments contain several sources of variation: circuit sampling, randomized initialization, optimizer behavior, device noise, compilation choices, and workload selection. Run multiple independent trials when the method includes randomness. Save the random seeds, shot count, initial parameters, transpiler settings, and problem-instance seeds.
Report a central value together with uncertainty. Depending on the experiment, that may be a mean and standard deviation, a median and interquartile range, or a confidence interval for a success probability. Avoid presenting excessive decimal places when the shot budget or trial count cannot support that precision.
5. Compare like with like
Keep the problem instances, stopping criteria, output post-processing, and measurement budget consistent between algorithm variants. Distinguish circuit execution time from total wall-clock time. Total wall-clock time may include compilation, queueing, retries, classical optimization, and result decoding; those components should be listed separately when they matter.
For simulator-versus-hardware comparisons, first run the same logical circuit in an ideal simulator, then in a noise-aware simulator if available, and finally on the selected device. Preserve the logical problem and measurement budget while documenting any hardware-specific changes. A hardware result should not be described as a direct speed comparison with a simulator unless the timing environments and measured components are genuinely comparable.
Inputs and assumptions
A benchmark is only as reproducible as its recorded inputs. Create a run manifest containing the following fields:
- Problem definition: dataset or instance identifier, size, encoding method, constraints, and expected output.
- Algorithm configuration: circuit construction, ansatz or oracle details, optimizer, initialization, stopping rule, and number of iterations.
- Circuit resources: logical qubits, physical qubits after mapping, total gates, two-qubit gates, circuit depth, and measurement operations.
- Execution settings: simulator or hardware name, backend configuration, shots, batching, noise model, and error-mitigation settings.
- Reproducibility data: SDK and dependency versions, source revision, operating environment, random seeds, and timestamps.
- Baseline details: implementation, solver settings, stopping rule, machine configuration, and whether the result is exact, approximate, or heuristic.
State assumptions that could change the conclusion. Examples include treating compilation time as an overhead, excluding cloud queue time, using a fixed shot budget, or allowing the classical baseline a different termination condition. No convention is universally correct, but an unstated convention makes results difficult to interpret.
Noise and mitigation also require explicit treatment. If you use readout mitigation, zero-noise extrapolation, probabilistic error cancellation, or another technique, report the extra circuits, calibration work, sampling overhead, and post-processing. The quantum error mitigation comparison provides useful context for separating these costs from the raw circuit result.
A reusable benchmark-report template
Task:
Instance set and sizes:
Success condition:
Quantum algorithm and SDK version:
Classical baseline:
Backend or simulator:
Logical qubits / mapped qubits:
Depth / two-qubit gates:
Shots per circuit:
Optimization iterations:
Random seeds:
Quality metric and uncertainty:
Runtime definition:
Noise or mitigation settings:
Best, mean, median, and spread:
Known limitations:
Source revision and reproduction command:
Store raw counts, intermediate objective values, compiled circuits, and configuration files alongside the final summary. A chart without the underlying data is difficult to audit and harder to update.
Worked examples
Optimization algorithm
Suppose you are comparing a QAOA implementation with a classical heuristic on a set of graph instances. Define the objective function once and evaluate every returned bit string with that same function. Report the best-known objective value for each instance, the approximation ratio or optimality gap, the probability of obtaining the best observed solution, and the number of circuit evaluations.
Do not report only the best QAOA result. Run several seeds, provide the median and range, and show how performance changes with the shot budget. Record the number of layers, logical and mapped qubits, two-qubit gate count, transpiled depth, optimizer iterations, and total execution time. A comparison between QAOA and Grover-style approaches should also explain that the algorithms address different problem formulations; the Grover’s algorithm versus QAOA comparison can help frame that distinction.
Sampling algorithm
For a sampler, select a fixed collection of target distributions and a fixed shot budget. Compare the measured distribution with the target using a declared distance measure. Include uncertainty caused by finite shots, because two distributions that appear different in a small sample may not be meaningfully different. Report circuit depth, number of measured samples, simulator or device settings, and any distribution-specific post-processing.
Variational machine-learning experiment
Separate training and evaluation data, and keep the test set untouched until the final comparison. Run the quantum model and classical baseline with comparable data splits and clearly described tuning budgets. Report the held-out metric, training steps, circuit evaluations, shots per expectation value, parameter initialization seeds, and variation across runs. If optimization is unstable, preserve failed or stopped runs in the analysis rather than silently reporting only successful trials.
When to recalculate
Recalculate the benchmark whenever an input that affects fairness or interpretation changes. That includes a new SDK or transpiler version, a different backend or calibration condition, a changed shot budget, a revised noise model, a new error-mitigation procedure, or a modified classical baseline. Re-run the suite when the algorithm changes its ansatz, oracle, encoding, optimizer, stopping rule, or post-processing.
For hardware experiments, treat device changes and meaningful calibration changes as triggers for a fresh run. Hardware results can be sensitive to execution conditions, so preserve the original report rather than overwriting it. Label each run with a date, backend configuration, source revision, and manifest.
Review the benchmark at least when you prepare a paper, portfolio project, technical decision, or internal performance claim. Also revisit it when benchmark datasets, platform interfaces, or measurement conventions change. A practical maintenance rule is to keep a small smoke-test suite that runs after code changes and a larger comparison suite for scheduled or milestone-based evaluations.
Before publishing your next result, use this checklist:
- Write the task and success condition in measurable terms.
- Choose quality, resource, runtime, and robustness metrics that fit the workload.
- Run a relevant classical baseline with documented settings.
- Use the same instances, stopping rules, and output evaluation for each method.
- Repeat randomized experiments and report uncertainty, not just the best run.
- Separate logical resources, compiled resources, execution time, and classical overhead.
- Save seeds, versions, raw results, circuits, manifests, and reproduction commands.
- State limitations and schedule a re-run when inputs or benchmark standards change.
This approach turns a quantum algorithm benchmark from a one-off demonstration into an auditable experiment that can be compared, reproduced, and updated as the implementation and execution environment evolve.