Classical Optimizers for Variational Quantum Algorithms

A variational quantum algorithm splits the labour of computation across two very different machines. A quantum processor prepares a parameterized state ∣ψ(θ)⟩=U(θ)∣0⟩|\psi(\boldsymbol{\theta})\rangle=U(\boldsymbol{\theta})|0\rangle and, by repeated measurement, returns an estimate of a cost C(θ)=⟨ψ(θ)∣H^∣ψ(θ)⟩C(\boldsymbol{\theta})=\langle\psi(\boldsymbol{\theta})|\hat{H}|\psi(\boldsymbol{\theta})\rangle; a classical computer — the optimizer — looks at that number and proposes the next θ\boldsymbol{\theta}. The Variational Quantum Eigensolver and the Quantum Approximate Optimization Algorithm are the flagship instances, and in both the classical optimizer is the outer loop that decides whether the whole scheme converges, stalls, or wanders. This article is about that outer loop: which method to pick, why, and what the quantum device does to the usual rules of optimization. The twist is the oracle. A classical optimizer normally assumes a smooth, deterministic, cheap function; a quantum device offers none of those. Every call returns not CC but a Monte-Carlo estimate C^\hat{C} from finitely many measurement shots, so the optimizer sees a random variable whose standard error shrinks only as 1/Nshots1/\sqrt{N_{\text{shots}}}; hardware noise biases it further; and each call is slow and expensive. Under these conditions the methods that dominate classical numerics — BFGS with tight finite-difference gradients, exact line searches — fall apart, and stochastic-approximation theory takes over. Two families remain viable. Gradient-based methods use the parameter-shift rule to extract an exact analytic gradient and feed it to stochastic gradient descent, Adam, or Quantum Natural Gradient. Gradient-free and hybrid methods — Nelder–Mead, COBYLA, and above all SPSA — sidestep the gradient for a fixed, dimension-independent evaluation budget. There is no universal winner, only the optimizer whose convergence guarantees and per-step cost match the oracle you actually have.

Key takeaways
  • A variational quantum algorithm is a hybrid loop: the quantum device evaluates C(θ)C(\boldsymbol{\theta}) from finite shots, and a classical optimizer proposes the next parameters until convergence.
  • The oracle is non-classical in two ways — estimates are stochastic (standard error ∼1/Nshots\sim 1/\sqrt{N_{\text{shots}}}) and hardware-biased, and landscapes can hide exponentially vanishing gradients (barren plateaus).
  • Gradient-based optimizers (SGD, Adam, Quantum Natural Gradient) get an exact, unbiased gradient from the parameter-shift rule; gradient-free ones (Nelder–Mead, COBYLA) and the hybrid SPSA avoid derivative estimation.
  • Quantum Natural Gradient preconditions the step with the inverse Fubini–Study metric, following the geometry of state space and converging in far fewer iterations on ill-conditioned landscapes.
  • SPSA estimates a gradient from only two cost evaluations regardless of the number of parameters pp, versus 2p2p for full parameter-shift — the decisive edge on slow, noisy hardware.
  • Key idea: treat the quantum device as a noisy, biased, shot-limited stochastic oracle; the right optimizer is the one whose convergence guarantees and per-step evaluation budget match that oracle — exact-gradient descent when parameter-shift is affordable and the landscape is benign, SPSA or gradient-free search when evaluations are precious or the gradient is unusable.
The core insight

Treat the quantum device as a noisy, biased, shot-limited stochastic oracle for the cost; then the best optimizer is the one whose convergence guarantees and per-step evaluation budget match that oracle — exact-gradient descent when parameter-shift is affordable and the landscape is benign, SPSA or gradient-free search when evaluations are precious or the gradient is unusable.

Where this lives today

Optimizer choice is a live, experimentally consequential decision in every variational-algorithm demonstration. In quantum chemistry, VQE runs reach for QNG or Adam fed by parameter-shift gradients when the ansatz is shallow enough that 2p2p evaluations per step are affordable, because those methods reach chemical accuracy in the fewest iterations on a benign landscape. On noisy devices with many parameters, SPSA is the default outer loop — it stands behind a large fraction of published NISQ VQE and QAOA results precisely because its two-evaluations-per-step budget survives where finite-difference methods drown. For QAOA the parameter space is small and structured, so gradient-free Nelder–Mead and COBYLA, warm-started from parameter-concentration transfer, remain competitive. And the open frontier is trainability: because equation (8) says no outer loop escapes a barren plateau, the active research is upstream of the optimizer — local cost functions, shallow problem-tailored ansätze, identity-block initializations, and layerwise growth that keeps the landscape resolvable as circuits scale. Frameworks such as PennyLane and Qiskit now ship parameter-shift, SPSA, and QNG as drop-in optimizers, making a once-esoteric choice a single line of configuration — one that still often decides whether an experiment converges.

The physical picture

Picture the optimizer as a hiker descending a fog-bound valley. Every altitude reading is jittery because it is a Monte-Carlo estimate from finite shots, and the compass — the gradient — may point slightly wrong because the hardware is noisy. When the compass is honest on average (a parameter-shift gradient), the hiker can march downhill with confidence. When each compass reading is ruinously expensive, the hiker instead pokes two random directions and steps down the average slope — that is SPSA. And when the terrain is a vast, dead-flat plateau (a barren plateau), no compass helps at all, because the ground is indistinguishable from noise in every direction and the only cure is to start in a different valley. The first figure draws this coupled machine explicitly: a quantum inner loop that samples the landscape and a classical outer loop that decides where to step.

