Quiz: Variational Algorithms

Answers with explanations at the end.


1. State the four steps of the hybrid loop and say which parts run where.

2. What does the variational principle guarantee, and why does it matter?

3. VQE on H₂ reaches −1.857275030 Ha against an exact −1.857275030 Ha. What is the reference value and how was it obtained?

4. Why does the H₂ ansatz start with an X gate rather than from $|00\rangle$?

5. What is chemical accuracy, and what is it the threshold for?

6. At the optimal parameters on a noiseless simulator, 10,000 shots gives a mean error of 1.75 mHa. Why is this result surprising, and what does it imply for hardware runs?

7. Why does §24.3's table report a mean over 25 repetitions rather than a single number?

8. Write the relation between shots and precision, and compute the shots needed for chemical accuracy at $\sigma = 0.5$.

9. A gradient costs how many circuit evaluations? Compute the total shot budget for 100 parameters at 200 iterations and 97,657 shots per evaluation.

10. Name the three directions in which the shot budget scales badly, and say what techniques change and do not change.

11. What does qml.set_shots replace, and why does the distinction matter for reproducibility?

12. Write the QAOA ansatz and say how many parameters $p$ layers require.

13. Why is QAOA's ansatz less vulnerable to barren plateaus than a hardware-efficient one?

14. QAOA at $p=3$ gives a mean cut of 3.9918 when the optimum is 4. Is that the answer? What is?

15. Give the QAOA approximation ratios at $p = 1, 2, 3$ and compare each to the Goemans–Williamson guarantee.

16. State the two things that must be said about the QAOA-versus-Goemans–Williamson comparison — one favouring each side.

17. Why is $p = 1$ the depth that matters for the comparison?

18. Name four concerns from Parts II and III that apply simultaneously to a single VQE run, and give one way two of them interact.

19. Explain how adding error mitigation can make a variational result worse.

20. Does VQE beat classical methods for quantum chemistry today? Give the three barriers in order of severity.


Answers

1. Prepare a parameterized state $|\psi(\theta)\rangle$ (QPU), measure the expectation value $\langle\psi(\theta)|H|\psi(\theta)\rangle$ (QPU), optimize $\theta$ (classical), repeat. The quantum computer evaluates a function; the classical computer minimizes it.

2. $\langle\psi|H|\psi\rangle \geq E_0$ for any state. So the minimum you find is an upper bound on the true ground-state energy — you can never accidentally report an energy below the truth, and any improvement is real progress. It is why VQE is trusted in a way many heuristics are not.

3. −1.857275030 Ha, obtained by directly diagonalizing the 4×4 Hamiltonian matrix in NumPy — computed independently, before running anything, per Chapter 7 §7.7's habit. It matches the literature value of about −1.8572 Ha for H₂ at 0.735 Å.

4. The X prepares the Hartree–Fock reference state $|10\rangle$ — the best mean-field solution, which is classically computable and usually within a few percent of the truth. VQE's job is the correlation energy, the remainder that mean-field theory cannot capture. Starting from $|00\rangle$ wastes parameters re-deriving what Hartree–Fock gives free.

5. 1.6 mHa (0.0016 Hartree) — the threshold below which a computed energy is accurate enough to predict reaction rates usefully.

6. Because 1.75 mHa exceeds chemical accuracy (1.6 mHa) at parameters that are exactly correct, with no hardware noise, no decoherence, and no optimization error. Shot noise alone defeats the target at 10,000 shots. For hardware runs it means the shot budget must be settled before any noise question — you need roughly 100,000 shots per evaluation just for sampling.

7. Because the error is a random quantity and a single draw is not informative — the standard deviation is comparable to the mean (at 1,000 shots: mean 6.52e-03, std 4.57e-03). A single seeded draw is reproducible but arbitrary, and it changes if the sampling API consumes randomness differently.

8. $N \sim (\sigma/\epsilon)^2$. At $\sigma = 0.5$, $\epsilon = 0.0016$: $(0.5/0.0016)^2 \approx 97{,}656$ shots per evaluation.

