Variational quantum algorithm

On this page 7

A variational quantum algorithm (VQA) is a hybrid quantum-classical method in which a parameterized quantum circuit prepares a trial state, a quantum processor estimates a cost function from repeated measurements, and a classical optimizer updates the circuit parameters until the cost reaches a minimum. Among quantum algorithms in quantum computing, VQAs are the leading family designed for noisy intermediate-scale quantum (NISQ) devices, because they keep circuits shallow and push most of the computational loop onto conventional computers.

The variational quantum eigensolver and QAOA are the best-known members of the family, but the same template also covers quantum machine learning models, variational simulation of time evolution and linear-system solvers. What unites them is the variational principle: the answer is encoded as the optimum of a function that the quantum device can evaluate but cannot easily optimize on its own.

How the hybrid optimization loop works

A variational quantum algorithm runs as an iterative feedback loop between two machines. The quantum processor executes a circuit U(θ) that depends on a vector of real parameters θ, usually rotation angles of single-qubit gates, and measures observables many times. The classical computer turns those measurement statistics into a cost value and proposes new parameters.

The cost is typically the expectation value of a Hamiltonian or another observable, written as a weighted sum of Pauli strings. Each string requires its own measurement setting, so a single cost evaluation can involve thousands to millions of shots. Gradients can be estimated on hardware with the parameter-shift rule, which evaluates the circuit at two shifted parameter values per gate angle.

The table below lists the components that every VQA contains and the role each one plays in the loop.

ComponentRuns onRole in the loop
Ansatz circuitQuantum processorPrepares a parameterized trial state
Cost functionBothMaps measurement results to a scalar to minimize
Measurement strategyQuantum processorGroups Pauli terms and allocates shots
Classical optimizerClassical computerProposes new parameters from cost values
Initialization schemeClassical computerChooses starting parameters to avoid flat regions
Core components of a variational quantum algorithm

Ansatz design and parameter choices

The ansatz is the circuit template that defines which quantum states the algorithm can reach, and its choice largely determines success. A good ansatz is expressive enough to contain the solution, shallow enough to survive hardware noise and structured enough to remain trainable. These goals pull in opposite directions, which is the central design trade-off of the field.

Ansatz families fall into two broad groups. Problem-inspired ansätze encode physics or problem structure, while hardware-efficient ansätze follow the native gate set and connectivity of a specific device. The comparison below summarizes common choices.

Ansatz familyTypical useStrengthWeakness
Unitary coupled clusterQuantum chemistryPhysically motivated, preserves symmetriesDeep circuits on real hardware
Hardware-efficientGeneral NISQ experimentsShort depth, native gatesProne to barren plateaus
QAOA layersCombinatorial optimizationFew parameters, clear structureMay need many layers for quality
Adaptive (ADAPT-style)Chemistry and materialsGrows only the needed operatorsMany extra measurement rounds
Hamiltonian variationalLattice and spin modelsMirrors the target HamiltonianLimited to suitable models
Common ansatz families and their trade-offs

Parameter counts range from a handful in shallow QAOA to several hundred in chemistry ansätze. More parameters increase expressibility but also enlarge the optimization landscape and the number of circuit evaluations per iteration.

Main variants of the variational approach

Variational quantum algorithms differ mainly in what the cost function encodes. The same loop can search for ground states, approximate optimization solutions, fit data or approximate dynamics, depending on the observable and the training objective.

AlgorithmCost functionTarget problem
Variational quantum eigensolverEnergy expectation of a HamiltonianMolecular and material ground states
QAOAExpected value of a classical objectiveMax-Cut and other combinatorial tasks
Variational quantum classifierClassification loss on labeled dataSupervised machine learning
Variational quantum deflationEnergy plus overlap penaltyExcited states
Variational linear solverResidual of a linear systemApproximate solutions to Ax = b
Variational time evolutionDistance from exact dynamicsShort-time quantum simulation
Representative variational algorithms and their objectives

Comparison with fault-tolerant quantum algorithms

Variational methods trade provable guarantees for hardware feasibility. Algorithms such as quantum phase estimation, Shor’s algorithm or the HHL algorithm offer rigorous speedups but need deep, error-corrected circuits. VQAs instead accept heuristic performance in exchange for circuits that fit within present coherence times.

The following table contrasts the two paradigms on the properties that matter when choosing an approach.

PropertyVariational algorithmsFault-tolerant algorithms
Circuit depthShallow, repeated many timesDeep, run once or few times
Error handlingNoise tolerance and error mitigationFull quantum error correction
Performance guaranteeHeuristic, problem dependentProvable asymptotic speedup
Classical overheadHigh, from optimization and shotsLower per useful result
Hardware eraNISQ processorsFuture logical-qubit machines
Variational versus fault-tolerant algorithm properties

In practice the boundary is softening. Researchers study early fault-tolerant variants that combine variational state preparation with phase estimation, using the variational stage to supply a good initial state with high overlap.

Limitations and common pitfalls

The most serious obstacle is the barren plateau phenomenon, in which gradients vanish exponentially with the number of qubits for broad classes of random or highly expressive circuits. Noise itself can induce plateaus, so deeper circuits on imperfect hardware become harder to train even when the ansatz is well chosen.

  • Measurement cost grows quickly because each Pauli term needs sampling, and shot noise limits the precision of every gradient.
  • Local minima and narrow gorges in the landscape can trap gradient-based optimizers far from the true optimum.
  • Classical simulability is a real concern, since circuits that avoid barren plateaus are sometimes efficiently simulable on classical computers.
  • No demonstrated advantage exists yet for an industrially relevant problem, so claims of speedup require careful classical benchmarking.
  • Hardware drift between iterations can change the cost landscape during a long optimization run.

Mitigation strategies include problem-informed initialization, layer-by-layer training, local rather than global cost functions and error mitigation techniques such as zero-noise extrapolation. None removes the limits entirely, which is why VQA results should always be reported with classical baselines and resource counts.

In plain words

A variational quantum algorithm works like tuning an old radio with many knobs. The quantum computer listens to the signal and reports how clear it sounds. An ordinary computer then decides which knobs to turn and by how much. The two repeat this exchange until the reception is as clear as possible.

The knobs are settings inside a short quantum program, and the clarity score is a number that describes how good the current answer is. The key idea is teamwork between a small quantum machine and a classical computer: the quantum part does what only it can do, and the classical part does the patient searching.

A real-world example

A computational chemistry group wants the ground-state energy of lithium hydride to compare bond lengths. They map the molecule onto 12 qubits, reduce it to 6 active qubits with symmetry tapering and choose a compact chemistry-inspired ansatz with about 20 parameters. Each energy estimate groups roughly a hundred Pauli terms into a few dozen measurement settings, with several thousand shots per setting.

A gradient-free optimizer runs for about 150 iterations on a cloud superconducting processor, with zero-noise extrapolation applied to every energy. The final curve reproduces the equilibrium bond length to within a few percent, and the error at the minimum stays close to chemical accuracy only after mitigation. The team reports the result alongside an exact classical calculation, which confirms the method works but also shows that, at this size, the classical computer remains faster.