Figure
The hybrid loop of a variational quantum algorithm: the quantum device is a stochastic oracle returning Ĉ with standard error about 1/√N per estimate, while the classical optimizer updates θ. One gradient costs 2p circuit evaluations by parameter-shift but only 2 by SPSA
The variational loop — a stochastic quantum oracle driven by a classical optimizer Quantum device · inner loop prepare |ψ(θ)⟩ = U(θ)|0⟩ measure Ĉ = ⟨ψ|Ĥ|ψ⟩ N shots ⇒ std ~ 1/√N + hardware noise → bias Classical optimizer · outer loop θ(k+1) = θ(k) − η ĝ(k) shift: 2p evals SPSA: 2 evals SGD · Adam · QNG · SPSA · COBYLA Robbins–Monro step schedule send θ(k) — the trial parameters return Ĉ and ĝ — noisy, shot-limited estimates

Geometry is the second thing the picture must convey. A given change in the parameters θ\boldsymbol{\theta} can move the underlying quantum state by a lot or by almost nothing, because parameter space is distorted relative to the space of states. Quantum Natural Gradient measures distances with the Fubini–Study metric — the natural ruler on state space — and so takes well-sized steps where plain gradient descent would either crawl or overshoot. But no amount of clever geometry saves an optimizer from the deepest hazard of the landscape: the barren plateau, where the variance of every gradient component decays exponentially with the number of qubits. The second figure makes that threat quantitative, plotting the gradient variance against qubit number and marking where it sinks beneath the shot-noise floor.

Figure
Barren-plateau gradient-variance decay: Var of ∂C falls as 2⁻ⁿ with qubit number n on a log₂ axis. At 10 000 shots per evaluation the shot-noise floor sits near 2⁻¹³·³ ≈ 1×10⁻⁴, so beyond about 13 qubits the gradient sinks below the noise and every local optimizer stalls
The punchline: gradient variance vanishes as 2⁻ⁿ — a barren plateau no optimizer escapes 2⁰ 2⁻⁴ 2⁻⁸ 2⁻¹² 2⁻¹⁶ 2 6 10 14 16 number of qubits n gradient variance Var ∂C shot-noise floor at 10 000 shots ≈ 2⁻¹³·³ n=4 · 0.0625 n=8 · 0.0039 n=12 · 2.4×10⁻⁴ stall near n ≈ 13

Underneath both figures sits one theorem. Stochastic-approximation theory (Robbins and Monro, 1951) says a noisy oracle is acceptable for a first-order method provided the gradient estimate is unbiased and the step size ηk\eta_k decays so that ∑kηk=∞\sum_k\eta_k=\infty while ∑kηk2<∞\sum_k\eta_k^2<\infty. The first condition lets the iterate travel any finite distance; the second drowns the accumulated noise. Adaptive methods such as Adam achieve the same stabilization by maintaining running averages of the gradient and its square, giving each coordinate its own effective learning rate.

The core equations

Everything begins with the object being minimized. A variational algorithm poses an optimization over circuit angles, with the cost defined as the expectation of a problem observable in the prepared state — a number the device can only estimate, never compute exactly.

θ⋆=arg⁡min⁡θ C(θ),C(θ)=⟨ψ(θ)∣H^∣ψ(θ)⟩(1)\boldsymbol{\theta}^\star=\arg\min_{\boldsymbol{\theta}}\,C(\boldsymbol{\theta}),\qquad C(\boldsymbol{\theta})=\langle\psi(\boldsymbol{\theta})|\hat{H}|\psi(\boldsymbol{\theta})\rangle \qquad (1)

where: θ∈Rp\boldsymbol{\theta}\in\mathbb{R}^p — vector of pp circuit parameters (rotation angles); ∣ψ(θ)⟩=U(θ)∣0⟩|\psi(\boldsymbol{\theta})\rangle=U(\boldsymbol{\theta})|0\rangle — ansatz state prepared by the parameterized unitary; H^\hat{H} — problem Hamiltonian or observable defining the cost; C(θ)C(\boldsymbol{\theta}) — scalar cost, estimated on the device with finite shots. Reading: the optimizer never sees CC itself, only a shot estimate C^\hat{C}, and its whole job is to walk θ\boldsymbol{\theta} toward θ⋆\boldsymbol{\theta}^\star using those estimates. The workhorse update is stochastic gradient descent: step against an unbiased estimate of the gradient, with a learning rate that may shrink over iterations. Its convergence under noise is not obvious and is exactly what stochastic-approximation theory secures.

θk+1=θk−ηk ∇C^(θk)(2)\boldsymbol{\theta}_{k+1}=\boldsymbol{\theta}_k-\eta_k\,\widehat{\nabla C}(\boldsymbol{\theta}_k) \qquad (2)

where: ηk>0\eta_k>0 — learning rate at iteration kk; ∇C^\widehat{\nabla C} — unbiased stochastic estimate of the gradient. Reading: because E[∇C^]=∇C\mathbb{E}[\widehat{\nabla C}]=\nabla C, the expected step points downhill even though any single step is corrupted by shot noise. The gradient itself comes not from finite differences but from the parameter-shift rule, an exact analytic formula that holds whenever a gate is generated by an operator with two distinct eigenvalues (any Pauli rotation qualifies).

∂jC(θ)=12[C(θ+π2ej)−C(θ−π2ej)](3)\partial_j C(\boldsymbol{\theta})=\frac{1}{2}\big[C(\boldsymbol{\theta}+\tfrac{\pi}{2}\mathbf{e}_j)-C(\boldsymbol{\theta}-\tfrac{\pi}{2}\mathbf{e}_j)\big] \qquad (3)

