Simultaneous perturbation optimization
A stochastic classical optimization method that estimates a multidimensional update from a small number of noisy objective evaluations.
Also called SPSA
On this page
Definition, purpose and input assumptions
SPSA, simultaneous perturbation stochastic approximation, is a classical optimizer often used around quantum expectation evaluations. It perturbs all parameters at once and forms a noisy gradient-like estimate from two objective values. Its appeal is low evaluation count per update, not exact recovery of every gradient component from only two numbers.
Mathematical mechanism
For random independent signs Delta_i and perturbation scale c, define ghat_i=[F(theta+cDelta)-F(theta-cDelta)]/(2cDelta_i). Under appropriate smoothness and randomness assumptions, averaging removes cross-coordinate contributions and the bias vanishes as c decreases. One realization can differ substantially from the true gradient. Step-size and perturbation schedules affect convergence.
Fully solved reference example
Take F(theta1,theta2)=theta1^2+2theta2^2 at(1,1), whose gradient is(2,4). With Delta=(1,-1), the two values are 3-2c+3c^2 and 3+2c+3c^2. Their difference divided by 2c is -2, giving ghat=(-2,2). With Delta=(1,1), the difference quotient is 6, giving(6,6). Averaging these two distinct sign directions yields(2,4), exactly the true gradient for this quadratic example.
The first single estimate even points against the true derivative in its first coordinate. That is expected stochastic behavior, not a proof of algorithm failure or exact gradient access.
Limitations and classical comparison
Two evaluations per update do not guarantee lower total cost because more iterations or repeated perturbations may be needed. Quantum shot noise adds another variance source. Classical analytic gradients, parameter shifts and derivative-free optimizers should be compared at equal accuracy and objective-evaluation cost.
Scientific relationships
SPSA is a classical optimization alternative for VQE and QAOA. It differs from exact parameter-shift differentiation and does not create a quantum speedup by itself.
Four simultaneous directions for a coupled quadratic
Let F(θ1,θ2,θ3)=(θ1+2θ2)²+3θ3², evaluated at (1,-1,2). The objective is thirteen and its exact gradient is (-2,-4,12). For independent random signs Δ, the symmetric directional quotient [F(θ+cΔ)-F(θ-cΔ)]/(2c) equals ∇F·Δ exactly, because the quadratic terms cancel. The SPSA component estimate multiplies this quotient by Δi, since Δi^{-1}=Δi.
Overall reversal of all signs gives the same gradient estimate, so four representative directions suffice to display every possibility. For Δ=(1,1,1), the estimate is (6,6,6). For (1,1,-1), it is (-18,-18,18). For (1,-1,1), it is (14,-14,14). For (1,-1,-1), it is (-10,10,10). Their equal-weight average is exactly (-2,-4,12), but each individual estimate can be far from that gradient.
The component variances over these directions are 160,148,20. The off-diagonal covariances are 8,-24,-48 for pairs 12,13,23. These values arise with perfectly exact objective evaluations, so they are not quantum shot noise. They quantify the cross-coordinate contamination introduced by recovering a vector estimate from one random directional slope.
Deriving the direction-induced covariance
For a linearized objective with gradient g, the ith estimate is gi+Σj≠i gjΔjΔi. Independence and zero mean of the signs make the cross terms vanish in expectation. Squaring the error gives Var(ghat_i)=Σj≠i gj². For distinct i and j, the surviving cross product in the covariance is gi gj. Substituting g=(-2,-4,12) yields the exact matrix entries above.
Averaging M independent directions divides this covariance by M. Deliberately using a balanced finite set of directions can cancel it exactly for this quadratic example, but then more objective evaluations have been spent. The four displayed directions use eight evaluations, whereas coordinate-wise central differences use six and are also exact for a quadratic. The appeal of two evaluations per random update is a different resource tradeoff from exact recovery of this small gradient.
In higher dimensions, the typical parameter displacement has Euclidean length c√p when all p sign components are perturbed. Keeping c fixed while increasing dimension therefore changes the distance from the current point. Local smoothness assumptions and finite-displacement bias must be interpreted at that actual displacement, rather than assuming that a dimension-independent evaluation count means dimension-independent statistical behavior.
Adding objective noise and finite-perturbation bias
Suppose each perturbed objective estimate has independent variance σ². Their directional quotient has added variance σ²/(2c²). Conditional on one Δ, this noise is shared by all gradient components with signs Δi, producing a rank-one covariance contribution. Averaging over independent symmetric directions makes the off-diagonal expectation of that added contribution zero, while each component retains the same diagonal variance.
For c=0.05 and σ=0.02, the added variance per component is 0.08. In this particular quadratic, direction-induced variances are much larger. Increasing measurement precision alone would therefore leave the dominant single-direction uncertainty largely unchanged. In a different parameter region, or after averaging many directions, the balance could reverse. Both terms should be included when selecting a measurement budget.
Now add 0.1θ1³ to the objective. The exact first gradient component at the chosen point becomes -1.7. The symmetric quotient adds a cubic correction 0.1c²Δ1³ beyond the directional derivative. After the SPSA division and averaging, the first component has bias 0.1c², while the other mean components have no corresponding bias from this term. At c=0.1 the mean estimate is therefore (-1.699,-4,12), showing a concrete nonzero finite-perturbation bias.
Reducing c suppresses that bias quadratically but magnifies the objective-noise term inversely quadratically. A gain schedule controlling the parameter update is a different sequence from c. Convergence statements require joint conditions on both sequences, the objective, and the noise process; the exact finite examples here are not a convergence proof for arbitrary variational landscapes.
Quantum evaluation cost and classical alternatives
If F is a weighted sum of quantum expectations, one objective evaluation may itself require many measurement settings and shots. Two evaluations therefore means two complete objective estimates at displaced parameter vectors, not two physical shots. Reusing a common parameter seed does not make independent hardware measurement outcomes share the beneficial noise correlations that can sometimes be engineered in a classical Monte Carlo calculation.
An analytic simulator can often obtain gradients through reverse differentiation, while an appropriate gate spectrum permits parameter-shift evaluations. Coordinate finite differences and derivative-free classical optimizers are other baselines. Their evaluation counts should be compared at a matched uncertainty in the update or final objective, including the number of iterations and the cost of each circuit evaluation.
Sources
Verification scope
Recorded source check ·
The author’s institutional overview confirms that SPSA estimates the gradient from two objective evaluations that perturb all parameters together. The review used the overview for this method.
The finite quadratic examples are independent derivations and illustrate individual updates.