Chapter 11
Variational and Hybrid Quantum Algorithms
Diploma in Quantum Computing
Quantum Algorithms and Complexity
•
Diploma
Variational and Hybrid Quantum Algorithms
Introduction and context
Variational and hybrid quantum algorithms combine a parameterized quantum circuit with a classical optimization routine. The quantum processor prepares states and estimates objective functions, while a classical computer updates circuit parameters. This division of labour is central to near-term quantum computing because present devices have limited coherence, imperfect gates, restricted connectivity, and too few error-corrected qubits for many fault-tolerant algorithms.
The central promise is not that every optimization step becomes quantum. Rather, a quantum circuit may represent or sample from a class of states that is difficult to reproduce classically, while classical computation supplies flexible numerical search. The central challenge is equally important: a hybrid workflow can require many circuit executions, can be difficult to optimize, and may offer no practical advantage over strong classical methods.
Learning objectives
By the end of this chapter, a student should be able to:
Explain parameterized quantum circuits and formulate variational objectives.
Describe the VQE and QAOA workflows and distinguish their use cases.
Select and interpret classical optimization methods for noisy quantum objectives.
Estimate sampling costs and explain measurement grouping.
Analyse barren plateaus, noise sensitivity, and optimization failure.
Design an evidence-based experiment for assessing practical quantum advantage.
1. Parameterized quantum circuits
A parameterized quantum circuit (PQC), also called an ansatz circuit, is a circuit whose gates depend on adjustable real parameters θ = (θ₁, θ₂, …, θₚ). For an input state |ψ₀⟩, the circuit produces
|ψ(θ)⟩ = U(θ)|ψ₀⟩
Here U(θ) is unitary in the ideal noiseless model, and p is the number of trainable parameters. A measurement produces classical outcomes. Repeated executions estimate expectation values such as
f(θ) = ⟨ψ(θ)|O|ψ(θ)⟩
where O is an observable, represented by a Hermitian operator. The variational task is usually minimization:
θ* = arg min_θ f(θ)
The objective may be an energy, a cost function, a likelihood, or a penalty-augmented constraint function. A PQC does not automatically solve the optimization problem: it defines a search family, and the classical optimizer must locate useful parameters within that family.
A practical hybrid iteration consists of:
A classical controller proposes θ.
The quantum processor executes U(θ) repeatedly.
Measurements estimate one or more objective values.
The controller uses these estimates to produce a new θ.
The process stops at a specified convergence or resource limit.
Figure: The classical optimizer, quantum circuit, and measurement system form a feedback loop.
Ansatz design
An ansatz should balance expressibility and trainability. A hardware-efficient ansatz uses native gates and follows device connectivity, often reducing circuit depth. A problem-informed ansatz incorporates symmetries, conservation laws, or domain structure. Greater expressibility can enlarge the set of reachable states, but excessive depth may increase noise and create barren plateaus. The best ansatz is therefore task- and hardware-dependent, not universally the deepest or most expressive one.
Important design choices include parameter initialization, layer count, entangling pattern, gate set, symmetry preservation, and whether parameters are shared. Initialization near a known classical solution can improve training; random initialization may be convenient but can produce gradients that are extremely small.
2. Variational Quantum Eigensolver
The Variational Quantum Eigensolver (VQE) estimates the lowest eigenvalue of a Hermitian Hamiltonian H. The Hamiltonian is commonly decomposed into Pauli strings:
H = ∑ᵢ cᵢPᵢ
where cᵢ are real coefficients and Pᵢ are tensor products of I, X, Y, and Z operators. For any normalized trial state, the Rayleigh–Ritz variational principle gives
E(θ) = ⟨ψ(θ)|H|ψ(θ)⟩ ≥ E₀
where E₀ is the ground-state energy. Substitution of the Pauli decomposition yields
E(θ) = ∑ᵢ cᵢ⟨Pᵢ⟩_θ
The inequality assumes an ideal normalized state and Hermitian H. It is an upper-bound statement for the ground-state energy; it does not imply that an experimental estimate is always above the true value, because statistical and hardware errors can shift estimates in either direction.
VQE workflow
A VQE implementation generally performs the following tasks:
map a physical model to qubits;
choose an initial state and ansatz;
measure the Pauli terms or compatible groups;
combine estimates using their coefficients;
optimize θ classically;
validate energy, uncertainty, symmetry, and state quality.
If the estimate of each Pauli expectation has standard error σᵢ and measurements are independent, a first-order variance estimate is
Var(Ê) ≈ ∑ᵢ cᵢ² Var(P̂ᵢ)
For a Pauli measurement with outcomes ±1 and Nᵢ shots, Var(P̂ᵢ) = (1 − ⟨Pᵢ⟩²)/Nᵢ. Thus
SE(Ê) ≈ √[∑ᵢ cᵢ²(1 − ⟨Pᵢ⟩²)/Nᵢ]
This expression assumes independent shot sets and unbiased estimates. Covariance terms must be added when estimates are correlated, for example when using shared samples.
Small worked example
Suppose H = 0.5Z₁ + 0.3Z₂ − 0.2Z₁Z₂, and measured expectations are ⟨Z₁⟩ = 0.6, ⟨Z₂⟩ = −0.4, and ⟨Z₁Z₂⟩ = −0.5. Then
The result is an energy in the units used for H. A real experiment would also report statistical uncertainty and details of noise mitigation.
3. QAOA for combinatorial optimization
The Quantum Approximate Optimization Algorithm (QAOA) targets a classical cost function encoded in a diagonal cost Hamiltonian C. For a bit string z, C|z⟩ = C(z)|z⟩. A depth-p QAOA state is
|γ,β⟩ = UB(βₚ)UC(γₚ)⋯UB(β₁)UC(γ₁)|+⟩^⊗n
where U_C(γ) = exp(−iγC), U_B(β) = exp(−iβB), and B is a mixing Hamiltonian, commonly B = ∑ⱼXⱼ. The parameters γ and β are optimized to maximize or minimize the expected cost according to the problem convention. The initial |+⟩ state is an equal superposition of computational basis states.
For a maximization problem, one may maximize
F(γ,β) = ⟨γ,β|C|γ,β⟩
and then sample bit strings from the optimized state. The best sampled string, its approximation ratio, feasibility, and success probability should all be reported. A high expected cost does not guarantee that a particular run returns the optimum.
QAOA requires a cost Hamiltonian, a mixer, an encoding, and a measurement rule. Constraints can be encoded by penalty terms, by a constraint-preserving mixer, or by a problem-specific construction. Penalties that are too small permit infeasible solutions; penalties that are too large can distort the landscape and worsen optimization.
4. Classical optimization of noisy objectives
Quantum objective evaluations are finite-sample estimates, so the optimizer sees a noisy function rather than an exact mathematical surface. No single classical optimizer is best in all regimes.
Method
Useful feature
Main concern
SPSA
Uses two function evaluations independent of parameter count
Noisy and sensitive to tuning
COBYLA
Derivative-free and constraint-aware
Can stagnate or require many evaluations
Nelder–Mead
Simple local search
Poor scaling and noise sensitivity
Gradient descent
Directly uses gradient information
Gradient estimation can be expensive
L-BFGS-type methods
Efficient with reliable gradients
Often unsuitable when gradients are very noisy
Bayesian optimization
Models expensive evaluations
Surrogate quality degrades in high dimension
For a differentiable parameter θⱼ and a gate generated by a Pauli operator, the parameter-shift rule often gives
∂f/∂θⱼ = [f(θⱼ + π/2) − f(θⱼ − π/2)]/2
with all other parameters held fixed. This rule applies to suitable rotation gates with the standard normalization; it is not a universal rule for arbitrary parameterized operations. Each function estimate still requires shots, so a gradient can have substantial sampling variance.
Good practice includes scaling or normalizing objectives, using multiple starting points, setting a shot budget, rejecting statistically insignificant updates, tracking the best feasible solution, and separating optimization data from final validation data.
5. Sampling cost and measurement strategy
A quantum expectation is inferred from repeated measurements. If a bounded observable has variance v and N independent shots, its standard error is approximately √(v/N). To reduce standard error by a factor of two, approximately four times as many shots are required. This inverse-square law explains why precision can become expensive.
For VQE, the total cost depends on the number of Pauli terms, grouping strategy, coefficient magnitudes, desired precision, number of optimizer iterations, and number of parameter evaluations per iteration. Commuting Pauli terms can sometimes be measured in a common basis. Grouping reduces circuit-setting overhead but may introduce covariance or require careful allocation of shots.
Adaptive allocation gives more shots to terms contributing most to energy uncertainty. Readout error mitigation, symmetry verification, zero-noise extrapolation, and probabilistic error cancellation can improve estimates, but each adds overhead and may increase variance. Mitigation does not create fault-tolerant accuracy and must be assessed against an unmitigated baseline.
6. Barren plateaus and trainability
A barren plateau is a region in which gradients become very small, often exponentially small in system size under particular random-circuit ensembles and cost-function choices. It is not simply “a bad local minimum.” The optimizer may receive an almost uninformative gradient even when the objective is far from optimal.
Contributing factors include overly deep random circuits, highly global cost functions, poor initialization, noise, and excessive expressibility. Local cost functions, shallow structured ansätze, layerwise training, symmetry restrictions, parameter sharing, and initialization from problem-informed states can reduce the risk. These techniques are mitigation strategies, not universal guarantees.
Noise introduces an additional effect sometimes called a noise-induced barren plateau: expectation values and gradients can become suppressed as circuit depth or system size increases. Practical diagnosis should measure gradient distributions, objective variance, depth dependence, and performance from several initializations rather than infer a plateau from one failed run.
7. Noise, hardware constraints, and validation
Relevant error sources include gate infidelity, decoherence, leakage, measurement error, crosstalk, frequency drift, finite sampling, compilation overhead, and connectivity-induced swap gates. A circuit that is short in abstract gate notation may become much deeper after hardware compilation.
Noise can alter both objective values and the location of the apparent optimum. Therefore, optimizing a noisy objective may produce parameters that exploit device-specific error rather than represent the intended state or solution. Validation should include:
repeated runs on different times and, where possible, different devices;
noiseless simulation for small instances;
calibration and circuit-depth records;
confidence intervals or repeated-shot uncertainty estimates;
comparison with classical baselines;
out-of-sample or holdout validation for learning tasks;
feasibility and constraint checks for optimization tasks.
A result should distinguish statistical uncertainty from systematic bias. Increasing shots reduces sampling noise but does not remove coherent gate error or readout bias.
8. Evidence for practical quantum advantage
A credible claim of practical advantage requires more than a lower objective value in a small demonstration. The comparison must define the task, input distribution, accuracy target, hardware and software resources, preprocessing, postprocessing, and time boundary. Classical competitors should include optimized algorithms, approximation methods, tensor-network or stochastic methods where applicable, and hardware-aware implementations.
Useful evidence includes:
a precisely specified problem family rather than one favourable instance;
matched quality targets and failure criteria;
wall-clock time, energy use, queue time, and total quantum shots;
scaling data across instance sizes;
uncertainty intervals and repeated trials;
ablation studies for ansatz, optimizer, mitigation, and compilation;
reproducible code, circuits, seeds, calibration context, and raw or summarized measurements.
One should distinguish quantum computational advantage, where a quantum method achieves a complexity or scaling benefit, from practical advantage, where it is cheaper, faster, or more accurate in a real operating environment. Present variational algorithms frequently provide valuable scientific and engineering experience without yet demonstrating broad practical advantage.
Background. A research team wishes to estimate the ground-state energy of a small molecular Hamiltonian on a noisy superconducting processor. This is an illustrative case, not a claim about a particular experimental result.
Problem. The Hamiltonian contains 20 Pauli terms. The team has a four-qubit device, a maximum circuit depth of 60 native gates, and a limited daily shot budget. A classical chemistry package provides a reference energy for validation.
Analysis. A hardware-efficient ansatz is shallow but does not automatically preserve particle number. A chemically informed initial state and a symmetry-preserving ansatz are considered. The team predicts that measurement, rather than gate execution, will dominate cost because each optimizer step requires estimates of many terms.
Approach. The team first simulates the circuit without noise, then runs a small pilot experiment to estimate term variances. Commuting terms are grouped, and shots are allocated according to estimated contribution to energy variance. SPSA is selected because it needs a constant number of perturbed objective evaluations per iteration and tolerates noisy values. Three initializations are tested. Symmetry checks identify samples that violate known sector constraints; the results are reported both with and without this postselection. A separate final run is reserved for unbiased energy estimation.
Outcome. The best experimental energy is compared with the classical reference, the ideal noiseless VQE result, and a simple classical baseline. The team reports confidence intervals, total shots, circuit depth, compilation time, optimizer settings, and the effect of mitigation. It does not claim advantage because the classical method is faster and the experiment is too small for a scaling conclusion.
Learning points. The case illustrates that workflow design is an evidence problem as well as an algorithm problem. Ansatz choice, measurement allocation, optimizer selection, and validation must be considered together. A variational result is meaningful only when its uncertainty, resource use, and classical comparison are explicit.
10. Professional practice, governance, and contemporary directions
Hybrid algorithm engineers should maintain an auditable record of circuit versions, compiler settings, device calibrations, random seeds, shot counts, parameter trajectories, and stopping criteria. Claims should not conceal failed initializations or favourable instance selection. Reproducibility is particularly important because hardware performance changes over time.
Applications involving chemistry, finance, logistics, or public-sector decisions may involve confidential data, safety constraints, or consequential recommendations. Quantum processing does not remove obligations concerning privacy, fairness, security, or accountability. A variational method should be deployed only when its error bounds and failure modes are appropriate for the decision.
Current research investigates adaptive ansätze, error-aware optimization, quantum natural gradients, symmetry verification, better measurement allocation, error suppression, distributed quantum-classical execution, and combinations with classical machine learning. These developments may improve trainability, but each introduces assumptions and overhead that require empirical benchmarking.
Best-practice checklist
Define the objective, units, constraints, and stopping rule before execution.
Use a problem- and hardware-informed ansatz whenever possible.
Benchmark several initializations and at least one robust optimizer.
Estimate shot requirements before promising precision.
Track circuit depth after compilation, not only before compilation.
Report uncertainty, noise mitigation, and all resource costs.
Compare against strong classical baselines at matched quality.
Reserve independent runs for final validation.
Treat advantage as a testable empirical claim, not an assumption.
Chapter Summary
Variational and hybrid quantum algorithms place a parameterized quantum circuit inside a classical feedback loop. VQE minimizes the expectation of a Hamiltonian and uses the variational principle to estimate ground-state energies. QAOA alternates cost and mixing unitaries to generate samples for combinatorial optimization. Both methods depend on ansatz design, classical optimization, measurement precision, and hardware quality.
Finite shots create statistical uncertainty, while noise can bias objectives and suppress gradients. Barren plateaus make some circuits difficult to train, particularly when depth, randomness, or global objectives increase. Practical workflows therefore require structured ansätze, suitable optimizers, measurement planning, noise analysis, and independent validation. Evidence for practical advantage must include strong classical comparisons, matched quality criteria, scaling studies, uncertainty, and complete resource accounting.
Key Terms
Parameterized quantum circuit: A quantum circuit containing adjustable real parameters.
Ansatz: A chosen parameterized family of quantum states.
Variational objective: A function optimized over parameters, often an expectation value.
Observable: A Hermitian operator associated with a measurable quantity.
Hamiltonian: An operator representing energy or system dynamics.
VQE: A hybrid algorithm for estimating a Hamiltonian’s ground-state energy.
Rayleigh–Ritz principle: The expectation value of a normalized state is no lower than the ground-state energy.
Pauli string: A tensor product of single-qubit Pauli operators.
QAOA: A layered variational algorithm for encoded combinatorial cost functions.
Cost Hamiltonian: An operator whose computational-basis eigenvalues encode objective values.
Mixer Hamiltonian: The QAOA operator that explores candidate states.
Shot: One circuit execution followed by measurement.
Measurement grouping: Measuring compatible observables using shared measurement settings.
Parameter-shift rule: A method for estimating certain circuit derivatives from shifted evaluations.
Barren plateau: A region with gradients too small to guide optimization effectively.
Noise mitigation: Techniques intended to reduce error effects without full error correction.
Approximation ratio: A normalized measure comparing an obtained solution with an optimum or bound.
Practical quantum advantage: A real-world resource or performance benefit over relevant classical methods.
Review Questions
Short Answer Questions
What roles do the quantum processor and classical optimizer play in a hybrid algorithm?
State the variational inequality used by VQE and identify its assumptions.
Why does reducing measurement standard error by half require approximately four times as many shots?
What is a barren plateau?
Name two types of evidence needed to support a claim of practical quantum advantage.
Long Answer Questions
Explain the complete VQE workflow, including Hamiltonian decomposition, measurement, optimization, and validation.
Compare QAOA and VQE in terms of objective, circuit structure, output, and application domain.
Discuss how ansatz depth and initialization influence trainability and noise sensitivity.
Explain the advantages and limitations of SPSA, COBYLA, and gradient-based optimization for noisy quantum objectives.
Develop a measurement and reporting plan for a small VQE experiment under a fixed shot budget.
Analytical / Application Questions
A Hamiltonian has Pauli coefficients 0.8, −0.4, and 0.2, with measured expectations 0.5, −0.25, and 0.1. Calculate the estimated energy and explain what additional information is needed to report its reliability.
A QAOA experiment returns a high expected cost but rarely samples feasible solutions. Diagnose at least three possible causes and propose tests for each.
Design an experiment to compare a hybrid quantum optimizer with a classical baseline. Specify the instance family, quality metric, resource measures, uncertainty analysis, and criteria for a defensible advantage claim.
Multiple Choice Questions with Answers
Question 1
Which expression represents a typical variational objective?
A. f(θ) = ⟨ψ(θ)|O|ψ(θ)⟩
B. f(θ) = θ + O
C. f(θ) = U(θ)O
D. f(θ) = O2/θ
Correct Answer: A. f(θ) = ⟨ψ(θ)|O|ψ(θ)⟩
Question 2
In VQE, the Hamiltonian is commonly decomposed into which terms?
A. Classical truth tables only
B. Pauli strings with real coefficients
C. Fourier frequencies only
D. Non-Hermitian transition matrices
Correct Answer: B. Pauli strings with real coefficients
Question 3
What does the Rayleigh–Ritz variational principle provide for an ideal normalized trial state?
A. A guaranteed exact excited-state energy
B. A lower bound on the ground-state energy
C. An upper bound on the ground-state energy
D. A guarantee of zero measurement variance
Correct Answer: C. An upper bound on the ground-state energy
Question 4
What is the main purpose of the QAOA cost Hamiltonian?
A. To encode objective values in computational-basis states
B. To eliminate all classical optimization
C. To prepare only the all-zero state
D. To correct readout errors automatically
Correct Answer: A. To encode objective values in computational-basis states
Question 5
If the standard error of an estimate must be reduced by a factor of two, approximately how must the number of independent shots change?
A. It must be halved
B. It must be doubled
C. It must be multiplied by four
D. It remains unchanged
Correct Answer: C. It must be multiplied by four
Question 6
Which condition most directly describes a barren plateau?
A. The circuit contains no measurements
B. Gradients become too small to provide useful optimization information
C. Every parameter has a unique global optimum
D. The Hamiltonian has no Pauli decomposition
Correct Answer: B. Gradients become too small to provide useful optimization information
Question 7
Why can increasing circuit depth harm a near-term variational algorithm?
A. It always removes expressibility
B. It can increase noise and worsen trainability
C. It prevents any classical post-processing
D. It makes measurement outcomes deterministic
Correct Answer: B. It can increase noise and worsen trainability
Question 8
Which optimizer is specifically known for using a small number of perturbed objective evaluations independent of parameter count?
A. SPSA
B. Exact diagonalization
C. Nelder–Mead with no evaluations
D. Quantum phase estimation
Correct Answer: A. SPSA
Question 9
Which result is strongest evidence for practical quantum advantage?
A. A single favourable small instance
B. A lower objective without reporting shots
C. A matched, reproducible comparison showing resource-scaled benefit over strong classical baselines
D. A deeper circuit than the classical algorithm
Correct Answer: C. A matched, reproducible comparison showing resource-scaled benefit over strong classical baselines
Question 10
What does increasing the number of shots primarily reduce?
A. Statistical sampling uncertainty
B. Coherent gate calibration error automatically
C. The number of qubits required
D. The need for a classical optimizer
Correct Answer: A. Statistical sampling uncertainty
Quantum Algorithms and Complexity
Chapter 11
of 14