where: ej\mathbf{e}_j — unit vector along parameter jj; ∂jC\partial_j C — exact partial derivative of the cost. Reading: two evaluations at angles shifted by the macroscopic amount π/2\pi/2 return the true derivative with no truncation bias — the exact opposite of a finite difference, whose small denominator would amplify shot noise. Feeding an ordinary gradient into the Euclidean update ignores that state space is curved. Quantum Natural Gradient corrects this by preconditioning the step with the inverse Fubini–Study metric, so the effective step size respects how much each parameter actually moves the state.

θk+1=θk−η [F(θk)]−1∇C(θk)(4)\boldsymbol{\theta}_{k+1}=\boldsymbol{\theta}_k-\eta\,\big[F(\boldsymbol{\theta}_k)\big]^{-1}\nabla C(\boldsymbol{\theta}_k) \qquad (4)

where: F(θ)F(\boldsymbol{\theta}) — Fubini–Study metric tensor (quantum Fisher information divided by four); [F]−1[F]^{-1} — its (pseudo)inverse, preconditioning the step to state-space geometry. Reading: where FF has small eigenvalues — directions in which the state barely changes — F−1F^{-1} enlarges the step, curing the crawl that plagues plain descent in ill-conditioned regions. The metric that does the preconditioning is a geometric quantity built from the state's derivatives, real and positive-semidefinite, measuring how distinguishable neighbouring states are.

Fij=Re ⟨∂iψ∣∂jψ⟩−⟨∂iψ∣ψ⟩⟨ψ∣∂jψ⟩(5)F_{ij}=\mathrm{Re}\,\langle\partial_i\psi|\partial_j\psi\rangle-\langle\partial_i\psi|\psi\rangle\langle\psi|\partial_j\psi\rangle \qquad (5)

where: ∣∂iψ⟩|\partial_i\psi\rangle — derivative of the ansatz state with respect to θi\theta_i; FijF_{ij} — real, symmetric, positive-semidefinite metric tensor. Reading: the subtracted term strips off the pure-global-phase part of the state's change, which is physically invisible, leaving only motion that genuinely reshapes the state. When even 2p2p shift evaluations are unaffordable, SPSA collapses the gradient estimate to two evaluations by perturbing all parameters at once along a random sign vector.

g^k(θk)=C^(θk+ckΔk)−C^(θk−ckΔk)2ck Δk−1(6)\hat{g}_k(\boldsymbol{\theta}_k)=\frac{\hat{C}(\boldsymbol{\theta}_k+c_k\boldsymbol{\Delta}_k)-\hat{C}(\boldsymbol{\theta}_k-c_k\boldsymbol{\Delta}_k)}{2c_k}\,\boldsymbol{\Delta}_k^{-1} \qquad (6)

where: Δk\boldsymbol{\Delta}_k — random perturbation vector, each component ±1\pm1 (Bernoulli); ck=c/kγc_k=c/k^{\gamma} — perturbation magnitude, decaying with iteration; Δk−1\boldsymbol{\Delta}_k^{-1} — component-wise reciprocal of the perturbation vector. Reading: the estimate is noisy per step, but unbiased on average and independent of pp, which is why it dominates on large, expensive circuits. Any of these gradients can be smoothed by Adam, which keeps bias-corrected running moments and gives every coordinate an adaptive learning rate — the standard choice when the gradient itself is noisy.

mk=β1mk−1+(1−β1)gkvk=β2vk−1+(1−β2)gk2θk+1=θk−η m^kv^k+ϵ(7)\begin{aligned}m_k&=\beta_1 m_{k-1}+(1-\beta_1)g_k\\ v_k&=\beta_2 v_{k-1}+(1-\beta_2)g_k^2\\ \boldsymbol{\theta}_{k+1}&=\boldsymbol{\theta}_k-\eta\,\frac{\hat m_k}{\sqrt{\hat v_k}+\epsilon}\end{aligned} \qquad (7)

where: gkg_k — current stochastic gradient (parameter-shift or SPSA); mk,vkm_k,v_k — first- and second-moment running estimates; m^k=mk/(1−β1k)\hat m_k=m_k/(1-\beta_1^k), v^k=vk/(1−β2k)\hat v_k=v_k/(1-\beta_2^k) — bias-corrected moments; β1,β2,ϵ\beta_1,\beta_2,\epsilon — decay rates (typically 0.90.9, 0.9990.999) and a small constant (10−810^{-8}). Reading: dividing by v^k\sqrt{\hat v_k} shrinks steps along high-variance directions, damping the very shot noise that would otherwise destabilize the trajectory. Finally, the hazard that caps everything: on many ansätze the gradient variance itself decays exponentially in the qubit number, so no local method can find a downhill direction above the noise.

E[(∂jC)2]  ≤  G(n)  ∼  2−αn(8)\mathbb{E}\big[(\partial_j C)^2\big]\;\le\; G(n)\;\sim\;2^{-\alpha n} \qquad (8)

where: nn — number of qubits; α>0\alpha>0 — decay constant set by ansatz and circuit depth; G(n)G(n) — exponentially small gradient-variance bound. Reading: equation (8) is a property of the landscape, not the optimizer, so it cannot be defeated by a better outer loop — the remedy lives in the ansatz, the initialization, and the locality of the cost.

Derivation AParameter-shift gives an exact gradient, not a finite difference

