A fair variational quantum algorithm (VQA) benchmark is less about finding a single winning SDK and more about controlling the variables that shape the result. This workflow shows how to compare Qiskit, PennyLane, and Cirq on simulators and real devices using the same ansatz, optimizer budget, shot count, noise assumptions, and reporting format. It also includes a reusable benchmark table, a runner template, cost formulas, and a verification checklist you can apply whenever your software stack or hardware target changes.
Overview
VQAs combine a parameterized quantum circuit with a classical optimizer. Examples include the variational quantum eigensolver (VQE), quantum approximate optimization algorithm (QAOA), and variational quantum machine learning models. Their results depend on more than circuit quality. Compilation choices, gradient methods, initialization, shot noise, backend queues, measurement grouping, and stopping criteria can all change the apparent outcome.
That makes cross-SDK comparisons easy to misread. A Qiskit, PennyLane, or Cirq implementation may represent the same mathematical circuit while using different parameter ordering, transpilation passes, gradient estimators, default precision, or optimizer behavior. The goal of a reproducible benchmark is therefore not to hide those differences. It is to record and control them so another researcher can explain why two runs differ.
Use this workflow to answer practical questions such as:
- How long does each implementation take to reach a defined target?
- How many optimizer iterations and circuit evaluations are required?
- How does performance change under a stated noise model?
- How much shot budget is consumed?
- Does a result retain useful fidelity when moved from simulation to hardware?
For environment setup, first establish isolated Python environments and record package versions using the compatibility practices described in this Qiskit, Cirq, and PennyLane environment guide. A benchmark should be treated as an experiment record, not merely a script.
How to estimate
Begin by defining the benchmark question in measurable terms. For example: “Compare three implementations of a four-qubit VQE circuit on an ideal simulator, a fixed noisy simulator, and one selected hardware target, using the same initial parameters and a maximum of 100 optimizer iterations.” Avoid vague goals such as “find the fastest framework.” Framework speed depends on the workload, execution mode, simulator, compiler, and hardware service.
1. Freeze the problem
Choose one problem instance, qubit count, Hamiltonian or objective function, ansatz, parameter initialization, optimizer, stopping rule, and shot setting. Keep the objective function identical across implementations. If you are benchmarking QAOA, specify the graph and depth explicitly; the Max-Cut workflow provides a useful pattern for separating graph input, optimization, and result checks.
2. Translate the ansatz, not the intent
Write down the circuit as an ordered specification: qubit count, gate sequence, parameter names, parameter-to-gate mapping, entangling pattern, and measurement basis. Then implement that specification in each SDK. Do not rely on each framework’s default variational-layer helper unless you have verified that it creates the same circuit.
3. Normalize optimizer behavior
Use the same optimizer family where practical, but also record framework-specific details. Set the initial parameter vector explicitly, fix the maximum iteration count, define the convergence tolerance, and record whether gradients are analytic, automatic-differentiation based, parameter-shift estimated, or finite-difference estimated. “One iteration” may involve a different number of circuit evaluations in different implementations.
4. Run controlled stages
- Statevector or exact reference: verify the objective and circuit semantics without sampling noise.
- Finite-shot ideal simulation: use the same shot count and random-seed policy.
- Noisy simulation: apply a documented noise model with matching gate and measurement assumptions.
- Real hardware: record the backend, queue or execution conditions when available, compilation settings, shots, and submission time.
Validate circuits before optimization. Statevector checks, unit tests, and shot-based assertions are covered in this quantum testing guide.
5. Report distributions, not only winners
Run multiple independent seeds when the question concerns optimizer stability. Report median and spread for time, final objective, iterations, and circuit evaluations. A single best run is useful for debugging, but it is weak evidence for a framework comparison.
Inputs and assumptions
The following inputs should appear in a configuration file or experiment manifest. A benchmark that does not record them is difficult to reproduce.
| Input | What to record | Why it matters |
|---|---|---|
| Problem | Hamiltonian or objective, instance identifier, qubit count | Defines the task and its difficulty |
| Ansatz | Gate order, depth, entangling map, parameter count | Prevents unequal circuit workloads |
| Initialization | Exact parameter vector and seed policy | Controls optimizer starting conditions |
| Optimizer | Name, hyperparameters, tolerance, iteration limit | Defines the classical search budget |
| Shots | Shots per circuit and measurement grouping | Controls sampling cost and variance |
| Noise | Noise channels, rates or calibration source, readout treatment | Makes noisy results interpretable |
| Execution | SDK versions, Python version, simulator or backend, compiler settings | Captures the software and hardware context |
| Repetitions | Number of seeds and run identifiers | Shows variability rather than one outcome |
Use the following normalization rules:
- Ansatz parity: compare gate-level circuit specifications and final parameter counts, not helper-function names.
- Shot parity: use the same nominal shots per objective evaluation. If an SDK groups measurements or adds calibration circuits, report those additional shots separately.
- Seed transparency: distinguish the optimizer seed, circuit-sampling seed, simulator seed, and hardware seed where applicable. Hardware execution may not offer deterministic sampling.
- Noise-model mapping: document how abstract errors map to gates and measurements. Do not call two models equivalent merely because they use the same numerical error rate.
- Timing boundaries: separate circuit construction, compilation, job submission, queue wait, device execution, result retrieval, and classical optimization time.
Useful metrics include:
- Time-to-solution: elapsed time until the run first reaches a predefined objective threshold. Report the timing boundary.
- Fidelity: use a declared definition, such as state fidelity against a reference state, or a problem-specific overlap. For optimization problems, objective error may be more meaningful than state fidelity.
- Optimizer iterations: count completed optimizer steps and separately count objective or circuit evaluations.
- Shot cost: calculate
shots per circuit × circuits per objective evaluation × objective evaluations, then include calibration or mitigation circuits if used. - Noise profile: record the channels, parameters, readout assumptions, and whether mitigation was applied.
For real-device comparisons, treat queue time and availability as operational measurements, not universal properties of an SDK. Hardware access procedures and costs change; consult the relevant provider documentation and record what was available during the run. The real-hardware access guide explains which execution details are worth capturing.
Worked examples
The examples below are illustrative benchmark designs, not measured performance claims. Replace the placeholder values with your own results.
Example A: ideal simulator comparison
Suppose you compare a four-qubit VQE implementation in Qiskit, PennyLane, and Cirq. Use the same Hamiltonian, a hardware-efficient ansatz with a declared depth, one explicit parameter vector, and the same optimizer limit. First run an exact reference calculation. Then run each implementation with a fixed number of seeds and no shot noise.
| SDK | Run ID | Final objective | Reference error | Iterations | Evaluations | Wall time | Shots | Noise profile |
|---|---|---|---|---|---|---|---|---|
| Qiskit | qiskit-ideal-001 | record result | record result | record result | record result | record result | 0 or exact | ideal |
| PennyLane | pennylane-ideal-001 | record result | record result | record result | record result | record result | 0 or exact | ideal |
| Cirq | cirq-ideal-001 | record result | record result | record result | record result | record result | 0 or exact | ideal |
This stage answers whether the three circuits and objective functions agree. If final objectives differ substantially before sampling noise is introduced, stop and debug the translation rather than ranking the SDKs.
Example B: shot and noise budget
Next, select a fixed shot count and a documented noise model. If one objective evaluation measures six commuting groups at 1,000 shots each, the base shot cost is 6,000 shots per evaluation. If the optimizer performs 80 evaluations, the base cost is 480,000 shots before calibration, mitigation, retries, or additional diagnostic circuits. Use this arithmetic consistently across frameworks.
A comparison table for this stage might look like this:
| SDK | Final objective | Objective error | Iterations | Total evaluations | Base shot cost | Time-to-target | Noise profile |
|---|---|---|---|---|---|---|---|
| Qiskit | record result | record result | record result | record result | calculate | calculate or N/A | document model |
| PennyLane | record result | record result | record result | record result | calculate | calculate or N/A | document model |
| Cirq | record result | record result | record result | record result | calculate | calculate or N/A | document model |
Minimal runner template
Keep orchestration separate from SDK-specific circuit code. Each adapter should expose the same interface and return a structured result.
CONFIG = {
"problem_id": "replace-with-id",
"sdk_versions": {"qiskit": "record", "pennylane": "record", "cirq": "record"},
"shots": 1000,
"max_iterations": 100,
"seed": 17,
"noise_profile": "ideal-or-documented-model",
"target_objective": "define-before-running"
}
for sdk_name in ["qiskit", "pennylane", "cirq"]:
adapter = load_adapter(sdk_name, CONFIG)
result = adapter.run()
save_json({"config": CONFIG, "sdk": sdk_name, "result": result})The adapter should return the final objective, objective error, optimizer iterations, circuit evaluations, shots consumed, timing fields, parameter vector, compiler settings, and any warnings. Store raw results as well as a summarized CSV so later analysis does not depend on a transformed report.
When to recalculate
Re-run the benchmark after a major SDK release, a compiler or simulator change, a new hardware target, a changed noise model, or a change to the ansatz or optimizer. A quarterly review is a practical minimum for a maintained comparison, but a project with active hardware experimentation should recalculate whenever its execution assumptions change.
Refresh the environment commands, pinned versions, backend or device identifiers, noise-model defaults, and baseline table after each review. Do not silently overwrite old results: preserve the original manifest, commit identifier, raw outputs, and machine information. This lets readers distinguish an algorithmic improvement from a change in compilation, hardware calibration, or timing boundary.
Reproducibility checklist
- Problem instance and objective are stored.
- Gate-level ansatz and parameter ordering are documented.
- Initial parameters and all available seeds are recorded.
- Optimizer settings, stopping rules, and evaluation counts are explicit.
- Shots, measurement grouping, calibration, and mitigation costs are separated.
- Noise channels and their mapping to operations are described.
- SDK, dependency, Python, simulator, and backend details are captured.
- Timing boundaries are identical or clearly separated across implementations.
- Raw outputs, summary tables, and configuration files are versioned together.
- At least one independent statevector or objective-value check passes before optimization.
Use the stored baseline as a reference, not a permanent ranking. When you upgrade Qiskit, PennyLane, or Cirq, try the same manifest first; then run new experiments with changed settings in a separate comparison. That habit turns a one-time VQA comparison into a useful research and engineering record.
For broader SDK selection context, see Qiskit vs. PennyLane vs. Cirq, and for hybrid workflows review the practical hybrid quantum machine learning workflow.