Day 18 Qucode Cohort 3
Topic: Variational Quantum Algorithms, Hybrid quantum-classical computing
1. Motivation and the hybrid paradigm
Large, fault-tolerant quantum computers remain years away. NISQ devices offer tens–few hundreds of noisy qubits, limited coherence, and imperfect gates. VQAs are explicitly designed to bridge current hardware capabilities and useful problems: they use short (shallow) parameterized circuits interleaved with classical optimization to solve variational problems such as ground-state chemistry or combinatorial optimization.
Conceptually a VQA implements the minimization
where |ψ(θ)⟩ is prepared by a parameterized quantum circuit (ansatz) and H is the problem Hamiltonian (or more generally, an observable encoding the cost). The variational principle guarantees that the minimum over all quantum states (if accessible) is the ground state energy. In practice we restrict to an ansatz family and trade exactness for tractability. This VQE workflow — construct Hamiltonian, prepare |ψ(θ)⟩, measure Pauli terms, combine results, and update parameters is central to VQE and appears in standard teaching materials
2. Variational principle & Hamiltonian decomposition
2.1 Variational principle
2.2 Hamiltonian → Pauli decomposition
3. Ansatz design: expressibility, locality and hardware constraints
The choice of ansatz |ψ(θ)⟩=U(θ)|0⟩ is the most consequential design decision.
Two main classes
- Problem-inspired ansätze
- Unitary Coupled Cluster (UCC) and its truncations (UCCSD) for chemistry: generated from fermionic excitation operators T, the ansatz is e^(T−T†)∣HF⟩. UCC is physically motivated but leads to deep circuits after mapping to qubits (Trotterization).
- Hamiltonian variational ansatz: build layers inspired by terms in H
2. Hardware-efficient ansätze
- Layers of parametrized single-qubit rotations and entangling gates matched to the device’s connectivity. Very shallow, easy to compile, but often highly expressive (sometimes too expressive) and vulnerable to barren-plateau gradients.
Design tradeoffs
- Expressibility (ability to represent many states) vs trainability (avoidance of barren plateaus, presence of useful gradients).
- Locality: ansätze composed of local gates preserve problem locality and reduce entangling overhead.
- Symmetry preservation: conserve particle number, spin, parity etc. — reduces search space and prevents spurious states.
Adaptive ansätze (e.g., ADAPT-VQE) build circuits iteratively by selecting operators that maximally reduce energy, achieving compact circuits with better trainability.
4. The hybrid loop & optimization
A prototypical VQA loop:
- Choose ansatz U(θ) and classical optimizer.
- Prepare ∣ψ(θ)⟩=U(θ)∣0⟩
- Measure each Pauli string Pp (or grouped sets) to estimate ⟨Pp⟩
- Compute the cost E(θ)=∑hp⟨Pp⟩
- θ←θ+Δθ using a classical optimizer (gradient-free or gradient-based).
- Repeat until convergence.
initialize θ
while not converged:
prepare |ψ(θ)⟩ on QPU
measure groups of Pauli strings → estimate E(θ)
compute ∇E(θ) (optionally)
update θ with classical optimizerPractical systems must manage shot budgets (measurements), classical compute latency, and noise.
5. Gradient evaluation: parameter-shift, SPSA, and natural gradient
5.1 Parameter-shift rule (exact gradient for many common gates)
5.2 Stochastic gradient estimators (SPSA)
When parameters are many or shot budgets tight, Simultaneous Perturbation Stochastic Approximation (SPSA) estimates gradients with only two cost evaluations per iteration by perturbing all parameters at once along a random direction. SPSA is robust to noise and popular in early VQE/QAOA experiments.
Get Andreabenassi’s stories in your inbox
Join Medium for free to get updates from this writer.
5.3 Quantum natural gradient (QNG)
6. Measurement strategies and shot complexity
Directly measuring every Pauli term independently is wasteful. Strategies to reduce shots:
- Pauli grouping: group commuting Pauli strings that can be measured simultaneously (either via tensor-product basis or general commuting sets), reducing the number of measurement circuits.
- Circuit recompilation: apply local rotations to measure many terms in the same basis.
- Classical shadows: randomized single-qubit Clifford measurements produce a data structure (a “shadow”) from which many observables can be estimated with sublinear overhead in the number of observables (subject to variance bounds). This is especially powerful when many expectation values are needed.
- Importance sampling & adaptive shot allocation: allocate shots proportional to coefficient magnitude ∣hp∣ and variance to minimize estimator variance for a fixed shot budget.
Shot complexity to reach energy precision ϵ scales roughly like O(Var(H)/ϵ²); variance reduction (grouping, classical shadows) is therefore crucial.
7. Error mitigation and noise-aware strategies
VQAs do not remove noise; they can be robust to some errors but require mitigation for quantitative accuracy.
Common techniques:
- Zero-Noise Extrapolation (ZNE): artificially scale noise (e.g., by stretching gate durations or repeating gates) to obtain estimates at multiple noise strengths and extrapolate back to zero noise.
- Probabilistic Error Cancellation (PEC): invert noise channels stochastically using noisy gate characterizations — unbiased but incurs exponential sampling overhead in noise strength.
- Symmetry verification / postselection: reject measurement outcomes violating conserved quantities (e.g., particle number), reducing error at a cost of effective shots.
- Subspace expansion / linear response: expand the variational state in a small subspace of error-excited states and solve a generalized eigenproblem to correct energy.
- Readout error mitigation: classical calibration and inversion of readout error matrices.
Error mitigation is not error correction — it trades extra measurements and classical processing to reduce bias.
8. Trainability issues: barren plateaus & remedies
Barren plateaus: large, random parameterized circuits tend to have gradients that vanish exponentially in system size — making optimization infeasible. Causes include:
- Random global ansätze (high expressibility).
- Deep ansätze with many parameters.
- Certain choices of cost function (global vs local).
Mitigations
- Use local cost functions (measure observables with local support).
- Use problem-inspired ansätze preserving symmetries.
- Layerwise training: grow the ansatz and train shallowly (progressive ansatz expansion).
- Smart initialization: initialize near physically meaningful states (Hartree–Fock, mean-field).
- Noise-induced effects: interestingly, certain levels of noise can either worsen or sometimes (in special cases) help escape plateaus; in practice noise usually harms trainability.
Understanding and managing trainability remains an active research frontier.
9. Fermions → qubits: mappings and resource considerations (chemistry focus)
For electronic structure problems:
- Second quantization: express Hamiltonian with fermionic creation/annihilation ap†, ap as
2. Mapping to qubits:
- Jordan–Wigner: simple, maps apa_pap to strings of Zs times ladder operators; results in long Pauli strings but straightforward.
- Bravyi–Kitaev: reduces average string length by mixing parities and occupations; often preferred for fewer long Pauli strings.
- Tapering by symmetries: use point group or spin symmetries to reduce qubits (Bravyi–Kitaev + symmetry reduction).
3. Active space selection: freeze core orbitals; only treat chemically relevant orbitals with quantum resources.
Resource planning must account for qubit count after mapping, circuit depth of UCC or alternative ansätze, and measurement overhead.
10. Advanced algorithmic variants & extensions
- ADAPT-VQE: iteratively builds ansatz by selecting operators with largest gradient contributions (adaptive, compact circuits).
- Variational Quantum Imaginary Time Evolution (VarQITE): approximate imaginary time evolution variationally to converge to ground states.
- Quantum Subspace Expansion (QSE): get excited states or correct errors by expanding around the variational state.
- VQD (Variational Quantum Deflation): compute excited states sequentially by adding penalty terms to cost.
- Layerwise and block-wise training: improves convergence and combats barren plateaus.
- Hybrid classical pre/post-processing: warm-start parameters from classical heuristics or use classical post-processing to refine outputs.
11. Conclusion
VQAs are the most practical family of quantum algorithms for near-term hardware. They combine physics-inspired modeling, quantum state preparation, and classical optimization in a hybrid loop tailored to shallow circuits and limited coherence times. Success demands careful engineering: choose the right ansatz, manage measurement costs, mitigate noise, and use optimizers suited to noisy, shot-limited settings. While VQAs are heuristics, practical wins in chemistry, optimization, and quantum-enhanced data science are plausible in the coming years as hardware, software, and algorithmic techniques co-evolve.
For a succinct description of the VQE workflow and foundational slides used in many training courses, see the IBM-authored lecture on VQE that lays out the variational principle, Hamiltonian decomposition, and the hybrid loop in pedagogical detail.