The goal is to prove that for a gate generated by a Pauli operator — one whose generator GG satisfies G2=IG^2=I, so its eigenvalues are ±1\pm1 — the cost is a pure single-frequency sinusoid in that gate's angle, and therefore that shifting the angle by the macroscopic amount π/2\pi/2 and taking a difference returns the exact analytic derivative with zero truncation error. This is what lets a quantum device hand an optimizer an unbiased gradient rather than a noise-amplifying finite difference, and it underpins every gradient-based method in this article.

Step 1. Expand the gate as e−iθG/2=cos⁡(θ/2) I−isin⁡(θ/2) Ge^{-i\theta G/2}=\cos(\theta/2)\,I-i\sin(\theta/2)\,G, which is exact because G2=IG^2=I collapses the exponential series to the two trigonometric terms. Why: the whole argument rests on this identity — a Pauli generator makes the gate depend on θ\theta only through cos⁡(θ/2)\cos(\theta/2) and sin⁡(θ/2)\sin(\theta/2).

Step 2. Write the cost with the gate acting inside the expectation, C(θ)=⟨ψ0∣U†eiθG/2H^′e−iθG/2U∣ψ0⟩C(\theta)=\langle\psi_0|U^\dagger e^{i\theta G/2}\hat H' e^{-i\theta G/2}U|\psi_0\rangle, where H^′\hat H' absorbs the rest of the circuit conjugated onto H^\hat H; expanding the two exponentials produces terms in cos⁡2(θ/2)\cos^2(\theta/2), sin⁡2(θ/2)\sin^2(\theta/2), and sin⁡(θ/2)cos⁡(θ/2)\sin(\theta/2)\cos(\theta/2). Why: these are exactly the products that the double-angle identities turn into a single-frequency function.

Step 3. Apply cos⁡2=12(1+cos⁡θ)\cos^2=\tfrac12(1+\cos\theta), sin⁡2=12(1−cos⁡θ)\sin^2=\tfrac12(1-\cos\theta), and 2sin⁡cos⁡=sin⁡θ2\sin\cos=\sin\theta to collapse the expression to C(θ)=a+bcos⁡θ+csin⁡θC(\theta)=a+b\cos\theta+c\sin\theta, a constant plus one harmonic. Why: with only frequency-one content, three evaluations determine the whole function and two symmetric ones determine its slope.

Step 4. Differentiate directly, ∂θC=−bsin⁡θ+ccos⁡θ\partial_\theta C=-b\sin\theta+c\cos\theta, and evaluate the shift combination 12[C(θ+π2)−C(θ−π2)]\tfrac12[C(\theta+\tfrac{\pi}{2})-C(\theta-\tfrac{\pi}{2})]: the aa term cancels, the cos⁡θ\cos\theta terms cancel, and the sin⁡\sin terms add to give exactly −bsin⁡θ+ccos⁡θ-b\sin\theta+c\cos\theta. Why: the two sides are identically equal — the formula is exact for any shift-of-π/2\pi/2, so it is immune to both the truncation bias of small finite differences and the noise amplification of a small denominator. *Verified: matches Schuld et al. (2019); inserting a=b=c=1a=b=c=1 makes both the derivative and the shift combination equal cos⁡θ−sin⁡θ\cos\theta-\sin\theta; the single-qubit case C(θ)=cos⁡θC(\theta)=\cos\theta gives ∂θC=−sin⁡θ\partial_\theta C=-\sin\theta from both routes.*

Go deeper · Derivation B · 2 minSteepest descent in the Fubini–Study metric yields Quantum Natural Gradient
Derivation BSteepest descent in the Fubini–Study metric yields Quantum Natural Gradient

The goal is to derive the QNG update by changing the question descent asks: instead of "which parameter step of fixed Euclidean length lowers the cost most," ask "which step of fixed distance in state space lowers the cost most," where distance is the natural Fubini–Study metric rather than the arbitrary Euclidean norm on angles. This is the quantum analogue of Amari's natural gradient in information geometry, and it explains why QNG so often converges in a fraction of the iterations plain descent needs.

Step 1. Linearize the cost for a small step, C(θ+Δθ)≈C(θ)+∇C⊤ΔθC(\boldsymbol{\theta}+\Delta\boldsymbol{\theta})\approx C(\boldsymbol{\theta})+\nabla C^\top\Delta\boldsymbol{\theta}, so that to first order the change we want to minimize is just the directional derivative along Δθ\Delta\boldsymbol{\theta}. Why: keeping only the linear term makes the problem a clean constrained-optimization, valid for the infinitesimal steps descent actually takes.

Step 2. Constrain the step to a fixed natural distance, D2=Δθ⊤F Δθ=ϵ2D^2=\Delta\boldsymbol{\theta}^\top F\,\Delta\boldsymbol{\theta}=\epsilon^2, using the squared Fubini–Study distance between ∣ψ(θ)⟩|\psi(\boldsymbol{\theta})\rangle and ∣ψ(θ+Δθ)⟩|\psi(\boldsymbol{\theta}+\Delta\boldsymbol{\theta})\rangle in place of the Euclidean ∥Δθ∥2\|\Delta\boldsymbol{\theta}\|^2. Why: this is the substitution that injects state-space geometry — FF measures real, phase-invariant motion of the state, so equal-DD steps are equally significant physically.

