Case Study 1: The Shot Budget
"The most expensive quantum computation is the one you start without costing."
Executive Summary
A team plans a VQE run for a small molecule. Their instinct — a reasonable one — is to pick a shot count that "seems fine," start the optimizer, and see how it goes. Twenty-six hours of queue time later they have a result they cannot defend, because they never decided in advance what precision they needed.
This case study does the arithmetic first. It costs the full run before a single circuit is submitted, finds that the naive plan needs weeks of QPU time, and then applies four reductions that bring it under an hour — with an explicit accounting of what each one costs in accuracy.
The result is a number and a justification. That is the deliverable, and producing it is a skill that will make you unusually useful on any quantum project.
Skills applied: sampling error and $1/\epsilon^2$ scaling (§5.4); expectation values versus distributions (§5.5); Pauli measurement and basis grouping (§5.6); matching statistical precision to systematic error (§5.9).
The Plan, Uncosted
The target, as frozen in Chapter 1's project checkpoint:
- Molecule: H₂, STO-3G basis, 0.735 Å bond length.
- Target energy: −1.137 Ha.
- Required accuracy: 1.6 mHa (chemical accuracy).
The Hamiltonian for this system, after a Jordan–Wigner mapping (Chapter 36 builds it properly), decomposes into roughly 15 Pauli terms on 4 qubits. The energy is
$$E = \sum_{k} c_k \,\langle P_k \rangle$$
with coefficients $c_k$ of order 0.1 to 1.
The optimizer is COBYLA, and for an 8-parameter ansatz a typical run takes 200 iterations. Each iteration needs one full energy evaluation.
Now the question nobody asked: how many shots per Pauli term?
Step 1: What Precision Does Each Term Need?
Work backwards from the target.
We need the total energy to ±1.6 mHa. The energy is a weighted sum of 15 independent estimates, so their errors add in quadrature:
$$\sigma_E = \sqrt{\sum_k c_k^2 \,\sigma_k^2}$$
If we give every term the same $\sigma$, and take a representative $|c_k| \approx 0.3$:
$$\sigma_E \approx \sigma \cdot |c| \cdot \sqrt{15} = \sigma \times 0.3 \times 3.87 = 1.16\,\sigma$$
Setting $\sigma_E = 0.0016$ gives $\sigma \approx 0.0014$ per term.
Step 2: Convert to Shots
From §5.4, the standard error of a $\pm1$-valued observable is $\sqrt{(1 - \langle P\rangle^2)/N} \le 1/\sqrt{N}$. Worst case ($\langle P\rangle \approx 0$):
$$N = \frac{1}{\sigma^2} = \frac{1}{0.0014^2} \approx 510{,}000 \text{ shots per term}$$
Half a million shots. Per Pauli term. Per iteration.
Step 3: The Total
shots per term 510,000
x Pauli terms 15
x optimizer iterations 200
------------------------------------------------
TOTAL SHOTS 1,530,000,000
at 100 us per shot 153,000 s
= 42.5 HOURS of pure QPU time
And that is the optimistic figure. It ignores queue time, job overhead, circuit compilation, and the fact that a free-tier allowance is measured in minutes per month.
Forty-two hours of QPU time, for one molecule with two electrons.
💰 Cost and Queue — Why this number is the whole story.
H₂ is the smallest interesting molecule in chemistry. It is exactly solvable classically in microseconds. A quantum computer needs 42 hours of dedicated processor time to match that answer to chemical accuracy under the naive plan.
That gap — not gate fidelity, not qubit count — is the honest reason near-term quantum chemistry is hard, and it is the number that should appear in any serious feasibility assessment. Everything that follows in this case study is an attempt to close it, and the techniques are real; but the starting point is what a stakeholder needs to hear first.
Step 4: Four Reductions
Reduction 1: Group commuting terms (≈ 3–5×)
Terms that commute qubit-wise can be measured in the same basis and read from the same shots. The 15 terms of the H₂ Hamiltonian group into roughly 3 to 5 measurement bases rather than 15 separate ones.
15 terms -> ~4 measurement groups 3.75x fewer circuit executions
Cost in accuracy: none. This is free — the same data answers several questions. It is the first thing to do and it is genuinely a research area for larger Hamiltonians.
Reduction 2: Distribute shots by coefficient (≈ 1.5–2×)
Terms with large coefficients contribute more to the total error, so give them more shots. The optimal allocation puts shots in proportion to $|c_k|$:
$$N_k \propto |c_k|$$
For a Hamiltonian with a few dominant terms and many small ones — which is typical — this saves roughly a factor of two over uniform allocation, for the same total error.
Cost in accuracy: none. This is strictly better; uniform allocation is simply suboptimal.
Reduction 3: Loosen precision during optimization (≈ 10–50×)
Here is the reduction that matters most, and the one people miss.
The optimizer does not need chemical accuracy at every step. For the first 190 iterations it needs to know which direction is downhill, which tolerates far more noise. Only the final energy evaluation needs the full precision.
iterations 1-190: ~10,000 shots/term (sigma ~ 0.01, plenty for a gradient direction)
iterations 191-200: ~510,000 shots/term (the answer)
190 x 4 groups x 10,000 = 7,600,000
10 x 4 groups x 510,000 = 20,400,000
------------------------------------------
TOTAL 28,000,000 shots
= 2,800 s = 47 minutes
From 42.5 hours to 47 minutes, a factor of 54.
Cost in accuracy: some, and it must be checked. A noisy optimizer can converge to a slightly different point, and COBYLA in particular is not designed for stochastic objectives. The honest mitigation is to verify convergence at the final precision and, if it moved, iterate a few more steps. SPSA is a better choice than COBYLA precisely because it is built for noisy objectives — Chapter 24 §24.6 compares them.
Reduction 4: Match precision to systematic error (potentially large)
The step from §5.9 that everyone skips.
If the device's noise biases the energy by 20 mHa — entirely plausible for a 4-qubit circuit before mitigation — then estimating to ±1.6 mHa is estimating a biased quantity very precisely. You would be measuring the wrong number to three decimal places.
Under those conditions the right move is to stop and fix the bias, not to buy more shots. That means error mitigation (Chapter 13), better layout (Chapter 29), or a shallower ansatz (Chapter 28) — and only then spend on statistics.
systematic bias 20 mHa -> statistical precision beyond ~5 mHa is wasted
shots needed for 5 mHa -> ~52,000/term instead of 510,000 (10x less)
Cost in accuracy: none, if the bias is real. You cannot be more accurate than your systematic error, and pretending otherwise wastes shots and produces a falsely confident result.
Step 5: The Defensible Plan
BASELINE (naive) 42.5 hours
group commuting terms 3.75x -> 11.3 hours
coefficient-weighted shots 1.8x -> 6.3 hours
two-stage precision 54x -> 7 minutes
------------------------------------------------------------
With mitigation-limited precision, the binding constraint becomes
the SYSTEMATIC error, not the shot count.
The plan that goes in the proposal:
- Group the Hamiltonian into commuting sets. Report how many.
- Allocate shots proportional to $|c_k|$ within each group.
- Run the optimizer at 10,000 shots per group; final evaluation at full precision.
- Before spending on statistics, measure the systematic error by comparing an unmitigated hardware run to the noiseless simulator on the same ansatz and parameters. If the gap exceeds 1.6 mHa — it will — mitigation is the priority, not shots.
- Report the final energy with its statistical error bar, alongside the estimated systematic error, and state both.
Estimated total: under an hour of QPU time, with an explicit statement of what limits the accuracy.
Analysis
The naive plan and the defensible plan differ by a factor of roughly fifty in cost, and the difference is entirely in the thinking, not the hardware. Four observations generalize.
Cost the run before you start it. The arithmetic above takes twenty minutes and it changed the plan by a factor of fifty. There is no version of this project where doing it afterwards is better.
Precision is a requirement, not a preference. The 1.6 mHa came from chemistry — it is the threshold at which a computed energy is useful to a chemist. Every other number in the budget was derived from it. A shot count chosen without such a chain is unjustifiable.
Most of the savings came from noticing that not all evaluations need the same precision. This is a very general pattern: the expensive requirement usually applies to a small fraction of the work, and separating the two is where the factor of fifty lives.
Statistical precision beyond your systematic error is waste. This is the step most often skipped and the one with the largest potential saving. It also protects you from the worst outcome, which is not an imprecise answer but a falsely confident one.
Lessons
- Do the arithmetic before you submit. Shots × terms × iterations × 100 μs.
- Derive precision from the problem. 1.6 mHa is chemistry, not preference.
- Errors add in quadrature: $\sigma_E = \sqrt{\sum c_k^2 \sigma_k^2}$, so a 15-term Hamiltonian needs each term about $\sqrt{15}$ times more precise than the total.
- Group commuting terms. Free, and worth 3–5×.
- Weight shots by coefficient. Free, and worth ~2×.
- Loosen precision during optimization. The largest single saving, at the cost of needing to verify convergence — and it argues for a noise-tolerant optimizer.
- Match statistical precision to systematic error. If the bias is 20 mHa, precision beyond 5 mHa is waste, and the money belongs in mitigation instead.
- Report both errors. A statistical error bar without a systematic estimate is misleading, and the pair is what makes a result defensible.
Questions
-
Redo the budget for LiH, which has roughly 100 Pauli terms on 8–12 qubits and needs about 400 optimizer iterations. What is the naive cost? What does grouping realistically save when the term count is that much larger?
-
The budget assumed $\sigma \le 1/\sqrt{N}$ (the worst case, $\langle P\rangle \approx 0$). For terms whose expectation lands near $\pm 1$, the error bar is much smaller. Rework Step 2 assuming half the terms have $|\langle P\rangle| > 0.9$. How much does the total drop?
-
Write
shot_allocation(coefficients, total_shots)implementing the proportional-to-$|c_k|$ rule, and verify numerically that it beats uniform allocation for a realistic coefficient distribution. By how much? -
The two-stage precision scheme runs 190 iterations at low precision. What happens if the optimizer converges to a different minimum because of the noise? Design a check that would detect this, and say what it costs.
-
Step 4 argues that precision beyond the systematic error is waste. Construct a counterargument: under what circumstances would you want statistical precision much finer than your systematic bias? (Hint: think about zero-noise extrapolation in Chapter 13.)
-
Compute the free-tier feasibility. If a free plan gives 10 minutes of QPU time per month, which of the five plan variants above fit? Which molecule sizes are reachable in a month?
-
Hardest. Amplitude estimation achieves $1/N$ rather than $1/\sqrt N$. Rework the entire naive budget assuming it were available. What does 42.5 hours become? Then state precisely why it is not currently usable — what does the quadratic speedup demand of the circuit, and how does that interact with the coherence budget from Chapter 1 §1.5? This trade-off is the central tension of near-term quantum algorithm design.