CHAPTER 15
Variational algorithms and their limits
Learning goals. Derive a variational energy, use a parameter-shift gradient, explore QAOA, and evaluate claims under noise and classical comparison.
15.1 A hybrid optimization loop
A parameterized circuit prepares . Measurements estimate a cost such as
A classical optimizer chooses new parameters, and the loop repeats. The variational principle follows by expanding the state in energy eigenstates:
This guarantee assumes the correct Hamiltonian and a physical normalized state. A finite-shot or mitigated estimate can fall below the exact ground energy due to sampling or estimator bias; that does not violate the theorem.
The variational quantum eigensolver (VQE) uses this loop to seek low-energy states [27]. Its performance depends on the ansatz, initialization, optimizer, measurement allocation, and noise. The variational principle gives an energy bound, not a guarantee that the optimizer reaches the best state.
15.2 A fully solvable example
Take and prepare . Its Bloch vector is , so
Let and . Then
The minimum is at modulo . Differentiating gives . The condition has both maximum and minimum solutions; checking curvature or energy selects the minimum.
If θ is restricted to with relative phase zero, the circuit cannot reach every real direction needed for the optimum. Allowing a negative relative phase or the full rotation removes that artificial restriction. Parameter ranges are part of an ansatz definition.
15.3 Parameter-shift gradients
For a parameter appearing once in a rotation with , an expectation has the form . Therefore
This is exact under the stated generator and occurrence assumptions. It is not a generic two-evaluation formula for every parameterization. If a shared parameter occurs in many gates, contributions must be treated correctly.
With finite-shot evaluations, the gradient also has uncertainty. Optimizing beyond that uncertainty can waste shots or follow noise. Adaptive measurement allocation and stopping criteria belong in a serious experimental workflow.
Laboratory L20 — Variational energy. Manipulate θ and φ for H=Z+X/2, inspect the state and energy, and take gradient steps on θ. Compare with the exact ground energy. The exact classical solution is displayed because this is a learning problem.
15.4 QAOA as alternating dynamics
For a bit-string objective C(x), define the diagonal operator and mixer . A depth-p QAOA state is
For MaxCut, an edge (j,k) contributes , which is one when the bits differ. The cost phase does not change probabilities by itself; the mixer converts its relative phases into a changed output distribution.
For a triangle, every nonconstant assignment cuts two edges and the two constant strings cut zero. The optimum is two. The laboratory exactly simulates one QAOA layer and shows the entire distribution, so an improved expectation can be distinguished from certainty of the optimal string [28].
Laboratory L21 — A QAOA triangle. Change γ and β, inspect the eight probabilities, and compare expected cut value with the optimum two. The graph and objective are fixed and explicitly shown.
15.5 Trainability, noise, and honest benchmarks
A barren plateau is a regime where gradients become very small, often with variance decreasing rapidly with size under a specified random-circuit ensemble. It is not a theorem that every variational circuit is untrainable. Ansatz locality, depth, initialization, cost locality, and data structure matter [29].
An expressive ansatz may approximate many states but require expensive training. A restricted ansatz can be trainable yet miss the desired state. Noise can flatten a cost landscape or bias an optimum. An ideal state-vector optimizer provides information a hardware optimizer must estimate with shots.
A credible benchmark includes total quantum executions, classical optimizer effort, hyperparameter searches, state preparation, mitigation overhead, and the accuracy of the best relevant classical method. Comparing a carefully tuned quantum model with an untuned classical baseline is not evidence of a general advantage.
Annealing and adiabatic algorithms use different control models. In an ideal adiabatic argument, the system follows a changing Hamiltonian’s eigenstate when evolution is sufficiently slow relative to spectral-gap and smoothness conditions. A small minimum gap can make the required time large. A device’s ability to implement an Ising energy function does not establish efficient solutions to all hard optimization problems.
15.6 Exercises
15.1. Find the eigenvalues of Z+X/2 directly from its matrix.
Show solution / guidance
The determinant of is . Eigenvalues are .
15.2. Verify the parameter-shift formula for E(θ)=cosθ+sinθ/2.
Show solution / guidance
Substitute θ±π/2 and subtract: the cosine contribution gives , the sine contribution gives . Dividing by two matches the derivative.
15.3. What is the expected triangle cut value in the uniform state?
Show solution / guidance
Six strings have cost two and two have zero, so the expectation is . Each edge also has probability of being cut.
15.4. If β=0 in one-layer QAOA, can γ change computational-basis probabilities?
Show solution / guidance
No. The cost unitary is diagonal and changes only phases. Without a later noncommuting operation, the probabilities remain uniform.
15.5. A mitigated VQE energy estimate is below the exact ground energy. List two possible explanations consistent with quantum mechanics.
Show solution / guidance
Finite-shot fluctuation and mitigation bias can produce such an estimate. An incorrect Hamiltonian, calibration error, or software error are additional possibilities. The variational bound applies to the exact expectation of a physical state.