Every algorithm so far came with a guarantee: a proof that it succeeds and a count of what it costs. Phase estimation reads energies to precision \(\epsilon\) with about \(1/\epsilon\) coherent steps, product formulas and polynomials build \(e^{-iHt}\) with bounded error, and slow evolution prepares ground states when the gap is large.
Each guarantee came with long, precise, coherent circuits, and adiabatic evolution needed a gap that is rarely known. Suppose we accept a short circuit with adjustable angles, measure how good its output is, and let a classical optimizer turn the knobs. What can such a bargain deliver, and what can we still prove about it?
We set up the bargain on an example small enough to solve exactly: a short circuit fixes the family of states we can reach, and the quantity to minimize is an expectation value estimated from measurements, whose cost in shots we count. Optimizing it needs gradients, which shifted circuits supply exactly, and noise from sampling and hardware then disturbs every step, while for many circuits the gradients vanish as the system grows. With these limits in view, we examine the variational eigensolver and the quantum approximate optimization algorithm for what can be proved, what can only be tested, and what evidence would establish an advantage.
Here measurement served only between circuits; next it acts inside them.
What can be learned by repeatedly adjusting and measuring a small quantum circuit?
A variational algorithm is a heuristic: it can be useful, but only evidence of the right kind can show that it is.
Reading guide · preparation, aims, and assumptions
Understand variational algorithms as heuristics: parameterized circuits, measured objectives, classical optimization, and the evidence needed to judge their performance.
Before you begin
Use expectation values, Pauli decompositions and the 1-norm (Operator Embedding), measurement statistics (Quantum Algorithmic Thinking), and adiabatic evolution (Evolution Engineering).
What you should be able to do
Describe an ansatz and the trade-off between expressiveness and cost.
Estimate an energy from Pauli measurements and compute shot budgets with optimal allocation.
Derive and apply the parameter-shift rule.
Distinguish shot noise from hardware bias and explain barren plateaus.
State the variational principle and its overlap consequence, and the three gaps in a variational eigensolver result.
Compute a depth-1 QAOA example and explain the role of the mixer.
List the evidence required to support claims about heuristic quantum algorithms.
The example to follow
The two-qubit ansatz cos(θ/2)|00⟩ + sin(θ/2)|11⟩ minimizing E(θ) = −1 − sin θ for H = −ZZ − XX, and depth-1 QAOA on a single edge with expected cut ½ + ½ sin 4β sin γ.
Scope and assumptions
Calculations are noiseless unless stated. Variational methods carry no general performance guarantee; the stated QAOA approximation ratio is a cited result for a specific graph class.
10.1
Parameterized Circuits
What do we need before a classical optimizer can tune a quantum circuit? A family of states, given by a circuit with adjustable angles. A number that says how good each state is, which we must estimate from measurements. And a count of the measurements that estimate requires. A two-qubit example small enough to solve exactly shows all three before we rely on the method.
What is the cheapest family of states whose output we can tune? Take a parameterized circuit \(U(\theta)\): a fixed gate sequence in which some rotation angles \(\theta=(\theta_1,\ldots,\theta_m)\) are adjustable. Applied to a simple input, it produces a family of trial states \(\ket{\psi(\theta)}=U(\theta)\ket{0^n}\). The choice of circuit structure is called an ansatz, a German word for an educated guess about the form of the answer.
Here is the running example. Apply \(R_y(\theta)=e^{-i\theta Y/2}\) to the first of two qubits in \(\ket{00}\), then a CNOT:
At \(\theta=\pi/2\) this is the Bell state \(\frac{1}{\sqrt2}(\ket{00}+\ket{11})\). But the family contains only states with real, nonnegative-ratio amplitudes on \(\ket{00}\) and \(\ket{11}\). It cannot produce \(\ket{01}\), or \(\frac{1}{\sqrt2}(\ket{00}-\ket{11})\), or any state outside a one-dimensional curve in the space of two-qubit states.
\(R_y(\theta)=e^{-i\theta Y/2}\) followed by a CNOT prepares \(\cos\tfrac\theta2\ket{00}+\sin\tfrac\theta2\ket{11}\). Measure directly to estimate \(\langle ZZ\rangle\), or after \(H\) on both qubits to estimate \(\langle XX\rangle\).
The expressiveness of an ansatz is the set of states it can reach. A more expressive ansatz, with more gates and parameters, is more likely to contain a good answer, but it costs more to run, has more parameters to optimize, and, as we will find, can become harder to train. The ansatz is an assumption about where good answers lie. If that assumption is wrong, no optimizer can compensate. Physically motivated ansätze, built from the structure of the problem’s Hamiltonian, encode this assumption deliberately; hardware-efficient ansätze, built from whatever gates a device does well, make it implicitly.
Problems
Verify the trial state by applying \(R_y(\theta)\) and CNOT to \(\ket{00}\).
Show solutionHide solution
\(R_y(\theta)\ket0=\cos\frac\theta2\ket0+\sin\frac\theta2\ket1\), so the state is \((\cos\frac\theta2\ket0+\sin\frac\theta2\ket1)\ket0\). CNOT flips the second qubit on the \(\ket1\) branch: \(\cos\frac\theta2\ket{00}+\sin\frac\theta2\ket{11}\).
Which value of \(\theta\) gives \(\frac{1}{\sqrt2}(\ket{00}-\ket{11})\)? Is it in the family?
Show solutionHide solution
We need \(\cos\frac\theta2=\frac{1}{\sqrt2}\) and \(\sin\frac\theta2=-\frac{1}{\sqrt2}\), so \(\theta=-\pi/2\) (or \(3\pi/2\)). Yes: allowing all real \(\theta\), the family includes negative ratios. It still cannot produce complex ratios or \(\ket{01}\).
An ansatz on \(n\) qubits has \(m\) real parameters. Why can it not reach every \(n\)-qubit state if \(m<2^{n+1}-2\)?
Show solutionHide solution
A normalized \(n\)-qubit state, up to global phase, is described by \(2^{n+1}-2\) real numbers. A smooth map from \(m\) parameters covers at most an \(m\)-dimensional set, which has no volume in a space of higher dimension. So any ansatz with polynomially many parameters reaches only a tiny fraction of states; its usefulness depends on the answer lying in that fraction.
The quantum computer prepares the state and measures; the classical computer averages. For \(H=\sum_jh_jP_j\), each Pauli string is measured separately: rotate each qubit so its Pauli becomes \(Z\) (a measurement basis change: a Hadamard gate for \(X\), \(S^\dagger\) then a Hadamard gate for \(Y\)), measure in the computational basis, and multiply the outcomes \(\pm1\). The average of that product estimates the expectation value \(\langle P_j\rangle\).
Take \(H=-Z\otimes Z-X\otimes X\), whose ground state is the Bell state with energy \(-2\). In the trial state, \(Z\otimes Z\) gives \(+1\) on both \(\ket{00}\) and \(\ket{11}\), so \(\langle ZZ\rangle=1\). And \(X\otimes X\) swaps \(\ket{00}\leftrightarrow\ket{11}\), so \(\langle XX\rangle=2\cos\frac\theta2\sin\frac\theta2=\sin\theta\). Therefore
\[E(\theta)=-1-\sin\theta,\]
minimized at \(\theta=\pi/2\), where \(E=-2\): the trial family contains the exact ground state.
\(E(\theta)=\langle ZZ\rangle\cdot(-1)+\langle XX\rangle\cdot(-1)=-1-\sin\theta\) for \(H=-Z\otimes Z-X\otimes X\). The minimum \(-2\) at \(\theta=\pi/2\) is the exact ground energy, reached because the family contains the Bell state.
Pauli strings that commute qubit by qubit, such as \(Z_1Z_2\) and \(Z_1\), can be measured together from the same shots. Grouping terms this way reduces the number of distinct circuits. For molecules with thousands of terms, grouping and other measurement strategies change the cost by orders of magnitude.
Problems
Compute \(E(\theta)\) at \(\theta=0,\pi/2,\pi\).
Show solutionHide solution
\(-1,\ -2,\ -1\). At \(\theta=0\) and \(\pi\) the state is a product state (\(\ket{00}\) or \(\ket{11}\)) with \(\langle XX\rangle=0\).
Which measurement circuits estimate \(\langle Z_1Z_2\rangle\) and \(\langle X_1X_2\rangle\)? Can they share shots?
Show solutionHide solution
\(Z_1Z_2\): measure both qubits directly and multiply outcomes. \(X_1X_2\): apply a Hadamard gate to both, then measure and multiply. They need different bases on each qubit, so they cannot share shots in this simple scheme, even though \(Z_1Z_2\) and \(X_1X_2\) commute as operators. (A Bell-basis measurement could estimate both at once, at the cost of an entangling gate.)
Is \(E(\theta)\) ever below the true ground energy? Why not?
Show solutionHide solution
No. Expand the trial state in eigenstates of \(H\): \(E=\sum_k|c_k|^2E_k\ge E_0\sum_k|c_k|^2=E_0\). Any trial state’s energy is an upper bound on the ground energy, by the variational principle. A measured estimate can fall below it only through statistical or hardware error.
How many measurements does one energy estimate need? Each measurement of a Pauli string gives \(\pm1\), so its variance is \(1-\langle P\rangle^2\le1\). Averaging \(R\) independent shots gives an estimate with variance at most \(1/R\). This statistical uncertainty is shot noise. For a sum \(H=\sum_jh_jP_j\) estimated term by term with \(R_j\) shots for term \(j\),
so the variance is at least \((\sum_ja_j)^2/R\), with equality when \(a_j/\sqrt{R_j}\) is proportional to \(\sqrt{R_j}\), that is, \(R_j\propto|h_j|\sigma_j\). Then
with \(\lambda=\sum_j|h_j|\), the same 1-norm that set the cost of a linear-combination block encoding. To reach precision \(\epsilon\) in the energy takes about \(\lambda^2/\epsilon^2\) shots. This shot allocation rule is the measurement analogue of choosing PREPARE amplitudes proportional to \(\sqrt{|h_j|}\).
With optimal shot allocation \(R_j\propto|h_j|\sigma_j\), the variance is at most \(\lambda^2/R\), so precision \(\epsilon\) needs about \(\lambda^2/\epsilon^2\) shots per energy evaluation. An optimization needs many evaluations.
The \(1/\epsilon^2\) scaling is the price of measuring instead of using phase estimation, which reaches \(1/\epsilon\) with long coherent circuits. For molecules, energies are measured in the hartree, the natural energy unit of molecular calculations. There \(\lambda\) is typically tens to hundreds of hartree, while the target precision is about \(10^{-3}\) hartree, so \(\lambda/\epsilon\) is about \(10^4\) to \(5\times10^5\), and \(\lambda^2/\epsilon^2\) ranges from about \(10^{8}\) to \(2.5\times10^{11}\) shots per energy evaluation, and an optimization needs many evaluations. Measurement cost is often the bottleneck of variational methods.
Problems
For \(H=-ZZ-XX\), with 1000 shots on each term, bound the standard deviation of \(\hat E\).
Show solutionHide solution
Variance at most \(1/1000+1/1000=2\times10^{-3}\), so standard deviation at most about \(0.045\). At \(\theta=\pi/2\) both \(\sigma_j=0\) (the state is an eigenstate of both terms), so the actual variance there is zero.
A Hamiltonian has two terms with \(|h_1|=3\), \(|h_2|=1\), and \(\sigma_1=\sigma_2=1\). With \(R=4000\) shots, compare equal allocation with the optimal one.
Show solutionHide solution
Equal (\(2000\) each): variance \(9/2000+1/2000=5\times10^{-3}\). Optimal (\(R_j\propto|h_j|\): \(3000\) and \(1000\)): variance \(9/3000+1/1000=4\times10^{-3}\), which equals \((3+1)^2/4000\). A 20% reduction here; more for very unequal coefficients.
How many shots are needed to estimate an energy to \(\epsilon=10^{-3}\) for a Hamiltonian with \(\lambda=50\), by the bound above? How does phase estimation compare?
Show solutionHide solution
\(\lambda^2/\epsilon^2=2500/10^{-6}=2.5\times10^9\) shots. Phase estimation on a qubitized walk needs about \(\lambda/\epsilon=5\times10^4\) walk steps in one coherent run (repeated a few times), but each step is a full block encoding and the circuit must stay coherent throughout.
10.2
Optimization
With an objective that can be estimated, how should the classical side change the parameters? We first find that gradients can be measured exactly, up to shot noise, from two shifted circuits. Then we separate the two kinds of noise that disturb each step, one that more shots remove and one that they do not. Finally we ask whether the gradients are large enough to follow at all, and find that for many circuits they shrink exponentially with the number of qubits.
Gradient descent updates \(\theta\leftarrow\theta-\eta\,\partial E/\partial\theta\) with a step size \(\eta\). How do we get the derivative from measurements? Finite differences, \((E(\theta+h)-E(\theta-h))/2h\), are biased for finite \(h\) and amplify shot noise as \(h\to0\). There is something better.
Suppose \(\theta\) enters the circuit once, through a gate \(e^{-i\theta P/2}\) with \(P^2=I\) (any Pauli rotation). Then \(E(\theta)\) has the form \(a+b\cos\theta+c\sin\theta\): the gate contributes \(\cos\frac\theta2\) and \(\sin\frac\theta2\) to the amplitudes, and the expectation value is quadratic in those, hence a trigonometric polynomial of frequency one. For such a function, the parameter-shift rule holds exactly:
Check on our example: \[\frac12\big(-1-\sin(\theta+\frac\pi2)+1+\sin(\theta-\frac\pi2)\big)=\frac12(-\cos\theta-\cos\theta)=-\cos\theta\], which is the derivative of \(-1-\sin\theta\). The shifts are large, \(\pm\pi/2\), so the two evaluations differ by a quantity of order one and shot noise is not amplified.
For a single Pauli rotation, \(E(\theta)\) is a sinusoid, and \(\tfrac12[E(\theta+\pi/2)-E(\theta-\pi/2)]\) equals the derivative exactly. In the example, \(E=-1-\sin\theta\) (solid) and \(dE/d\theta=-\cos\theta\) (dashed).
Each parameter needs two circuit evaluations per gradient component, so a gradient of \(m\) parameters costs \(2m\) energy estimates, each with its own shot budget. If one parameter controls several gates, apply the rule to each occurrence separately and add the results (the chain rule); applying a single shift to the shared parameter would be wrong.
Problems
Use the parameter-shift rule at \(\theta=0\) for \(E=-1-\sin\theta\). Which way should \(\theta\) move?
Show solutionHide solution
\(E(\pi/2)=-2\), \(E(-\pi/2)=0\), so \(dE/d\theta=(-2-0)/2=-1\). The derivative is negative, so increasing \(\theta\) decreases \(E\): move toward \(\pi/2\).
Show that the rule is exact for \(E(\theta)=a+b\cos\theta+c\sin\theta\).
Show solutionHide solution
\(E(\theta\pm\pi/2)=a\mp b\sin\theta\pm c\cos\theta\). Half the difference is \(-b\sin\theta+c\cos\theta=E'(\theta)\).
A parameter appears in two gates, \(e^{-i\theta X_1/2}\) and \(e^{-i\theta X_2/2}\). Why does the simple rule fail, and what is the correct procedure?
Show solutionHide solution
\(E\) then contains frequencies up to two in \(\theta\) (terms like \(\cos2\theta\)), for which the two-point rule is not exact. Treat the gates as having separate parameters \(\theta_1,\theta_2\), apply the rule to each with the other fixed, and add: \[dE/d\theta=\partial E/\partial\theta_1+\partial E/\partial\theta_2\] evaluated at \(\theta_1=\theta_2=\theta\). That costs four evaluations.
A gradient estimated from finitely many shots is a random variable. Gradient descent with noisy gradients is stochastic optimization: on average it moves downhill, but each step jitters. Near a minimum, the true gradient becomes small and the noise dominates, so the optimizer wanders. A sensible stopping rule halts when the estimated improvement is smaller than its uncertainty, rather than chasing digits the measurements cannot resolve. Increasing shots as the optimization proceeds is a common compromise.
Hardware noise is different in kind. A device interacts with its surroundings, which can acquire which-path records of the computation, just as garbage did; this unwanted recording is called decoherence. It turns the prepared state into a mixture, and together with gate errors it biases the measured energy toward the energy of that mixture. More shots do not remove a bias. They only estimate the biased value more precisely. Error mitigation techniques, such as extrapolating results from deliberately amplified noise back to zero noise, reduce the bias at a cost in shots that grows rapidly with circuit size. They do not provide the guarantees of error correction.
Shot noise is statistical and averages away with more measurements; hardware noise biases the estimate and does not.
Short circuits are the reason variational methods were proposed for noisy devices: fewer gates means less accumulated error. But short circuits limit expressiveness, and the measurement overhead of energy estimation, multiplied by the number of optimizer iterations and gradient components, can be enormous. These pressures pull in opposite directions, and their balance is problem dependent.
Problems
A gradient component is estimated with standard deviation \(0.05\), and the optimizer uses step size \(\eta=0.1\). How much does the parameter jitter per step from noise alone?
Show solutionHide solution
About \(\eta\times0.05=0.005\) radians per step in standard deviation. Over many steps near the minimum, the parameter performs a random walk confined by the curvature of \(E\).
A noisy device reports \(E=-1.8\) at the optimum of our example, with standard error \(0.001\). The exact minimum is \(-2\). What does the discrepancy indicate?
Show solutionHide solution
A bias of \(0.2\), far larger than the statistical error: hardware noise has mixed the state. More shots would only confirm \(-1.8\) more precisely. Mitigation or a shorter circuit is needed, and the result should be reported as biased.
Why does a variational energy that is below the exact ground energy indicate an error, while one above it does not by itself indicate success?
Show solutionHide solution
The variational principle forbids energies below \(E_0\) for any physical state, so a lower estimate signals statistical fluctuation, bias, or a measurement mistake. An energy above \(E_0\) is always possible; without knowing \(E_0\), being low does not show that the state is close to the ground state, only that it is no worse than other trial states.
Are the gradients large enough to follow? For many ansätze, the landscape \(E(\theta)\) becomes extremely flat as the number of qubits grows. McClean, Boixo, Smelyanskiy, Babbush, and Neven (2018) showed that for sufficiently deep random circuits, the variance of any gradient component over random parameter choices decays exponentially in \(n\). At a random starting point, the gradient is then exponentially small with high probability, and estimating it to useful accuracy requires exponentially many shots. Such a landscape is a barren plateau.
The intuition is concentration of measure. In a space of dimension \(2^n\), a random state has nearly the same expectation value for any fixed observable, close to its average over all states. Circuits deep enough to scramble their input behave like random states, so the energy barely depends on the parameters.
A barren plateau makes gradients exponentially small in the number of qubits, so estimating them needs exponentially many shots. Avoiding one is necessary for training but does not guarantee success.
Barren plateaus also arise from global cost functions (measuring all qubits at once), from too much entanglement with unmeasured qubits, and from hardware noise, which flattens landscapes even for shallow circuits. Remedies include problem-inspired ansätze, local cost functions, careful initialization near a known good state, and layer-by-layer training. Trainability, whether the optimum can be found with reasonable resources, is a separate property from expressiveness, whether the optimum is in the family at all. A recent line of work (Cerezo et al., 2023) also suggests that ansätze provably free of barren plateaus often have landscapes that can be estimated efficiently classically, which raises the question of whether they offer any quantum advantage.
Problems
If gradient components have standard deviation \(2^{-n/2}\) across the landscape, how many shots are needed to resolve one at \(n=40\)?
Show solutionHide solution
The gradient is about \(2^{-20}\approx10^{-6}\). Shot noise falls as \(1/\sqrt R\), so resolving it needs \(R\gtrsim10^{12}\) shots per component, impractical.
Our two-qubit example has gradient \(-\cos\theta\). Why does it not suffer a barren plateau?
Show solutionHide solution
It has one parameter, two qubits, and a circuit far too shallow to approximate a random state. Its landscape has gradients of order one. Barren plateaus are an effect of scale: many qubits and sufficiently random, deep, or noisy circuits.
Initializing parameters so the circuit is close to the identity avoids a barren plateau at the start. Does it guarantee finding the global minimum?
Show solutionHide solution
No. It gives non-vanishing gradients near the starting point, but the landscape can still have many local minima, and the path to the global minimum may cross flat regions. Trainability at initialization is necessary, not sufficient, for success.
10.3
Variational Algorithms
Two variational algorithms dominate the literature: the variational eigensolver for ground states and the quantum approximate optimization algorithm for combinatorial problems. What can actually be proved about them? For the eigensolver, the variational principle gives a one-sided guarantee on the energy. For the optimization algorithm, small cases can be computed exactly and a few bounds are known. Beyond that, claims rest on evidence, so we ask what kind of evidence would establish an advantage.
What does minimizing the energy guarantee? The variational principle answers this. For any normalized state \(\ket\psi=\sum_kc_k\ket{E_k}\) expanded in eigenstates of \(H\),
\[\bra\psi H\ket\psi=\sum_k|c_k|^2E_k\ge E_0,\]
with equality exactly when \(\ket\psi\) is a ground state. So minimizing the energy over a family of trial states gives an upper bound on the ground energy, and the minimizer is the family’s best approximation in energy.
The variational quantum eigensolver (Peruzzo et al., 2014) combines a parameterized circuit, term-by-term energy measurement, and a classical optimizer. In our example the family contains the exact ground state and the optimizer finds it. In general three gaps separate the answer from the truth: the expressiveness gap (the best state in the family has energy above \(E_0\)), the optimization gap (the optimizer finds a local minimum or stops early), and the estimation gap (shot noise and hardware bias in the reported energy).
The quantum computer prepares trial states and measures Pauli groups; the classical computer estimates \(E(\theta)\) and its gradient and chooses new parameters. The loop repeats until improvements fall below their statistical uncertainty.
The variational principle bounds the energy, not the state. How close must the state be? Let \(\Delta\) be the energy gap. Every excited energy is at least \(E_0+\Delta\), so
An energy error \(\delta\) therefore implies a squared overlap with the ground state of at least \(|c_0|^2\ge1-\delta/\Delta\). A trial state with energy close to \(E_0\) can still be far from the ground state if the gap is small. Properties other than energy computed from a variational state inherit this uncertainty.
Problems
A trial state has \(|c_0|^2=0.9\) and \(|c_1|^2=0.1\) on the ground and first excited states, with \(E_0=-2\), \(E_1=0\). What is its energy?
Show solutionHide solution
\(0.9(-2)+0.1(0)=-1.8\), an upper bound on \(E_0=-2\), with energy error \(0.2\).
Prove the overlap bound: if \(\bra\psi H\ket\psi\le E_0+\delta\) and all excited energies are at least \(E_0+\Delta\), then \(|c_0|^2\ge1-\delta/\Delta\).
Show solutionHide solution
\[\bra\psi H\ket\psi-E_0=\sum_{k\ge1}|c_k|^2(E_k-E_0)\ge\Delta(1-|c_0|^2)\]. So \(\Delta(1-|c_0|^2)\le\delta\), i.e. \(|c_0|^2\ge1-\delta/\Delta\).
Why can the variational eigensolver not, by itself, certify that it has found the ground state?
Show solutionHide solution
It produces an upper bound on \(E_0\) but no lower bound. Without an independent lower bound (from theory, a classical method, or a quantum algorithm with guarantees such as phase estimation), one cannot tell whether a lower energy exists outside the trial family or beyond the optimizer’s reach.
10.3.2 The quantum approximate optimization algorithm§
Can a short alternating circuit approximate slow evolution for optimization? For a combinatorial problem with cost \(C(x)\) on bit strings, the quantum approximate optimization algorithm (QAOA, Farhi, Goldstone, and Gutmann, 2014) prepares
with \(2p\) parameters, and measures to sample bit strings. The cost layer \(e^{-i\gamma C}\) is diagonal: it only changes phases, so by itself it cannot change any measurement probability. The mixer \(e^{-i\beta B}\) does not commute with \(C\), and it converts phase differences into probability differences, the same partnership of phase and interference that drove every algorithm since Deutsch’s circuit. As \(p\to\infty\), suitable parameters approximate adiabatic evolution by a product formula, so QAOA can do at least as well as the adiabatic algorithm in that limit.
Take MaxCut on one edge: \(C=\frac12(I-Z_1Z_2)\), which is \(1\) when the bits differ. What does one layer achieve? The cost layer gives phase \(1\) to \(\ket{00},\ket{11}\) and \(w=e^{-i\gamma}\) to \(\ket{01},\ket{10}\):
The expected cut is \(F=\tfrac12-\tfrac12\langle Z_1Z_2\rangle\) after the mixer. Rather than evolve the state, move the mixer onto the observable. Since \(ZX=-XZ\), \(e^{i\beta X}Ze^{-i\beta X}=Ze^{-2i\beta X}=\cos2\beta\,Z+\sin2\beta\,Y\), using \(ZX=iY\). So after the mixer \(Z_1Z_2\) becomes \((\cos2\beta\,Z_1+\sin2\beta\,Y_1)(\cos2\beta\,Z_2+\sin2\beta\,Y_2)\), evaluated in the state above. There \(\langle Z_1Z_2\rangle=0\), since half the weight has each sign, and \(\langle Y_1Y_2\rangle=0\) likewise. The cross terms do not vanish: applying \(Z_1Y_2\) and taking the overlap gives \(\langle Z_1Y_2\rangle=\tfrac i2(w^*-w)=-\sin\gamma\), and \(\langle Y_1Z_2\rangle=-\sin\gamma\) by symmetry. Hence \(\langle Z_1Z_2\rangle=-2\sin2\beta\cos2\beta\sin\gamma=-\sin4\beta\sin\gamma\), and the expected cut is
which equals \(1\) at \(\gamma=\pi/2\), \(\beta=\pi/8\): one layer finds the cut with certainty.
Expected cut \(F(\gamma,\beta)=\tfrac12+\tfrac12\sin(4\beta)\sin\gamma\). Varying \(\beta\) at \(\gamma=\pi/2\) (solid) and varying \(\gamma\) at \(\beta=\pi/8\) (dashed); both reach 1 at \(\gamma=\pi/2\), \(\beta=\pi/8\). Other parameters can also minimize the cut.
For larger graphs, what is proved is modest. On 3-regular graphs, depth-1 QAOA guarantees a cut at least \(0.6924\) times the maximum (Farhi, Goldstone, and Gutmann, 2014), below the classical guarantee of about \(0.878\) of Goemans and Williamson (1995). At higher depth, performance improves, but proven guarantees are few, and the parameters must be optimized for each instance or transferred from similar ones. Optimizing the expected cost and producing a single high-quality string are related but different goals: the distribution of samples matters, and the best of many samples is what a user keeps.
Problems
Show that \(e^{-i\gamma C}\) alone leaves the uniform distribution unchanged.
Show solutionHide solution
\(e^{-i\gamma C}\) is diagonal, multiplying each \(\ket x\) by \(e^{-i\gamma C(x)}\). Every amplitude keeps magnitude \(2^{-n/2}\), so every probability stays \(2^{-n}\).
Evaluate \(F(\gamma,\beta)\) at \(\gamma=\pi/2\), \(\beta=\pi/8\) and at \(\gamma=\pi/2\), \(\beta=3\pi/8\). Interpret the second.
Show solutionHide solution
\(F=\frac12+\frac12\sin(\pi/2)\cdot1=1\). At \(\beta=3\pi/8\), \(\sin(3\pi/2)=-1\), so \(F=0\): the algorithm deterministically produces an uncut assignment. Parameters matter: the same circuit can maximize or minimize the cost.
Why does a high expected cost not guarantee that the best sampled string is optimal?
Show solutionHide solution
The expected cost averages over the output distribution; a distribution concentrated on near-optimal strings can have high expectation while rarely producing the optimum. Conversely, a distribution with modest expectation can occasionally produce the optimum. Users keep the best of several samples, so the probability of sampling an optimal or near-optimal string is the relevant figure, and it should be reported alongside the expectation.
If there is no proof, what would convince us? Variational algorithms are heuristics: procedures that may work well in practice without a proof that they do. Heuristics are valuable. Most of classical optimization runs on them. But claims about them must rest on evidence, and the evidence must be of the right kind.
Variational algorithms are heuristics. Different claims need different kinds of evidence; small successful instances support only the weakest.
Good benchmarking compares against the best classical methods for the same instances, including tuned heuristics and specialized solvers, not a convenient baseline. It reports how performance scales with problem size, since a fixed-size advantage can be overtaken. It counts total resources: shots, optimizer iterations, calibration, and classical preprocessing, and reports time-to-solution or cost at matched solution quality. It uses instance families not chosen to favour the method. And it states what was simulated, what was run on hardware, and what was extrapolated.
Two further cautions. Shallow circuits on restricted geometries can sometimes be simulated classically, for example with tensor networks, which store weakly entangled states compactly, so small instances showing good quantum results do not show a quantum advantage. And the absence of proven guarantees means that negative results matter as much as positive ones. Variational methods have taught much about devices and problems; whether they offer an asymptotic advantage for any practical task is an open question.
Throughout, measurement has served as the last step, or as feedback to a classical optimizer between circuits. Could an outcome obtained in the middle of a circuit steer the rest of it?
Problems
A study reports that QAOA at depth 3 beat a greedy classical algorithm on 20-node graphs. List three things missing before concluding an advantage.
Show solutionHide solution
Comparison against strong classical solvers (Goemans–Williamson, simulated annealing, exact solvers, which handle 20 nodes instantly); scaling with graph size; and total resource accounting including parameter optimization and shots. Also whether the quantum results came from hardware or noiseless simulation.
Why can classical simulation of the variational circuit be part of good benchmarking, rather than a threat to it?
Show solutionHide solution
Simulating small instances exactly reveals the expressiveness and optimization gaps separately from hardware noise, and identifies the classical cost of reproducing the quantum result. If the circuits are classically simulable at the sizes studied, any claimed advantage at those sizes is ruled out, which is exactly what a careful benchmark should establish.
“The variational method found the exact ground state of a 4-qubit Hamiltonian.” What does this demonstrate, and what does it not?
Show solutionHide solution
It demonstrates that the ansatz contains a good state for this instance and that the optimizer and measurement pipeline work at this size. It does not show scaling, since a 4-qubit Hamiltonian is diagonalized classically in microseconds, nor that the method will succeed on larger instances where expressiveness, trainability, and measurement cost all worsen.
Summary
Variational algorithms pair a shallow parameterized quantum circuit \(U(\boldsymbol{\theta})\) with a classical optimizer that minimizes a measured expectation value \(E(\boldsymbol{\theta}) = \langle\psi(\boldsymbol{\theta})|H|\psi(\boldsymbol{\theta})\rangle\).
The parameter-shift rule evaluates exact analytic gradients on hardware by running the same circuit at shifted angles \(\theta_k \pm \pi/2\), while shot noise requires explicit measurement-budget allocation.
Expressibility and trainability stand in tension: unstructured deep ansätze suffer from barren plateaus where gradient variances decay exponentially with qubit count.
Questions and worked problems
Attempt each question before opening a hint. Explain your reasoning, then compare it with the solution.
For the ansatz cos(θ/2)|00⟩ + sin(θ/2)|11⟩, compute ⟨Z₁⟩ and ⟨Z₁Z₂⟩ as functions of θ.
Hint 1
Z₁ gives +1 on |00⟩ and −1 on |11⟩.
Hint 2
Z₁Z₂ gives +1 on both.
Worked solution
⟨Z₁⟩ = cos²(θ/2) − sin²(θ/2) = cos θ, and ⟨Z₁Z₂⟩ = 1 for every θ. So a Hamiltonian H = −Z₁ would have E(θ) = −cos θ, minimized at θ = 0 (the state |00⟩).
In the running example at \(\theta=\pi/6\), \(\langle X_1X_2\rangle=\sin\theta=\frac12\). Find the variance of one \(\pm1\) shot of \(X_1X_2\) and the standard deviation of the average of \(1000\) shots. Why does \(\langle Z_1Z_2\rangle\) need no shots at all for this ansatz?
Hint 1
A \(\pm1\) outcome with mean \(\mu\) has variance \(1-\mu^2\).
Hint 2
Every state in the family is supported on \(\ket{00}\) and \(\ket{11}\).
Worked solution
The single-shot variance is \(1-\frac14=\frac34\), so \(1000\) shots give standard deviation \(\sqrt{0.75/1000}\approx0.027\). Every trial state is a combination of \(\ket{00}\) and \(\ket{11}\), both with \(Z_1Z_2=+1\), so every shot returns \(+1\). The variance is \(0\) and \(\langle Z_1Z_2\rangle=1\) is known exactly. Variances depend on the state, which is why the optimal shot allocation \(R_j\propto|h_j|\sigma_j\) can save far more than the worst-case bound \(\lambda^2/\epsilon^2\) suggests.
For depth-1 QAOA on a single edge, set \(\gamma=\pi\). Compute the state after the cost layer, starting from \(\ket{++}\), and explain why no mixer angle \(\beta\) can then improve the expected cut beyond \(\frac12\). Compare with the formula \(F=\frac12+\frac12\sin4\beta\sin\gamma\).
Hint 1
\(C\) is \(1\) on \(01\) and \(10\), so \(e^{-i\pi C}\) multiplies those components by \(-1\).
After the cost layer the state is \(\frac12(\ket{00}-\ket{01}-\ket{10}+\ket{11})=\ket-\ket-\). That is an eigenstate of \(X_1+X_2\) (eigenvalue \(-2\)), so the mixer only multiplies it by a global phase. The measured distribution stays uniform, with expected cut \(\frac12\) for every \(\beta\). The formula agrees: \(\sin\pi=0\). The cost phases \(e^{-i\gamma C}\) must create relative phases that the mixer can turn into probability differences; at \(\gamma=\pi\) the phases form a pattern the mixer cannot use.
Add a field to the example: \(H=-Z_1Z_2-X_1X_2+0.5\,Z_1\). (a) Show that for the ansatz \(\cos\frac\theta2\ket{00}+\sin\frac\theta2\ket{11}\), \(E(\theta)=-1-\sin\theta+0.5\cos\theta\). (b) Find the minimum and its location. (c) Show that \(H\) maps the span of \(\ket{00},\ket{11}\) to itself and find its lowest eigenvalue there. Does the ansatz contain the ground state?
Write \(\sin\theta-0.5\cos\theta=\sqrt{1.25}\,\sin(\theta-\varphi)\) with \(\tan\varphi=0.5\).
Worked solution
(a) As before \(\langle Z_1Z_2\rangle=1\) and \(\langle X_1X_2\rangle=\sin\theta\), and \(\langle Z_1\rangle=\cos\theta\), giving \(E=-1-\sin\theta+0.5\cos\theta\). (b) \(E=-1-\sqrt{1.25}\sin(\theta-\varphi)\) with \(\varphi=\arctan0.5\approx0.464\). The minimum is \(-1-\sqrt{1.25}\approx-2.118\) at \(\theta=\pi/2+\varphi\approx2.03\). (c) Each term maps \(\ket{00}\) and \(\ket{11}\) into their span. In the basis \((\ket{00},\ket{11})\), \(H=\begin{pmatrix}-0.5&-1\\-1&-1.5\end{pmatrix}\), with eigenvalues \(-1\pm\sqrt{1.25}\). The odd sector \(\{\ket{01},\ket{10}\}\) has eigenvalues \(1\pm\sqrt{1.25}\), the lowest being \(-0.118\). So the true ground energy is \(-2.118\), and the ansatz attains it. It succeeds because it covers every real state in the symmetry sector that contains the ground state. Without that structure, the family could easily miss the ground state.
A variational run reports energy \(-1.95\) for a Hamiltonian with \(E_0=-2\). (a) If every excited energy is at least \(0\) (gap \(\Delta=2\)), bound the ground-state overlap \(|c_0|^2\). (b) Repeat for a gap \(\Delta=0.1\). (c) An observable \(O\) with \(\|O\|\le1\) is computed from the variational state. Using \(|c_0|^2\), roughly how far can its value be from the ground-state value in each case?
Hint 1
\(|c_0|^2\ge1-\delta/\Delta\) with \(\delta=0.05\).
Hint 2
A state with overlap \(|c_0|^2\) has trace distance about \(\sqrt{1-|c_0|^2}\) from the ground state.
Worked solution
(a) \(|c_0|^2\ge1-0.05/2=0.975\). (b) \(|c_0|^2\ge1-0.05/0.1=0.5\), so up to half the weight may lie on excited states. (c) For a pure state, the distance from the ground state is \(\sqrt{1-|c_0|^2}\). This is at most about \(0.16\) in case (a) and up to about \(0.71\) in case (b), and expectation values of \(O\) can be off by twice that. The same energy error means very different things depending on the gap. A small gap makes energy a poor certificate of the state, so a reported variational energy does not validate other computed properties unless a gap bound is known.
Verify the depth-1 QAOA formula for one edge at \(\gamma=\pi/2\) by working in the two-dimensional space spanned by \(\ket{\Phi^+}=\frac{1}{\sqrt2}(\ket{00}+\ket{11})\) and \(\ket{\Psi^+}=\frac{1}{\sqrt2}(\ket{01}+\ket{10})\). (a) Write the state after the cost layer in this basis. (b) Show that \(B=X_1+X_2\) acts as \(2\sigma_x\) there. (c) Compute the probability of an uncut outcome and the expected cut as a function of \(\beta\).
Hint 1
\(e^{-i\pi C/2}\) multiplies \(\ket{01},\ket{10}\) by \(-i\).
(a) \(\ket{++}=\frac{1}{\sqrt2}(\ket{\Phi^+}+\ket{\Psi^+})\); after the cost layer it is \(\frac{1}{\sqrt2}(\ket{\Phi^+}-i\ket{\Psi^+})\). (b) \(X_1+X_2\) sends \(\ket{00}+\ket{11}\) to \(2(\ket{01}+\ket{10})\), so \(B\ket{\Phi^+}=2\ket{\Psi^+}\) and \(B\ket{\Psi^+}=2\ket{\Phi^+}\). (c) Applying \(\cos2\beta\,I-i\sin2\beta\,\sigma_x\) gives the \(\ket{\Phi^+}\) amplitude \(\frac{1}{\sqrt2}(\cos2\beta-\sin2\beta)\). The uncut probability is \(\frac12(\cos2\beta-\sin2\beta)^2=\frac12(1-\sin4\beta)\), so the expected cut is \(F=\frac12(1+\sin4\beta)\), matching the formula with \(\sin\gamma=1\). At \(\beta=\pi/8\) the uncut amplitude vanishes and \(F=1\). The symmetry of the problem reduced a four-dimensional calculation to a rotation in a plane.
An optimizer for \(E(\theta)=-1-\sin\theta\) starts at \(\theta_0=3\pi/2\), computes an exact gradient of zero, and stops, reporting convergence. What has it found? What would happen with shot noise, and what does this say about using a zero gradient as a certificate?
Hint 1
\(dE/d\theta=-\cos\theta\) vanishes at both \(\pi/2\) and \(3\pi/2\).
Hint 2
Evaluate \(E\) at both points.
Worked solution
\(E(3\pi/2)=-1+1=0\), the maximum of the landscape, not the minimum \(-2\) at \(\theta=\pi/2\). The gradient vanishes at every stationary point: minima, maxima, and saddles. With shot noise the estimated gradient would be slightly nonzero, and the optimizer would drift away from this unstable point, so noise happens to help here. In larger landscapes, local minima are stable and noise does not rescue the run. A small gradient shows only that the optimizer has stopped moving. It says nothing about global optimality, and in a barren plateau it may simply reflect a landscape too flat to measure.
A Hamiltonian has λ = 20, and each optimizer iteration estimates the energy and a 50-component gradient by parameter shift, each energy to precision 10⁻². Estimate the shots per iteration, and comment on 500 iterations.
Hint 1
Each energy estimate needs about λ²/ε² shots.
Hint 2
A gradient by parameter shift needs 2 × 50 energy estimates (with the same precision per component as a rough guide).
Worked solution
One energy: 400/10⁻⁴ = 4 × 10⁶ shots. Gradient: 100 energies, 4 × 10⁸ shots. Per iteration about 4 × 10⁸ shots; 500 iterations need about 2 × 10¹¹ shots. At 10⁴ shots per second that is about 230 days, illustrating why measurement cost dominates variational methods and why shot-frugal optimizers and measurement grouping matter.
For \(H=-Z_1Z_2-X_1X_2\) at \(\theta=\pi/3\), use the optimal allocation \(R_j\propto|h_j|\sigma_j\). (a) Compute \(\sigma_1,\sigma_2\) and the shots needed for standard error \(10^{-3}\) in the energy. (b) Compare with the worst-case estimate \(\lambda^2/\epsilon^2\). (c) The allocation uses the very expectation values being estimated. Propose a practical procedure, and say what it costs.
Hint 1
\(\langle Z_1Z_2\rangle=1\) and \(\langle X_1X_2\rangle=\sin(\pi/3)\approx0.866\).
Hint 2
With optimal allocation, \(\mathrm{Var}=(\sum_j|h_j|\sigma_j)^2/R\).
Worked solution
(a) \(\sigma_1=\sqrt{1-1}=0\) and \(\sigma_2=\sqrt{1-0.75}=0.5\). The optimal allocation gives all shots to \(X_1X_2\), and \(\mathrm{Var}=(0.5)^2/R\). Standard error \(10^{-3}\) needs \(R=0.25/10^{-6}=2.5\times10^5\) shots. (b) The worst case \(\lambda^2/\epsilon^2=4/10^{-6}=4\times10^6\) is sixteen times larger. (c) Spend a small pilot budget on every term to estimate each \(\sigma_j\), then allocate the remaining shots proportionally to \(|h_j|\hat\sigma_j\), keeping a minimum for every term in case a pilot estimate was misleading. The pilot costs a modest fraction of the total. Since \(\sigma_j\) changes slowly as \(\theta\) moves during optimization, earlier estimates can be reused.
Where this leads. the Adaptive Measurement chapter brings measurement inside the computation: mid-circuit outcomes control later operations, trade coherent resources for classical feedback, and drive measurement-based computation.