9. $2n+1$ evaluations (Chapter 16 §16.4). For 100 parameters: $201 \times 200 \times 97{,}657 \approx 3.93 \times 10^9$ — about four billion shots, or 4.5 days of continuous QPU time at 10,000 shots/second.

10. Precision costs $1/\epsilon^2$; parameters cost $2n+1$ per gradient; the Hamiltonian grows as $\mathcal{O}(n^4)$ terms for molecular systems, each needing its own measurement basis. Techniques that help by constant factors: grouping commuting terms, classical shadows, gradient-free optimizers. None of them changes the $1/\epsilon^2$.

11. It replaces passing shots= to qml.device, which is deprecated in PennyLane 0.45. It matters for reproducibility because the two forms consume randomness differently, so the same seed produces different draws — which is a good reason to report a mean over repetitions rather than a single seeded value.

12. $|\psi(\gamma,\beta)\rangle = \prod_{k=1}^{p} e^{-i\beta_k H_M}e^{-i\gamma_k H_C}H^{\otimes n}|0\rangle$ — alternating cost and mixer layers. $p$ layers require $2p$ parameters.

13. Because the ansatz is problem-informed by construction: the cost layer is built directly from the graph. Chapter 16 §16.6 identified problem-informed ansätze as the main defence against barren plateaus, and QAOA gets one for free rather than having to design it.

14. No. $\langle C\rangle$ is what the optimizer minimizes; what you want is a specific good cut. So you sample the optimized state and keep the best result — at $p=3$ the best sampled cut was 4 (the optimum), appearing in 99.5% of shots — and verify it classically, which is trivial for a cut.

15. $p=1$: 0.8086below the guarantee. $p=2$: 0.9636 — above. $p=3$: 0.9979 — above. Goemans–Williamson guarantees 0.87856 for any graph, in polynomial time, since 1995.

16. For QAOA: the measurements are on one small instance, where QAOA at $p\geq2$ comfortably exceeds 0.8785 — and G–W's number is a worst-case guarantee, so it also does better on easy instances. Against QAOA: it has no guarantee at all — no theorem gives ratio $f(p)$ for arbitrary graphs, and known instance families defeat low-depth QAOA. A proven worst-case bound and a good average-case result are different kinds of claim.

17. Because depth is what hardware cannot supply. Each layer applies the full cost Hamiltonian — one two-qubit interaction per edge — giving $\mathcal{O}(p|E|)$ two-qubit gates, plus up to 3.18× routing overhead (Chapter 17) on a non-local interaction graph. Current error rates limit executable depth to about $p=1$, which is exactly where the classical algorithm wins.

18. Any four of: layout choice (Ch. 12, 0.9727 vs 0.2844 correctness), readout mitigation (Ch. 13, −64%), mitigation ordering (Ch. 13, −79% combined), barren plateaus (Ch. 16), gradient cost (Ch. 16, $2n+1$), connectivity overhead (Ch. 17, up to 3.18×), ancilla hygiene (Ch. 19). Interaction: more parameters gives better expressibility and a larger gradient bill and a flatter landscape — or: a deeper ansatz means more error, so more mitigation, so more shots.

19. Because mitigation costs shots — readout mitigation needs calibration circuits and ZNE needs 3–5× the circuits (Chapter 13 §13.9). At a fixed total budget, spending shots on mitigation reduces the shots available per evaluation, which increases the shot noise. If shot noise already dominates the error, the trade is negative.

20. No. Every molecule currently in reach is exactly solvable classically (full configuration interaction), and coupled-cluster methods handle somewhat larger ones; the crossover is estimated around 50+ well-correlated orbitals. Three barriers, in order: (1) the shot budget — $1/\epsilon^2$ times $2n+1$ times iterations, running to billions, with no known technique changing the exponent; (2) barren plateaus — gradient variance halving per qubit, roughly $10^{15}$ shots per gradient at 50 qubits; (3) hardware noise — a 288× gate-quality spread, mitigation overhead, and depth limits on ansatz expressibility.