Choosing the right number of quantum measurement shots is a statistical and engineering decision, not a fixed rule. This guide provides a repeatable workflow for estimating shot requirements, allocating measurements across observables, grouping compatible terms, and deciding when extra hardware runs are justified in Qiskit, PennyLane, VQE, QAOA and quantum machine learning experiments.
Overview
A quantum circuit produces a probability distribution, but a device returns individual measurement outcomes. A shot is one execution of the circuit followed by measurement. Repeating the circuit many times allows you to estimate quantities such as bitstring probabilities or the expectation value of an observable.
For a Pauli measurement with outcomes represented by +1 and −1, the expectation value is estimated as:
mean = (number of +1 outcomes − number of −1 outcomes) / total shots
More shots usually reduce statistical uncertainty, but they do not automatically remove hardware noise, calibration drift, readout error or an unsuitable circuit design. The practical question is therefore not simply “How many shots should I use?” It is:
- What precision is required for the decision or optimisation step?
- Which observables contribute most to the final result?
- Can compatible observables be measured in the same circuit execution?
- Is the experiment running on a simulator or real hardware?
- Does the additional execution cost produce information that changes the conclusion?
This distinction matters in a VQE, where the energy is a weighted sum of expectation values, and in quantum machine learning, where noisy estimates can affect gradients and training stability. For broader VQE planning, see the quantum chemistry VQE workflow.
How to estimate
For a bounded observable with outcomes in the interval [−1, 1], the standard error of a sample mean can be estimated from the observed sample variance:
standard error = sample standard deviation / square root of shots
If the variance is unknown before execution, a conservative planning approximation is useful. For a binary ±1 observable, the largest variance is 1, so a rough two-sided confidence interval has half-width:
margin ≈ z × 1 / square root of shots
Here, z is a chosen normal-approximation multiplier. For planning, many teams use a value near 2 for an approximately 95% interval, while recognising that this is an approximation rather than a guarantee. Rearranging gives:
shots ≈ (z / desired margin)²
For example, a target margin of 0.05 with a planning multiplier of 2 gives roughly 1,600 shots for one bounded observable under ideal statistical assumptions. A target margin of 0.01 would require roughly 40,000 shots. The quadratic relationship is important: reducing the margin by half requires about four times as many shots.
For a Hamiltonian written as H = Σᵢ wᵢPᵢ, where each Pᵢ is an observable and wᵢ is its coefficient, the estimated energy is:
E = Σᵢ wᵢ⟨Pᵢ⟩
Assuming independent measurement estimates, an approximate variance for the energy is:
Var(E) ≈ Σᵢ wᵢ² Var(Pᵢ) / shotsᵢ
This shows why equal shots are not always efficient. Large coefficients and high-variance observables contribute more to the uncertainty budget. A precision-targeted allocation gives more shots to terms that have a larger effect on the final quantity.
| Allocation method | How it works | Best use | Main limitation |
|---|---|---|---|
| Fixed | Use the same shot count for every circuit or observable. | Initial tests, regression checks and simple baselines. | May oversample low-impact terms and undersample important ones. |
| Adaptive | Run a pilot, estimate variance, then increase shots where uncertainty is highest. | Iterative VQE or QAOA workflows with changing observables. | Needs extra pilot executions and careful stopping rules. |
| Precision-targeted | Allocate shots to meet a target uncertainty for an observable or final energy. | Final estimates, comparisons and acceptance criteria. | Requires a defensible error model and coefficient information. |
Group commuting observables
Terms that can be measured in a compatible basis may be grouped so that one circuit execution produces information about several observables. This can reduce the number of distinct circuit configurations, although it does not make the measurements free: the group still needs enough shots, and grouping can introduce trade-offs in variance, circuit depth and compilation.
Use the grouping method supported by the current SDK or primitive rather than assuming that every commuting set is handled identically. Record the grouping strategy, basis rotations and resulting circuit identifiers in your experiment metadata. The quantum experiment reproducibility checklist covers the wider record-keeping workflow.
Inputs and assumptions
Before setting a shot budget, write down the inputs that control the estimate:
- Target quantity: an individual expectation value, a Hamiltonian energy, a gradient or a classification metric.
- Required precision: an absolute or relative tolerance, such as an energy margin or observable confidence interval.
- Observable range: confirm whether outcomes are ±1, another bounded range, or a post-processed quantity.
- Coefficients: record the weights in the Hamiltonian or loss function. A small coefficient may not deserve the same allocation as a dominant one.
- Pilot variance: use an initial batch to estimate variance rather than relying only on the worst-case assumption.
- Grouping plan: count measurement groups and note any extra basis-change gates.
- Execution constraints: check the active backend or service for limits on shots per job, batching behaviour, queueing, circuit count and result format.
- Noise model: distinguish sampling uncertainty from device error. More shots reduce the former, but usually not the latter.
Simulator results need separate interpretation. A statevector or analytic simulator may calculate an expectation value without sampling noise. A shot-based simulator can reproduce sampling uncertainty and is useful for testing allocation logic. Hardware adds execution time, compilation effects, readout noise and possible run-to-run variation. Validate the statistical workflow on a simulator, then repeat a smaller pilot on the target device before committing a large hardware budget.
Worked examples
Example 1: fixed allocation for a first pass
Suppose a Hamiltonian has 12 Pauli terms and the first objective is to compare two ansatz settings rather than publish a high-precision energy. Allocate 1,000 shots to each measurement circuit as a baseline. Store the per-term means, variances and confidence intervals. This gives a consistent comparison, but it should be treated as a diagnostic budget, not proof that every term has equal statistical importance.
Example 2: adaptive allocation
Run a pilot of 200 shots for each measurement group. If one group has a substantially larger observed variance or carries a large Hamiltonian coefficient, allocate the next batch to that group. Recompute the estimated energy uncertainty after each batch and stop when the uncertainty is below the decision threshold. Keep a maximum-shot limit so that an unstable hardware run cannot consume the entire budget.
Example 3: reusable Qiskit and PennyLane planning templates
SDK APIs change, so treat the following as planning templates rather than version-specific copy-and-paste guarantees. In Qiskit, define the observable list, measurement groups, pilot shots, target precision and backend constraints before constructing jobs. With the current primitives, inspect the installed documentation for the supported shot or precision options and result metadata.
# Pseudocode for a Qiskit-style plan
observables = [...] # Pauli terms and coefficients
groups = group_compatible_terms(observables)
pilot_shots = 200
target_energy_error = 0.02
for group in groups:
result = run_group(group, shots=pilot_shots)
variance[group] = estimate_variance(result)
allocation = choose_shots(
coefficients=coefficients,
variance=variance,
target_error=target_energy_error,
max_shots_per_job=backend_limit
)
final_result = run_groups(groups, shots=allocation)
In PennyLane, measurement-return behaviour depends on the device, interface and execution mode. Define the Hamiltonian and grouping strategy explicitly, use a finite-shot device or execution configuration for sampling tests, and calculate uncertainty from returned samples or repeated estimates.
# Pseudocode for a PennyLane-style plan
pilot_device = make_device(shots=200)
energy = make_hamiltonian_expectation(pilot_device, hamiltonian)
pilot_values = evaluate_terms(energy)
term_variance = estimate_variance(pilot_values)
shots = allocate_for_precision(
weights=hamiltonian_coefficients,
variance=term_variance,
target=target_energy_error
)
final_device = make_device(shots=shots)
final_energy = evaluate_terms_on_device(final_device)
For QAOA or optimisation experiments, connect the shot plan to the quantity that drives the decision. A small difference in objective value is not meaningful if its confidence intervals overlap substantially. For VQE, compare energy uncertainty with the improvement between iterations. For quantum machine learning, assess whether shot noise is larger than the validation metric change you are trying to interpret.
When to recalculate
Recalculate the shot plan whenever an input changes, rather than reusing a number indefinitely. Review it when:
- the Hamiltonian, observable weights or ansatz changes;
- the optimisation moves to a region with different observed variance;
- measurement grouping or transpilation changes circuit depth;
- you switch between a simulator and hardware;
- the backend changes its shot limits, batching behaviour or execution interface;
- the required precision or business decision threshold changes;
- calibration, readout mitigation or error-mitigation settings are introduced; or
- an SDK or primitive release changes measurement, observable or result APIs.
A practical review cycle is to run a pilot, estimate uncertainty, allocate the next batch, and stop when the result supports the intended decision. Preserve the code version, environment, backend name, transpilation settings, grouping method, random seeds where applicable, shot counts and raw counts. This makes a later recalculation meaningful rather than merely repeatable in appearance.
Use fixed allocation for a transparent baseline, adaptive allocation when variance is uncertain, and precision-targeted allocation when the final error budget matters. Then compare the resulting uncertainty with hardware variability and the size of the effect you are trying to measure. If extra shots no longer change the decision, spend the remaining effort on circuit design, calibration, grouping or a classical benchmark instead. For related algorithm evaluation, see how to benchmark quantum algorithms against classical methods.