SPSA trail (fades with age) Global minimum Current position
Drag to pan · Scroll to zoom

SPSA Optimizer: 2D Cost-Landscape Map

Real quantum computers never hand a variational algorithm an exact gradient — every circuit run is a noisy, finite-shot measurement. This simulator renders a rugged two-parameter cost landscape (as you'd get from a small VQE or QAOA ansatz) as a top-down 2D heatmap, then runs the Simultaneous Perturbation Stochastic Approximation algorithm on it: SPSA perturbs both parameters at once along a single random direction and needs only two noisy circuit evaluations per step, regardless of how many parameters the ansatz has. Dial up the shot noise to see the trail wobble and stall, tune the step-size and perturbation gain sequences to see it recover, reshuffle the landscape's ruggedness to watch the optimizer either find the gold global minimum or get trapped near a shallower local one, and drag/scroll the map to zoom in on exactly how the walk unfolded.