Part IV. Protocols and Algorithms · Chapter 35
Variational Algorithms and Their Limits
A variational algorithm is a training loop with a quantum device inside it: a parameterized circuit, a measured objective, a classical optimizer, repeat. This chapter gives you the audit questions that decide whether such a loop produces utility or just consumes shots.
In this chapter 9 sections
Reader question. When does a variational quantum algorithm constitute a meaningful experiment rather than an under-specified optimization loop?
It is meaningful only when the ansatz, encoded problem, observable estimator, optimizer, noise, shot budget, initialization, and classical baselines are fixed and the full repeated-run distribution is reported; a lower objective on one small run is not evidence of advantage.
- The evidence review allows useful variational and NISQ experiments without generalizing from them.
- VQE, QAOA, and quantum machine learning retain separate contracts, each compared with a tuned classical baseline.
The hybrid loop as an experimental system
Name state preparation, measurement, optimizer, and stopping rule.
Variational algorithms split the work between two machines. The quantum device prepares a parameterized state and returns estimates of an objective; typically an expectation value. The classical computer looks at those estimates and proposes new parameters. Around and around until the objective stops improving or the budget runs out.
The appeal for near-term hardware is real: the circuit can be shallow compared to what a fully fault-tolerant algorithm demands, and some noise can be absorbed into the optimization. But shallower is not the same as useful. Hard optimization surfaces, noise that warps the objective, data-loading costs that erase the claimed speedup, and very strong classical baselines all survive the move to shallow circuits.
Evidence boundary. VQE estimates Hamiltonian energies with a parameterized quantum state and classical optimization loop. [Alberto Peruzzo et al.] [Michael A. Nielsen]
VQE grounds the objective in an observable
Write the energy estimator and shot decomposition.
Write . For parameters , VQE estimates from finite samples and passes that estimate to a classical optimizer. The variational principle bounds the exact expectation above the ground energy, but shot noise can make an estimator fluctuate below it. Keep exact expectation, sampled estimate, and optimizer record distinct.
Evidence boundary. Near-term variational algorithms face noise, sampling cost, trainability, and optimization limitations. [John Preskill] [Marco Cerezo et al.]
A two-parameter surface you can inspect
Run a small Hamiltonian with exact optimum available.
The quantum computer in this story is usually an expectation-value estimator. For an observable :
You never read directly; you estimate it from repeated measurements, with sampling error that shrinks like the inverse square root of the shot count. That single fact drives the economics of the whole approach. Estimating one objective may require summing many measured terms, each optimizer step needs its own estimates, and gradient-based training multiplies the cost again. A shallow circuit with a cheap price per run can still be an expensive algorithm.
For evaluating claims rather than running them, this book uses a decision checklist:
application_score = evidence_strength - baseline_gap - integration_risk - hardware_risk
It is not a law of nature. It is a forcing device: any memo that wants a build or invest decision must name its evidence, its baseline, and its risks explicitly.
Evidence boundary. QAOA and other variational claims require strong tuned classical baselines and complete resource accounting. [Edward Farhi] [National Academies of Sciences]
Notation contract: Hamiltonian H and energy E(θ)=<ψ(θ)|H|ψ(θ)>; shot budget, optimizer evaluations, seeds, and confidence summaries declared.
Noise, sampling, and optimizer variance
Separate three sources of run-to-run spread.
Energy uncertainty depends on coefficient weights, Pauli variances, grouping, and shot allocation; it is not one device-wide number. Hardware noise biases the landscape while sampling adds variance, and the optimizer reacts to both. Multiple disclosed seeds and budgets reveal instability that a best-run plot hides. Error bars must propagate to the final comparison with the classical baseline.
Ansatz and encoding can preclude success
Use expressibility and trainability as testable constraints.
If you have trained classical models, you already own most of the mental machinery. A variational algorithm is a noisy, expensive training loop:
- choose an ansatz,
- prepare the parameterized circuit,
- measure the objective terms,
- estimate gradients or use derivative-free updates,
- optimize classically,
- validate against the baseline,
- repeat under noise and sampling limits.
Every step can inject bias, variance, or hidden cost. Standard ML discipline applies unchanged: held-out test sets, honest baselines, ablations, reproducibility, and metric choice that matches the buyer's problem. The quantum part adds exactly one new virtue to cultivate; counting circuit evaluations; and removes none of the old ones.
Resource account: benchmark the whole loop
Require seeds, budgets, repeated trials, and classical comparators.
| Ledger row | Required record |
|---|---|
| Compiled circuit | Parameters, entanglers, native two-qubit count, routed depth, and qubit count. |
| One objective evaluation | Observable groups, shots per group, total circuit executions, and estimator uncertainty. |
| Optimization | Function and gradient evaluations, seeds, stopping rule, failed runs, and wall time. |
| Full experiment | Every seed at every shot budget; no best-run-only reporting. |
| Comparator | Exact diagonalization or best relevant classical solver on the same instance and accuracy target. |
Report encoding and ansatz, parameter count, circuit depth after compilation, observable groups, shots per evaluation, optimizer evaluations, every seed, wall time, exact or best-known reference, and final uncertainty. Compare against a classical method using the same instance and accuracy target. A low energy on a toy Hamiltonian establishes a run record, not scaling advantage.
Reproducible VQE benchmark card
| Field | Reader-visible record |
|---|---|
| Format | Pinned notebook, exact diagonalization baseline, repeated-seed run records, and result schema |
| Verification | CI reproduces the noiseless optimum, runs seeded shot/noise variants, validates budget equality, and reports distributions rather than best-only values. |
| Availability | Source-embedded acceptance record; no separate download is claimed |
{
"artifact": "Reproducible VQE benchmark card",
"format": "Pinned notebook, exact diagonalization baseline, repeated-seed run records, and result schema",
"acceptance_test": "CI reproduces the noiseless optimum, runs seeded shot/noise variants, validates budget equality, and reports distributions rather than best-only values.",
"publication_state": "source-embedded contract and worked fixture"
}Executable reference fixture
Run with Python 3.11 or later. The final assertion is the chapter-level pass condition for this small instance.
import math
def energy(theta): return math.cos(theta) # <0|Ry(theta)^dagger Z Ry(theta)|0>
def optimize(seed):
theta=seed
for _ in range(80): theta += 0.1*math.sin(theta)
return theta, energy(theta)
runs=[optimize(seed) for seed in (0.2,1.0,2.5)]
stalled=optimize(0.0)
assert all(e < -0.999 for _,e in runs)
assert stalled[1] == 1.0 and all(result[1] < stalled[1] for result in runs)
print(f"PASS: 35 variational runs={[round(result[1], 6) for result in runs]} stationary_boundary={stalled[1]:.1f}")
Scope boundary
- The evidence review allows useful variational and NISQ experiments without generalizing from them.
- VQE, QAOA, and quantum machine learning retain separate contracts, each compared with a tuned classical baseline.
Depth commitment. One exact baseline, one small objective surface, repeated seeded runs, and a benchmark card.
Practice problem
Run a two-parameter VQE instance with five fixed seeds at two shot budgets, compare with exact diagonalization, and report all outcomes.
H = Z0 + Z1 + 0.5 X0 X1
ansatz = Ry(theta0)|0> tensor Ry(theta1)|0>
seeds = [3, 11, 29, 47, 71]
shot budgets = [1000, 10000]
Report every seed-budget pair and the exact-diagonalization ground energy.
- Deliverable
- Pinned environment, run records, objective distributions, exact gap, and a no-advantage/limited-evidence conclusion.
- Pass condition
- The reference notebook replays seeds, validates total evaluations/shots, and recomputes summary statistics from raw records.
Verification record
Expected solution form. Reproducibility bundle with exact baseline and distributional rubric.
Model answer. For the declared product Ry ansatz, E(theta0,theta1)=cos(theta0)+cos(theta1)+0.5 sin(theta0)sin(theta1); its variational minimum is -2 at theta0=theta1=pi. Exact diagonalization of H gives -sqrt(4.25), exposing an ansatz gap. The complete result table must retain all ten seed-budget outcomes, including failures.
Model result and check. CI executes the notebook, validates schema and budgets, and fails if only the best run is reported.
Acceptance test. The reference notebook replays seeds, validates total evaluations/shots, and recomputes summary statistics from raw records.
Companion work
Artifacts for this chapter
These entries resolve to checked-in local source. Commands are reproduced exactly from the chapter manifest, and source-embedded fixtures are exported as direct downloads.
Reproduce or test
python3 tools/validate_briefs.py --briefs data/editorial_briefs_00_35.json --from 0 --through 35 --check-rewritten-sources --execute-artifacts
Provenance
Sources and review
- Alberto Peruzzo et al.. A variational eigenvalue solver on a photonic quantum processor. Nature Communications. 2014primary paper
- Michael A. Nielsen and Isaac L. Chuang. Quantum Computation and Quantum Information. Cambridge University Press. 2010textbook
- John Preskill. Quantum Computing in the NISQ era and beyond. Quantum. 2018peer-reviewed perspective
- Marco Cerezo et al.. Challenges and opportunities in quantum machine learning. Nature Computational Science. 2022peer-reviewed perspective
- Edward Farhi, Jeffrey Goldstone, and Sam Gutmann. A Quantum Approximate Optimization Algorithm. arXiv. 2014primary preprint
- National Academies of Sciences, Engineering, and Medicine. Quantum Computing: Progress and Prospects. National Academies Press. 2019consensus study report
The load-bearing claims in the chapter are mapped inline to this registered source set. A citation supports only the bounded claim beside it.