Cost-Function and Measurement Estimation in Variational Algorithms
A variational quantum algorithm asks the processor to do one arithmetic task over and over: prepare a trial state and report a single number, the energy . But a quantum computer cannot read that number off a dial. It can only collapse a state and hand back a bitstring. Everything that stands between "prepare " and "here is its energy to chemical accuracy" is the subject of this article — the theory and engineering of converting projective measurements into an accurate estimate of a cost function and its gradient with the fewest possible circuit executions. This deep-tier article owns the measurement layer its siblings borrow. It takes the parameterized-circuit machinery from aq-qci-parameterized-quantum-circuits-ansatze, supplies the cost-and-shot apparatus that aq-qci-variational-quantum-eigensolver and aq-qci-quantum-approximate-optimization-algorithm call upon, and feeds the gradient estimators of aq-qci-parameter-shift-rules-gradients. Three ideas organize everything. First, the Pauli decomposition turns "measure an energy" into "average many readings," so the currency is not gate depth but the number of shots. Second, because the outcomes are bounded random variables, their variance — not the term count — sets the budget, and reaching precision costs of order measurements. Third, the two levers that fight that cost are operator grouping (measuring commuting Paulis together) and optimal shot allocation (spending where coefficient-times-uncertainty is largest). Master them and the estimator variance falls toward an irreducible floor; ignore them and even a two-qubit molecule demands a million shots per energy.
- A variational cost is the expectation value of a Pauli-decomposed observable, ; each must be estimated from finitely many measurement shots.
- One reading has variance , so the sample mean's error falls only as , and hitting additive precision needs shots.
- Under a fixed budget the variance-minimizing split is , giving an irreducible floor — the weighted norm squared over the budget.
- Commuting Paulis share an eigenbasis and are measured together: qubit-wise commuting groups need only single-qubit rotations, while general commuting groups need a Clifford diagonalization.
- The right figure of merit for a shared measurement is the quantum variance of the group's partial Hamiltonian , not the naive sum of term variances.
- The same estimator feeds parameter-shift gradients; when the landscape is a barren plateau the gradient shrinks like and the shot cost explodes as , a wall no grouping trick can breach.
- Key idea: the wall-clock cost of a variational algorithm is governed not by circuit depth but by the variance of the shot estimator, at best; grouping commuting Paulis and allocating shots optimally squeezes this variance toward its floor.
The wall-clock cost of a variational algorithm is governed not by circuit depth but by the variance of the shot estimator: at best . Grouping commuting Paulis and allocating shots by pushes this variance toward an irreducible floor.
Where this lives today
Measurement estimation is the live bottleneck of the noisy intermediate-scale quantum (NISQ) era, the frontier where variational algorithms are made or broken. Every major software stack — Qiskit Nature, PennyLane, OpenFermion — ships the grouping machinery of this article as a primitive: qubit-wise cliques found by graph coloring, general commuting cliques diagonalized by Clifford circuits, and weighted shot allocation. On top of these sit newer estimators: classical shadows and their derandomized variants predict many observables from randomized measurements with logarithmic sample complexity, now standard for energies, fidelities, and entropies; low-rank and double-factorization decompositions reorganize the molecular terms into a handful of measurable fragments, cutting the shot-budget constant by orders of magnitude. These were essential to real experiments — Google's 2020 Hartree–Fock demonstration on twelve Sycamore qubits and IBM's hardware-efficient VQE runs on LiH and BeH₂ leaned on grouping and heavy error mitigation to survive. The open problem is quantitative: chemical accuracy beyond classical reach still implies shot counts current devices cannot deliver in reasonable wall-clock time, which is why measurement-estimation research is as central to quantum advantage as the qubits themselves.
The physical picture
Think of the Hamiltonian as a shopping list of Pauli observables, each with a price . You can only buy an estimate one coin-flip at a time — every measurement returns — and pinning one item's expectation to accuracy takes about flips. Measurement estimation is the discipline of bundling items you can buy together (commuting Paulis, which share an eigenbasis) and spending your finite shot budget where the price-times-uncertainty is highest. The first figure follows one energy through that pipeline: decompose, group, sample, sum.
Commutation is the geometry behind the bundling. Two observables commute if and only if they share an eigenbasis, so one measurement reveals both eigenvalues at once. Qubit-wise commuting strings such as and share a product basis — you only relabel single-qubit axes, essentially free. Generally commuting strings such as and share an entangled basis (here the Bell basis), so a Clifford circuit runs before measuring: you pay in two-qubit gates but harvest several terms from one setting. Yet grouping is only half the story — the variance, not the number of settings, is the true cost. A diagonal QAOA Hamiltonian needs a single basis yet still demands many shots because its cost-function variance can be large; a chemistry Hamiltonian with millions of terms may have modest variance if its coefficients are small. The second figure shows the quantity that decides feasibility: how the error shrinks with shot count, and exactly how many measurements chemical accuracy costs for a real molecule.
The core equations
The cost is linear in , and expands in the Pauli basis — the natural operator alphabet of qubits. So the energy is a weighted sum of Pauli averages, each readable directly on hardware. This one line is where the labor splits: the device supplies each , the classical computer supplies the coefficients and the sum.
where: — the variational cost to be minimized; — ansatz state from a parameterized circuit; — Hamiltonian as a real-weighted sum of Pauli strings; — coefficient (real because ); — tensor product of , a Hermitian unitary with . Read it as a division of labor: measure the parts, combine them classically. Each is estimated the only way hardware allows — rotate into the Pauli's eigenbasis, sample, and average the eigenvalues. Because the eigenvalues are exactly , which fixes both unbiasedness and variance at once.
where: — empirical estimate of ; — shots allocated to term ; — the eigenvalue measured on shot ; — the single-shot variance, maximal () when and zero when the state is a eigenstate. The per-shot variance is bounded by unity because the outcomes are. Averaging independent shots divides the single-shot variance by , and summing coefficient-weighted term estimates adds their variances. This is the master cost formula: the total variance is a coefficient-weighted sum of per-term variances, each inversely proportional to the shots spent on it.
where: — the full cost estimator; — standard deviation of term ; — shots per term, summing to the total budget . The formula assumes the terms are measured in independent shot pools; sharing shots within a commuting group replaces the term-by-term sum with a group variance (equation 5). Given a fixed budget, how should the shots be split? Minimizing equation (3) under by a Lagrange multiplier gives a clean weighted rule, and substituting it back yields the smallest variance any allocation can reach — the irreducible floor set by the weighted norm of the coefficients.
where: — variance-minimizing shots for term (or group) ; — the weighted norm, the single quantity that controls the shot budget. Uniform allocation is strictly worse; the optimum funds the terms with large coefficient and large uncertainty. The lever that beats term-by-term measurement is commutation. Two Pauli strings can be read from the same measurement record exactly when they commute, and the variance of that shared estimator is not the sum of the pieces but the full quantum variance of the group's partial Hamiltonian in the trial state.
where: — a group of mutually commuting Paulis; — the partial Hamiltonian of that group; — shots spent on the group's single measurement setting. Two strings commute iff they differ in an even number of anticommuting single-qubit factors; the covariances that sharing shots induces are already inside . For a worst-case guarantee independent of the state, treat each shot as a bounded draw of in with and apply Hoeffding's inequality — a distribution-free confidence bound with the same scaling.
where: — target additive error on ; — failure probability, ; — the (unweighted) norm bounding the range of . Because , the variance floor is never larger than , so equation (6) is the conservative sibling of equation (4). Finally, the same estimator supplies gradients. The parameter-shift rule (owned by aq-qci-parameter-shift-rules-gradients, recalled here) writes each partial derivative as a difference of two energies, so gradient descent is built entirely from cost evaluations already analyzed.
where: — a circuit parameter entering through a Pauli-rotation gate with ; — unit vector shifting only . Each shifted energy carries the full measurement cost of equation (4), so a -parameter gradient multiplies the shot budget by roughly .
The goal is to turn the loose intuition that an expectation value costs about measurements into a precise formula for the shot budget of a full Hamiltonian, and to discover how a fixed budget should be split among the Pauli terms so the energy's variance is as small as possible. We start from a single measurement, build the per-term and total estimator variances, minimize under the fixed-budget constraint by a Lagrange multiplier, and read off both the optimal allocation and the irreducible variance floor it achieves.
Step 1. A single measurement of in its eigenbasis returns with by the Born rule, and since the per-shot variance is . Averaging i.i.d. shots gives . Why: the bounded range is exactly what makes the single-shot variance at most one, so the whole cost analysis rests on counting shots rather than tracking amplitudes.
Step 2. By linearity , and independence of the separate shot pools makes the variances add, . Demanding a single term reach precision already forces — the law. Why: this exposes the fundamental scaling before any optimization, and shows the square-root standard error cannot be beaten by classical post-processing of projective data.
Step 3. To split a fixed budget optimally, minimize subject to with the Lagrangian . Stationarity gives . Why: at the optimum, moving one shot from any term to any other cannot lower the variance, which is precisely this term-by-term balance condition.
Step 4. Fix the multiplier from the budget: gives , and substituting back yields . Setting this equal to gives the total budget . Why: the minimal variance is the square of the weighted norm over the budget — the single compact statement of why many-term chemistry Hamiltonians are so expensive to measure. *Verified: reduces to the standard VQE shot estimate. Setting every so recovers the often-quoted worst case , consistent with Nielsen and Chuang §2.2. For H₂ with Ha and Ha, shots.*
Go deeper · Derivation B · 2 minSimultaneous measurement of a commuting group and its true variance
The goal is to prove that commuting Pauli operators can be read from the very same measurement record, to distinguish the cheap qubit-wise case from the general case that needs a Clifford circuit, and — most importantly — to identify the correct figure of merit for a shared measurement, which is not the naive sum of term variances but the full quantum variance of the group's partial Hamiltonian in the trial state. We construct the joint estimator, expose the covariances that sharing shots induces, and collapse them into that single group variance.
Step 1. For a qubit-wise commuting group, every member carries the same non-identity Pauli or identity on each qubit, so one setting diagonalizes them all: apply (Hadamard) where the group's Pauli is , where it is , nothing where it is or , then measure in the computational basis. Each bitstring yields every member's eigenvalue as a parity, . Why: because the members agree qubit-by-qubit, a product of single-qubit rotations suffices — no entangling gate — which is why qubit-wise grouping is nearly free.
Step 2. For a group that commutes only in general (for example and , which anticommute on each qubit yet commute as strings because two sign flips cancel), no product basis works; a Clifford circuit maps the whole group to diagonal form before measurement. The joint estimator has the same parity form but is read after that Clifford. Why: general commutation buys larger groups and fewer settings, paid for in two-qubit gate depth and its noise — the central grouping trade-off.
Step 3. Sharing one shot record correlates the term estimates: , and the product is itself a Pauli in the group's algebra. Why: this is exactly why you may not treat grouped estimates as independent — the covariances are real and can be sizeable.
Step 4. Assemble the group estimator and collect all variances and covariances; they sum to with . Why: the correct cost of a shared measurement is the genuine quantum variance of the partial Hamiltonian in , not the naive — a poor grouping can raise this and lose the amortization it seemed to buy. *Verified: consistent with the Pauli algebra in Nielsen and Chuang §4.2. Products of commuting strings stay in the shared eigenbasis, so the joint parity estimator is well-defined and unbiased; the covariance collapse reproduces the operator identity .*
Go deeper · Derivation C · 1 minWhy barren plateaus make the shot budget explode
The goal is to show why the machinery of grouping and optimal allocation cannot rescue a variational algorithm once its landscape flattens into a barren plateau, by tracing how an exponentially small gradient collides with the unavoidable shot-noise floor. We estimate the parameter-shift gradient's variance, demand the true gradient rise above that noise to be detectable, and insert the plateau's exponential scaling to expose a measurement cost that grows exponentially in qubit number and that no partitioning trick can remove. Take a landscape with and for qubits.
Step 1. The parameter-shift gradient is a difference of two sampled energies, so its estimator inherits an variance, . Why: gradients are built from the very cost estimators analyzed above, so they carry the same shot-noise floor and no better.
Step 2. To resolve the gradient's direction the true value must exceed the estimator's standard deviation, , i.e. the signal must beat the shot noise. Why: below this signal-to-noise threshold the measured gradient is indistinguishable from a random walk and the optimizer sees no downhill direction.
Step 3. Insert the plateau scaling: a typical gradient magnitude is , so forces (and resolving a relative error pushes it to ). Why: the exponentially small signal demands an exponentially large sample to lift it above the noise floor.
Step 4. Note what does not help: the floor comes from the physics of the landscape, not from how is partitioned, so grouping and optimal allocation — which only rescale the constant in front of — cannot touch the exponential. Why: this cleanly separates the measurement problem this article solves from the trainability problem owned by aq-qci-barren-plateaus, which must be attacked upstream by ansatz design. *Verified: reproduces the standard barren-plateau trainability obstruction. Exponential shot scaling follows directly from combined with the central-limit noise floor (McClean et al., 2018).*
Limiting cases
The shot cost changes character sharply across regimes; the table names the four that dominate practice.
| Case | Result | Meaning |
|---|---|---|
| Single Pauli, ideal | one observable; worst case needs shots, an eigenstate needs none | |
| Full Hamiltonian, weighted | optimal allocation; the weighted norm squared sets the budget, bounded above by | |
| Chemistry scaling | for an -spin-orbital electronic Hamiltonian; commuting-clique grouping removes one factor of in settings | |
| Barren plateau | gradient variance decaying as needs exponentially many shots; no grouping trick repairs it |
Worked examples
1 · A single Pauli expectation, fully worked
A trial state has for some Pauli string . How many shots estimate to a standard error , and how does this change in the worst case ?
Step 1. Compute the single-shot variance from the statistics. Since , the eigenvalues are and , so the single-shot standard deviation is .
Step 2. The sample mean of i.i.d. shots has variance , so demanding gives . Doubling the precision to would quadruple this to — the hallmark scaling.
Step 3. In the worst case the single-shot variance saturates at , so . Conversely, if the state were a eigenstate of then and a single shot suffices — the estimate is deterministic. The cost scales entirely with how uncertain the observable is in the state, not with the circuit that prepared it.
2 · Grouping and the shot budget of the hydrogen molecule
The two-qubit H₂ Hamiltonian (STO-3G, symmetry-tapered near equilibrium) is with , , , Ha. Find the naive shot budget for chemical accuracy, then group the terms and count measurement settings.
Step 1. Sum the magnitudes of the non-identity terms — the weighted norm that controls the budget (conservatively taking ): . The identity term only shifts the energy and carries no variance, so it needs no shots.
Step 2. Invert the variance floor at a standard error equal to chemical accuracy, Ha: for a single energy on this two-qubit problem. Fold in an optimization of iterations with parameter-shift gradients and the total climbs toward – shots — the measurement, not the qubit count, is the bottleneck.
Step 3. Now group by qubit-wise commutation. The three diagonal strings share the computational () basis — one setting; needs its own -basis setting; its own -basis setting. So five terms collapse to three measurement settings, each amortizing its shots across the terms it contains.
Step 4. Push to general commutation. Check that and commute: , and commutes with both. These three form a Bell-basis (stabilizer) group measurable with one Clifford setting, while stay diagonal (one setting), since anticommutes with and cannot join the Bell group. Result: 5 terms → 3 qubit-wise settings → 2 general-commuting settings, each grouping trading circuit count against Clifford depth and correlated variance.
Physics of the portrait
Measurement estimation is where a mid-century concentration bound and a twenty-first-century idea about learning quantum systems meet — and its most modern face belongs to the researcher who showed you can predict a great many properties of a state from astonishingly few measurements.
Origins · 1 minHsin-Yuan Huang and how this was discovered
Hsin-Yuan (Robert) Huang is a theorist of quantum information and learning, trained at Caltech and working across Caltech and Google Quantum AI, whose work reshaped how the field reads information out of a quantum computer. By the late 2010s the measurement problem this article formalizes — that a chemical-accuracy energy can cost of order a million shots — was recognized as the practical wall in front of variational algorithms. In 2020, with Richard Kueng and John Preskill, Huang introduced classical shadows: rather than measure each observable in its own basis, one measures the state in randomly chosen bases, stores a compact classical "shadow," and from it predicts arbitrary observables using only measurements, with rigorous variance guarantees. The construction descends from the statistical lineage this article uses — Wassily Hoeffding's 1963 concentration inequality for bounded variables, and Scott Aaronson's 2018 shadow tomography, which first asked how few copies of a state suffice to predict many properties. Huang's contribution was to make that promise practical and scalable, turning an information-theoretic possibility into an algorithm near-term hardware runs today, alongside the qubit-wise and general-commutation grouping systematized for chemistry in the same period.
Going further
Texts and reviews. Nielsen and Chuang, Quantum Computation and Quantum Information, §2.2 (measurement statistics) and §4.2 (Pauli operators) · Preskill, Lecture Notes on Quantum Computation, Ch. 3 · Watrous, The Theory of Quantum Information, Ch. 2 (measurements as POVMs) · Kitaev, Shen, and Vyalyi, Classical and Quantum Computation, §13 (Hamiltonian expectation) · McClean, Romero, Babbush, and Aspuru-Guzik, "The theory of variational hybrid quantum-classical algorithms," New J. Phys. 18, 023023 (2016) · Huang, Kueng, and Preskill, "Predicting many properties of a quantum system from very few measurements," Nature Physics 16, 1050 (2020) · Verteletskyi, Yen, and Izmaylov, "Measurement optimization in VQE by a minimum clique cover," J. Chem. Phys. 152, 124114 (2020) · Cerezo et al., "Variational Quantum Algorithms," Nature Reviews Physics 3, 625 (2021).
Provenance. The single-shot variance follows from and the Born rule (Nielsen and Chuang §2.2). The optimal allocation and floor are a standard Lagrange-multiplier (equivalently Cauchy–Schwarz) result — re-derive by stationarity of . The Hoeffding bound uses range , and the group variance is the operator identity . The H₂ coefficients are representative STO-3G values (O'Malley et al., 2016) with weighted norm Ha, giving shots at Ha; the grouping uses . Chemical accuracy Ha kcal/mol ( Ha kcal/mol). The Pauli scaling and barren-plateau gradient variance are textbook (McClean et al., 2018).
Prerequisites. Variational Quantum Eigensolver · Parameterized Quantum Circuits and Ansatz Design · Quantum Approximate Optimization Algorithm. Leads to. Parameter-Shift Rules and Quantum Gradients · Barren Plateaus in Variational Landscapes · Classical Optimizers for Variational Quantum Algorithms.
Ask the tutor: Ask me to work a full shot budget from a Hamiltonian's Pauli coefficients, to group a set of Pauli strings into qubit-wise and general commuting cliques, or to contrast term-by-term measurement with classical shadows on the same observable.
Why is the shot count, not the circuit depth, the true cost of a variational algorithm?
Because a variational circuit is deliberately shallow — the whole point of NISQ design — but it must be re-run an enormous number of times. Each run returns one bitstring yielding eigenvalues; the energy is their average, and the standard error of samples falls only as , so halving the error quadruples the shots. For a molecular Hamiltonian the coefficients add up (the weighted norm), so chemical accuracy can demand of order shots for a single energy, and an optimization multiplies that further. One circuit's depth is fixed and small; the count of executions runs into the millions, so the currency of the field is shots.
What exactly does it mean for two Pauli strings to be "simultaneously measurable"?
It means they share a common eigenbasis, so one measurement reveals both eigenvalues from the same record — which happens exactly when they commute. There are two grades. Qubit-wise commuting strings agree qubit-by-qubit, so the shared basis is a product basis reached by single-qubit rotations — essentially free. Generally commuting strings like and disagree on individual qubits yet commute as whole strings because an even number of anticommutations cancel; their shared eigenbasis is entangled, so a Clifford circuit must rotate into it before measuring. Both harvest several terms from one setting, but the general case pays in two-qubit gates and their noise.
Why is uniform shot allocation across terms a bad idea?
Because it spends measurements where they do the least good. The variance-optimal rule is : concentrate shots on terms that are both heavily weighted (large ) and genuinely uncertain in the state (large ). Uniform allocation wastes shots on tiny-coefficient terms and near-deterministic ones where — an eigenstate term needs almost none — while starving the dominant, noisy terms that drive the error. The optimum's minimal variance is , the square of the weighted norm over the budget, and any other allocation strictly exceeds it.
If commuting Paulis can be measured together, why not just group everything into as few settings as possible?
Because settings are not the cost — variance is, and aggressive grouping can raise it. Within a group the term estimates are correlated, and the group's variance is the full quantum variance of its partial Hamiltonian, which can exceed the sum of the individual term variances. General grouping also requires a Clifford diagonalization whose entangling gates inject noise, biasing the estimate. So there is a genuine trade-off: fewer settings amortize shots but can inflate variance and add circuit noise. Good grouping minimizes total variance under the budget while respecting device noise, not the raw circuit count — which is why minimum-clique-cover heuristics are tuned, not maximized blindly.
How does measurement estimation connect to parameter-shift gradients?
Directly — a gradient is just two more energy estimates. The parameter-shift rule writes , so each gradient component costs two full cost evaluations, each carrying the shot budget analyzed here; a -parameter circuit multiplies the per-step cost by roughly . The gradient estimator inherits the same shot-noise floor as the energy, which is precisely why barren plateaus are so damaging: when the true gradient shrinks like , it disappears beneath that floor unless the shot count grows like . Shot-frugal optimizers such as SPSA exploit this by estimating gradients from few, randomized evaluations rather than exhaustively.
What are classical shadows, and how do they change the picture?
Classical shadows are a randomized alternative to term-by-term measurement. Instead of choosing a basis for each observable, you measure the state in randomly chosen bases (random Pauli or Clifford) and store a compact classical "shadow" of each outcome. From a modest collection of shadows you predict many observables in post-processing, with rigorous bounds: targets need only measurements when they have bounded locality or Hilbert–Schmidt norm. This inverts the usual cost structure, which grows with the number of terms, and is especially powerful when you want many properties of one state. Shadows do not repeal the law, but they sharply cut the constant and the dependence on observable count — which is why they are now a staple of measurement estimation.