Step 3. Form the Lagrangian L=∇C⊤Δθ+λ2(Δθ⊤F Δθ−ϵ2)\mathcal{L}=\nabla C^\top\Delta\boldsymbol{\theta}+\tfrac{\lambda}{2}(\Delta\boldsymbol{\theta}^\top F\,\Delta\boldsymbol{\theta}-\epsilon^2), minimizing the linearized cost change subject to the fixed-distance constraint with multiplier λ\lambda. Why: the constraint prevents the trivial answer of an infinitely long step, and the multiplier will set the learning rate.

Step 4. Set ∂L/∂Δθ=0\partial\mathcal{L}/\partial\Delta\boldsymbol{\theta}=0 to get ∇C+λF Δθ=0\nabla C+\lambda F\,\Delta\boldsymbol{\theta}=0, hence Δθ=−1λF−1∇C\Delta\boldsymbol{\theta}=-\tfrac{1}{\lambda}F^{-1}\nabla C, and absorb 1/λ1/\lambda into a learning rate η\eta to reach the boxed update Δθ⋆=−η F−1∇C\Delta\boldsymbol{\theta}^\star=-\eta\,F^{-1}\nabla C. Why: the inverse metric reweights the raw gradient, amplifying steps in stiff (small-eigenvalue) directions and shrinking them in soft ones.

Step 5. Read off the limits: when F=IF=I the update is ordinary gradient descent, and near a minimum the metric-corrected step follows the quadratic basin's true geometry, giving the fast convergence plain descent lacks when the Hessian is ill-conditioned. Why: this shows QNG is a strict generalization — it costs extra metric evaluations but never does worse than Euclidean descent on geometry grounds. *Verified: reduces to standard gradient descent when F=IF=I; the metric FijF_{ij} equals the quantum Fisher information divided by four, consistent with Stokes et al. (2020); for a single RY(θ)R_Y(\theta) rotation F=1/4F=1/4 exactly, so F−1=4F^{-1}=4 (checked in Worked example 3).*

Go deeper · Derivation C · 1 minThe shot budget sets a noise floor the step size must respect
Derivation CThe shot budget sets a noise floor the step size must respect

The goal is to trace how the finite number of measurement shots propagates from a single cost estimate into the variance of a parameter-shift gradient, and to turn that into a detectability condition — the smallest gradient the optimizer can reliably resolve. This links the measurement-estimation layer directly to optimizer stability, and it is the same inequality that fails exponentially on a barren plateau, connecting equation (8) to real shot counts.

Step 1. Write the shift gradient as a difference of two independent shot estimates, ∂jC^=12(C^+−C^−)\widehat{\partial_j C}=\tfrac12(\hat C_+-\hat C_-), where C^±\hat C_\pm come from separate shot sets at the two shifted angles, each with variance σ±2/Nshots\sigma_\pm^2/N_{\text{shots}}. Why: independence of the two shot sets is what lets their variances add without a covariance term.

Step 2. Propagate variance through the linear combination, Var[∂jC^]=14(Var[C^+]+Var[C^−])=σ+2+σ−24Nshots\mathrm{Var}[\widehat{\partial_j C}]=\tfrac14(\mathrm{Var}[\hat C_+]+\mathrm{Var}[\hat C_-])=\dfrac{\sigma_+^2+\sigma_-^2}{4N_{\text{shots}}}, where the factor 1/41/4 is the squared 1/21/2 prefactor. Why: this is the exact gradient variance — it shrinks only as 1/Nshots1/N_{\text{shots}}, the Monte-Carlo rate, so halving the error costs four times the shots.

Step 3. Demand that the gradient exceed its own standard error to be resolved, ∣∂jC∣≳σ+2+σ−22Nshots|\partial_j C|\gtrsim\dfrac{\sqrt{\sigma_+^2+\sigma_-^2}}{2\sqrt{N_{\text{shots}}}}, which is the detectability condition. Why: below this threshold the estimated gradient is pure noise and the optimizer performs a random walk instead of descending.

Step 4. Combine with equation (8): on a barren plateau ∣∂jC∣∼2−αn/2|\partial_j C|\sim 2^{-\alpha n/2}, so the condition forces Nshots≳2αnN_{\text{shots}}\gtrsim 2^{\alpha n} — exponentially many shots — while near a good minimum a modest budget suffices, which is why increasing shots as the optimizer converges is a standard stabilization trick. Why: this makes precise that the plateau is a shot-budget catastrophe, not something a cleverer step rule can dodge. *Verified: consistent with Monte-Carlo scaling 1/N1/\sqrt{N}; for the single-qubit case at θ=π/3\theta=\pi/3 the gradient variance is 0.125/Nshots0.125/N_{\text{shots}} (Worked example 2), and the crossover 2−n=10−42^{-n}=10^{-4} at N=104N=10^4 occurs at n≈13.3n\approx13.3 (Figure 2).*

Limiting cases

How the optimizer's behaviour changes across the regimes that actually arise in variational algorithms:

CaseResultMeaning
Shot-limited oracleVar[C^]=σ2Nshots\mathrm{Var}[\hat{C}]=\dfrac{\sigma^2}{N_{\text{shots}}}Simplex methods and exact line searches degrade because they trust the ordering of function values; stochastic-gradient methods with decaying step sizes stay provably convergent.
High dimension pp2p2p evals (shift) vs 22 evals (SPSA)Parameter-shift cost grows linearly in the parameter count; SPSA's cost is constant, so it wins decisively for large circuits.
Barren plateauVar[∂jC]∼2−αn\mathrm{Var}[\partial_j C]\sim 2^{-\alpha n}Gradients vanish exponentially in qubit number; every local optimizer needs exponentially many shots to step. Not curable by the optimizer.
Benign quadratic basinC≈C⋆+12(θ−θ⋆)⊤H(θ−θ⋆)C\approx C^\star+\tfrac12(\boldsymbol{\theta}-\boldsymbol{\theta}^\star)^\top H(\boldsymbol{\theta}-\boldsymbol{\theta}^\star)Near a minimum the loss is quadratic; natural-gradient and quasi-Newton methods converge superlinearly, while plain descent is limited by the Hessian condition number.
Noiseless simulatorC^→C\hat C\to C exactlyDeterministic optimizers (BFGS, Nelder–Mead) recover their classical performance; the special machinery matters only once shots and hardware noise enter.

Worked examples

1 · The exact parameter-shift gradient of a single rotation (fully worked)

A one-qubit circuit prepares ∣ψ(θ)⟩=RY(θ)∣0⟩|\psi(\theta)\rangle=R_Y(\theta)|0\rangle and measures the cost C(θ)=⟨Z⟩=cos⁡θC(\theta)=\langle Z\rangle=\cos\theta. Evaluate the parameter-shift gradient at θ=π/3\theta=\pi/3 and compare it with a central finite difference of step h=0.1h=0.1.

Step 1. The exact analytic derivative is ∂θC=−sin⁡θ\partial_\theta C=-\sin\theta, so at θ=π/3\theta=\pi/3 we expect ∂θC=−sin⁡(π/3)=−0.86603\partial_\theta C=-\sin(\pi/3)=\mathbf{-0.86603}. The cost itself there is C=cos⁡(π/3)=0.5C=\cos(\pi/3)=0.5.

Step 2. Apply the shift rule with π/2\pi/2: C(θ+π2)=cos⁡(5π/6)=−0.86603C(\theta+\tfrac{\pi}{2})=\cos(5\pi/6)=-0.86603 and C(θ−π2)=cos⁡(−π/6)=+0.86603C(\theta-\tfrac{\pi}{2})=\cos(-\pi/6)=+0.86603, so 12[C(θ+π2)−C(θ−π2)]=12(−0.86603−0.86603)=−0.86603\tfrac12[C(\theta+\tfrac{\pi}{2})-C(\theta-\tfrac{\pi}{2})]=\tfrac12(-0.86603-0.86603)=\mathbf{-0.86603} — exactly the analytic value, to every digit.

Step 3. Now the finite difference: [C(θ+h)−C(θ−h)]/(2h)[C(\theta+h)-C(\theta-h)]/(2h) with h=0.1h=0.1 gives (0.41103−0.58397)/0.2=−0.86458(0.41103-0.58397)/0.2=\mathbf{-0.86458}, which is off by 0.00144\mathbf{0.00144}. That error is the leading O(h2)O(h^2) truncation, h26∣C′′′∣=0.016sin⁡(π/3)=0.00144\tfrac{h^2}{6}|C'''|=\tfrac{0.01}{6}\sin(\pi/3)=0.00144 — and shrinking hh to reduce it would divide two ever-closer noisy numbers by an ever-smaller denominator, which is precisely why finite differences fail under shot noise while the shift rule does not. The shift rule returns −0.86603 exactly; the finite difference is biased by 1.4×10⁻³ and gets noisier as h shrinks.

2 · Shot noise, gradient variance, and detectability

The same circuit is run on hardware with Nshots=1000N_{\text{shots}}=1000 per evaluation. How noisy is the parameter-shift gradient at θ=π/3\theta=\pi/3, and is the gradient resolvable?

Step 1. A single ZZ measurement on a state with ⟨Z⟩=μ\langle Z\rangle=\mu has variance 1−μ21-\mu^2. At the shifted angles ⟨Z⟩=∓0.86603\langle Z\rangle=\mp0.86603, so μ2=0.75\mu^2=0.75 and each has σ±2=1−0.75=0.25\sigma_\pm^2=1-0.75=0.25.

Step 2. The gradient variance is Var[∂θC^]=σ+2+σ−24Nshots=0.54000=1.25×10−4\mathrm{Var}[\widehat{\partial_\theta C}]=\dfrac{\sigma_+^2+\sigma_-^2}{4N_{\text{shots}}}=\dfrac{0.5}{4000}=\mathbf{1.25\times10^{-4}}, a standard error of 0.0112\mathbf{0.0112}.

Step 3. Compare to the signal ∣∂θC∣=0.866|\partial_\theta C|=0.866: the signal-to-noise ratio is 0.866/0.0112≈780.866/0.0112\approx\mathbf{78}, so the gradient is comfortably resolved and the sign is never in doubt. Had this been a barren-plateau direction with ∣∂θC∣∼2−n/2|\partial_\theta C|\sim 2^{-n/2}, resolving it would demand Nshots≳2nN_{\text{shots}}\gtrsim 2^{n} shots — at n=13n=13 that is already ∼8000\sim8000 shots just to clear the noise floor once, as Figure 2 marks. At 1000 shots the gradient has SNR ≈ 78; on a plateau the required shots grow as 2ⁿ.

3 · SPSA cost saving and the QNG factor of four

A hardware VQE uses p=100p=100 parameters at 10001000 shots per evaluation. Compare the per-step cost of full parameter-shift with SPSA, and separately compute the Fubini–Study metric for a single RY(θ)R_Y(\theta) rotation.

Step 1. Full parameter-shift needs two evaluations per parameter, 2p=2002p=\mathbf{200} circuit evaluations per gradient, i.e. 200×1000=2.0×105200\times1000=\mathbf{2.0\times10^5} shots per optimizer step.

Step 2. SPSA needs exactly 2\mathbf{2} evaluations per step regardless of pp, i.e. 2×1000=20002\times1000=\mathbf{2000} shots per step — a 100×\mathbf{100\times} reduction. The price is a noisier per-step direction, but with a decaying step schedule the trajectory still converges; this is why SPSA is the default on slow NISQ hardware.

Step 3. For QNG on a single RY(θ)R_Y(\theta), the state derivative is ∣∂θψ⟩=12(−sin⁡θ2∣0⟩+cos⁡θ2∣1⟩)|\partial_\theta\psi\rangle=\tfrac12(-\sin\tfrac{\theta}{2}|0\rangle+\cos\tfrac{\theta}{2}|1\rangle), giving ⟨∂θψ∣∂θψ⟩=14\langle\partial_\theta\psi|\partial_\theta\psi\rangle=\tfrac14 and ⟨∂θψ∣ψ⟩=0\langle\partial_\theta\psi|\psi\rangle=0, so F=14−0=14F=\tfrac14-0=\tfrac14. The QNG step is therefore −ηF−1∂θC=−4η ∂θC-\eta F^{-1}\partial_\theta C=-4\eta\,\partial_\theta C: the metric rescales the bare gradient by exactly four. Parameter-shift costs 2.0×10⁵ shots per step versus 2×10³ for SPSA; the single-rotation Fubini–Study metric is 1/4, so QNG multiplies the gradient by 4.

Physics of the portrait

The intellectual backbone of this whole subject is not quantum mechanics but stochastic approximation — the mid-twentieth-century theory of how to optimize a function you can only sample noisily. Its most practical descendant, and the optimizer most used on real quantum hardware, is James Spall's simultaneous perturbation method.

Origins · 1 minJames Spall and how this was discovered
JS
James Spall
b. 1957, stochastic optimization and the SPSA algorithm · noisy-oracle optimization on real hardware

James C. Spall, a mathematician at the Johns Hopkins University Applied Physics Laboratory, gave variational quantum computing its most-used optimizer decades before the field existed. The lineage begins with Herbert Robbins and Sutton Monro, who in 1951 proved that a minimum can be found from noisy evaluations alone, provided the step sizes decay so that ∑kηk=∞\sum_k\eta_k=\infty and ∑kηk2<∞\sum_k\eta_k^2<\infty — the conditions that still license every stochastic optimizer here. Jacob Kiefer and Jack Wolfowitz extended this in 1952 to the gradient-free case, but their finite-difference scheme needs a pair of evaluations for every one of the pp coordinates. Spall's 1992 insight was that one need not perturb coordinates one at a time: perturb all pp parameters simultaneously along a single random sign vector, take two noisy evaluations, and the result is an unbiased gradient estimate at a cost independent of pp. That "simultaneous perturbation" is what makes optimization tractable on a slow, noisy device with hundreds of parameters, where 2p2p measurements per step would be ruinous. Alongside it sit Shun'ichi Amari's information-geometric natural gradient (1998), the classical parent of Quantum Natural Gradient, and the deep-learning workhorse Adam (Kingma and Ba, 2014). The story of variational quantum optimizers is really the story of these classical ideas meeting a new kind of oracle: quantum, shot-limited, and occasionally, catastrophically flat.

History
1951
— Robbins and Monro introduce stochastic approximation for noisy optimization
1992
— Spall introduces simultaneous perturbation stochastic approximation (SPSA)
1998
— Amari formulates the natural gradient in information geometry
2019
— Schuld and coworkers establish the parameter-shift rule on quantum hardware
2020
— Stokes and coworkers derive Quantum Natural Gradient from the Fubini–Study metric

Going further

Texts and papers. Cerezo et al., "Variational Quantum Algorithms", Nature Reviews Physics 3, 625 (2021) · Spall, "Multivariate stochastic approximation using a simultaneous perturbation gradient approximation", IEEE Trans. Automatic Control 37, 332 (1992), and the implementation paper, IEEE Trans. Aerospace and Electronic Systems 34, 817 (1998) · Stokes, Izaac, Killoran, Carleo, "Quantum Natural Gradient", Quantum 4, 269 (2020) · Schuld, Bergholm, Gogolin, Izaac, Killoran, "Evaluating analytic gradients on quantum hardware", Phys. Rev. A 99, 032331 (2019) · Kingma & Ba, "Adam: A Method for Stochastic Optimization", ICLR (2015) · McClean, Boixo, Smelyanskiy, Babbush, Neven, "Barren plateaus in quantum neural network training landscapes", Nature Communications 9, 4812 (2018) · Robbins & Monro, "A Stochastic Approximation Method", Ann. Math. Statist. 22, 400 (1951) · Amari, "Natural Gradient Works Efficiently in Learning", Neural Computation 10, 251 (1998) · Preskill, Ph219 lecture notes (Caltech); Nielsen & Chuang, Quantum Computation and Quantum Information.

Provenance. A verifier should reconfirm: the parameter-shift formula ∂θC=12[C(θ+π2)−C(θ−π2)]\partial_\theta C=\tfrac12[C(\theta+\tfrac\pi2)-C(\theta-\tfrac\pi2)] for Pauli generators via the sinusoid a+bcos⁡θ+csin⁡θa+b\cos\theta+c\sin\theta (Schuld et al. 2019); the QNG update Δθ=−ηF−1∇C\Delta\boldsymbol\theta=-\eta F^{-1}\nabla C and the Fubini–Study metric Fij=Re⟨∂iψ∣∂jψ⟩−⟨∂iψ∣ψ⟩⟨ψ∣∂jψ⟩F_{ij}=\mathrm{Re}\langle\partial_i\psi|\partial_j\psi\rangle-\langle\partial_i\psi|\psi\rangle\langle\psi|\partial_j\psi\rangle (Stokes et al. 2020); the SPSA estimator and its two-evaluation cost (Spall 1992); the Adam recursion with β1=0.9,β2=0.999,ϵ=10−8\beta_1=0.9,\beta_2=0.999,\epsilon=10^{-8} (Kingma & Ba 2015); Monte-Carlo variance scaling 1/Nshots1/\sqrt{N_{\text{shots}}} and the gradient variance 0.125/N0.125/N for the single-qubit θ=π/3\theta=\pi/3 case; the Robbins–Monro conditions; and the single-rotation metric F=1/4F=1/4. The barren-plateau scaling Var[∂jC]∼2−αn\mathrm{Var}[\partial_j C]\sim2^{-\alpha n} is stated qualitatively, consistent with McClean et al. (2018); the n≈13.3n\approx13.3 crossover at 10410^4 shots follows from 2−n=10−42^{-n}=10^{-4}. No fabricated constants beyond standard optimizer defaults.

Prerequisites. Cost-Function and Measurement Estimation in Variational Algorithms · Parameter-Shift Rules and Quantum Gradients · Parameterized Quantum Circuits and Ansatz Design · Variational Quantum Eigensolver. Leads to. Barren Plateaus in Variational Landscapes · Strategies to Mitigate Barren Plateaus · Quantum Approximate Optimization Algorithm · Quantum Machine Learning Models.

Ask the tutor: Ask me to walk through the parameter-shift gradient of your own ansatz, or to work out whether SPSA, QNG, or Adam is the right optimizer for your shot budget and qubit count.

Why can't I just use scipy's BFGS out of the box?

You can run it, but it will usually underperform or fail, because BFGS builds its curvature model from finite-difference gradients with tiny steps — and a tiny step divided into two shot-noisy cost estimates produces a gradient that is mostly noise. Its line search also assumes each trial step strictly decreases the cost, an assumption stochastic estimates violate constantly, so the search either stalls or takes wild steps. If you must use a quasi-Newton method, feed it parameter-shift gradients rather than finite differences and increase the shot count near convergence. In practice SPSA, Adam-on-parameter-shift, or QNG are better matched to the noisy oracle and are what most frameworks default to.

How many shots should I spend per cost evaluation?

There is a genuine trade-off, not a fixed answer. Gradient variance scales as 1/Nshots1/N_{\text{shots}}, so more shots per evaluation buy a cleaner step but at linear cost in wall-clock time. Early in training, when you are far from the minimum and the gradient is large, a coarse estimate with few shots is enough to point downhill; near convergence, when the gradient shrinks toward the noise floor, you need more shots to keep resolving it — which is why adaptive shot schedules that ramp NshotsN_{\text{shots}} up over training are effective. A useful check is the detectability condition: keep NshotsN_{\text{shots}} large enough that the gradient's standard error stays well below its magnitude.

Is Quantum Natural Gradient always worth the extra cost?

Not always. QNG needs the Fubini–Study metric FF, which costs extra circuit evaluations to estimate (a block-diagonal approximation keeps this affordable) and must be inverted or regularized. The payoff is far fewer iterations on ill-conditioned landscapes where parameters differ wildly in how much they move the state. If your ansatz is well-conditioned, or each metric evaluation is expensive relative to the iterations saved, plain Adam-on-parameter-shift can win on total shot budget. QNG shines when the geometry is genuinely distorted and iterations, not per-iteration cost, are the bottleneck.

If SPSA is so cheap, why not use it for everything?

Because its cheapness is bought with a noisier per-step direction. SPSA's gradient estimate is unbiased but has higher variance than a full parameter-shift gradient, so it typically needs more iterations to converge and can meander near the minimum. When pp is small and evaluations are cheap — a noiseless simulator, or a shallow QAOA circuit — full parameter-shift or a gradient-free simplex often reaches the minimum in fewer total evaluations. SPSA's constant, dimension-independent cost only pays off when pp is large and each evaluation is expensive, which is exactly the NISQ-hardware regime where it has become the default.

Does the optimizer have anything to do with barren plateaus?

No, and this is the most important boundary to keep straight. A barren plateau is a property of the cost landscape — the gradient variance decays exponentially in qubit number for a given ansatz and cost — so it is present before any optimizer touches the problem. Every local method, gradient-based or gradient-free, is defeated equally, because the cost is indistinguishable from noise in all directions except near a minimum. The optimizer cannot manufacture signal that is not there. The genuine remedies all live upstream: shallow or problem-tailored ansätze, local (rather than global) cost functions, careful initialization near an identity block, and layerwise training that keeps the landscape resolvable as the circuit grows.

Why is hardware noise a bias rather than just more variance?

Shot noise is zero-mean: average enough shots and the estimate converges to the true C(θ)C(\boldsymbol{\theta}). Hardware noise — decoherence, gate infidelity, readout error — is different, because it systematically distorts the prepared state and the measured observable, so the device reports the expectation of H^\hat H in a corrupted state rather than the ideal one. Averaging more shots reduces the variance around that wrong value but does not remove the offset, which is a bias. This is why error mitigation (zero-noise extrapolation, readout correction) operates alongside the optimizer: the optimizer handles the stochastic part, while mitigation targets the systematic part that no amount of shot averaging can fix.

Before this

Where this leads