The variational quantum eigensolver (VQE) explained: the loop, its costs and its limits
The variational quantum eigensolver (VQE) estimates the lowest eigenvalue of a Hamiltonian, most often the ground-state energy of a molecule. A parametrised circuit prepares a trial state, the quantum computer measures its energy, and a classical optimiser changes the circuit's angles until the energy stops falling. The circuits are short enough for today's hardware, but the method pays for that in measurements and in a hard optimisation, and no VQE run has yet beaten classical chemistry on a problem that matters.
Updated
At a glance
- The problem
- The lowest eigenvalue of a Hamiltonian : the ground-state energy of a molecule or of a lattice model
- The idea
- Prepare with a parametrised circuit, measure , lower it with a classical optimiser[1]
- The guarantee
- is never below the true ground-state energy. It can be well above it, and nothing in the run says by how much
- Cost of one energy
- Order repetitions of the circuit for precision , for each group of terms of ; a molecule has order terms for orbitals[2]
- Largest hardware runs
- Molecules up to six qubits[3] in 2017, and a Hartree-Fock state on a dozen qubits[4] in 2020
- Against classical methods
- No advantage shown. Every molecule VQE has solved is solved faster by classical chemistry codes
- In eigenkit
VQEineigenkit.chemistry, with Jordan-Wigner and Bravyi-Kitaev mappings, UCCSD and hardware-efficient ansätze, and an exact reference for small systems
What VQE is
Many questions in chemistry and materials science come down to one number: the lowest energy a system of electrons can have. That energy is the smallest eigenvalue of the system's Hamiltonian, a matrix whose size doubles with every spin-orbital. The variational quantum eigensolver was proposed by Peruzzo and colleagues in 2014 as a way to estimate it on a small, noisy quantum computer[1], and the framework was set out in full by McClean and colleagues[2].
It rests on the variational principle. For any state , the average energy is at least the ground-state energy , with equality only for the ground state. So a family of states with adjustable parameters can be searched for the one with the lowest energy, and a lower number is always a better answer. Classical chemistry has used this idea for a century. VQE changes where the state lives: a quantum circuit prepares it, so states that would take exponential memory to write down classically are within reach.
The division of labour is the point of the method. The quantum computer does only what is hard classically, preparing an entangled state and measuring it. Everything else, the optimisation and the bookkeeping, runs on a classical computer. Each circuit is short, which is why the method was aimed at hardware without error correction, where the alternative, phase estimation, cannot run.
How the VQE loop works
Write the Hamiltonian in qubit terms
A molecule's Hamiltonian is written in creation and annihilation operators for electrons. A mapping such as Jordan-Wigner or Bravyi-Kitaev turns it into a weighted sum of Pauli strings, , on one qubit per spin-orbital. The number of terms grows as the fourth power of the number of orbitals[2]. For a lattice model or a spin system the sum is short and often given directly.
Choose an ansatz
The ansatz is the parametrised circuit that prepares the trial state. Chemistry-inspired circuits such as UCCSD start from the Hartree-Fock state and add excitations[12]; hardware-efficient circuits use whatever gates the device runs well[3]. This choice decides more than any other whether the run can reach the answer.
Measure the energy
The energy is . Each expectation value is an average over repeated runs of the circuit, with the qubits rotated into the basis of that Pauli string before measurement. Terms that commute qubit by qubit are measured together, which cuts the number of distinct circuits but not the statistics.
Update the parameters
A classical optimiser proposes new angles. On a simulator it can use exact gradients; on hardware the gradient comes from more measurements (the parameter-shift rule costs two energy evaluations per parameter), or a stochastic method such as SPSA estimates a direction from two evaluations whatever the number of parameters.
Repeat, then check
The loop stops when the energy no longer falls. That is convergence of the optimiser, not proof of the ground state. On a system small enough to diagonalise exactly, compare; on a larger one, repeat from other starting points and compare against the best classical method available.
Run it on a real QPU with EigenOrbit RouterIn eigenkit:
pip install "eigenkit[router]", thenprovider=RouterConfig(device=...)(docs).
VQE on a two-site Hubbard model
from eigenkit.chemistry import (
VQE, exact_ground_state_energy, fermi_hubbard_dimer, jordan_wigner, uccsd_ansatz,
)
hamiltonian = fermi_hubbard_dimer(t=1.0, u=2.0) # two sites, four spin-orbitals
observable, offset = jordan_wigner(hamiltonian) # 10 Pauli terms on 4 qubits
exact = exact_ground_state_energy(observable, 4, offset=offset)
print(round(exact, 6)) # -1.236068
# hardware-efficient ansatz, three layers, five random starts
result = VQE(layers=3, restarts=5).solve(observable, n_qubits=4, offset=offset)
print(round(result.energy, 6), result.success) # -1.236068 True
# UCCSD from the Hartree-Fock state, one and two repetitions
for reps in (1, 2):
ansatz = uccsd_ansatz(n_qubits=4, n_electrons=2, reps=reps)
result = VQE(restarts=5).solve(observable, n_qubits=4, offset=offset, ansatz=ansatz)
print(reps, round(result.energy, 6), result.success)
# 1 -1.0 True
# 2 -1.236068 TrueA Fermi-Hubbard dimer on eigenkit's exact NumPy simulator. The hardware-efficient circuit and two repetitions of UCCSD both reach the exact ground-state energy. One repetition of UCCSD converges, reports success, and returns -1.0: an excited level, not the ground state. The variational principle is not violated, since -1.0 is above -1.236, and nothing in the run flags it. Only the exact reference does.
What VQE costs: measurements
A simulator returns exactly. A quantum computer returns bits, and an average of bits has statistical noise that falls only as the square root of the number of repetitions. To know one energy to precision takes on the order of shots, multiplied by a factor that grows with the weights of the Hamiltonian's terms. Chemistry asks for about 1.6 mHa, one part in tens of thousands of a small molecule's total energy, so the factor is large from the start.
That cost is paid for every energy the optimiser asks for, and again for every gradient component. Wecker, Hastings and Troyer estimated the total for molecules early on and called the number of measurements astronomically large[5], while finding lattice models such as the Hubbard model far less demanding. Gonthier and colleagues repeated the analysis in 2022 with the improvements made since, including low-rank factorisations of the Hamiltonian, for the combustion energies of small organic molecules. They concluded that these techniques will not be sufficient to achieve practical quantum computational advantage[6] for such molecules, even on a device with no errors.
Grouping commuting terms, classical shadows and better allocation of shots between terms reduce the constant, and the review by Tilly and colleagues covers them in detail[7]. None changes the law, which comes from sampling. Methods that do change it use longer coherent circuits, the resource VQE was designed to avoid.
What VQE costs: the optimisation
The energy as a function of the angles is not convex. Bittel and Kliesch proved that the classical optimisation inside a variational quantum algorithm is NP-hard, even for systems that are easy to solve by other means, and that the landscape can hold many local minima far from the optimum[10]. In practice this shows up as runs that converge to the wrong energy and report success, as in the sample above.
The second obstacle is the barren plateau. For circuits that are deep and unstructured enough, the gradient of the energy vanishes exponentially with the number of qubits, so that telling a slope from shot noise takes exponentially many measurements[9]. Hardware-efficient circuits are the most exposed. Chemistry-inspired circuits and a start from the Hartree-Fock state avoid the worst of it at the price of depth[8].
Adaptive methods attack both problems by building the circuit as they go. ADAPT-VQE adds one operator at a time, choosing the one with the largest energy gradient, and reaches a given accuracy with fewer parameters and shallower circuits than UCCSD in numerical tests[11]. The price is more measurements, to rank the candidate operators at every step.
What our run shows: the same method, two starting points
From our bond scan of lithium hydride: STO-3G basis, the Li 1s orbital frozen, Jordan-Wigner mapping, UCCSD with one repetition, L-BFGS-B with exact gradients on a noiseless simulator. The reference is the exact ground-state energy of the same qubit Hamiltonian. The only thing that differs between the two VQE rows is where the optimiser starts.
| Quantity | Value |
|---|---|
| Qubits | 10 qubits |
| Pauli terms in the Hamiltonian, largest over the scan | 275 |
| UCCSD parameters | 44 |
| Largest VQE error, start from Hartree-Fock | 0.00008 mHa |
| Points within 1.6 mHa, start from Hartree-Fock | 40 of 40 |
| Largest VQE error, random start | 128.2 mHa ± 4.1 mHa |
| Runs within 1.6 mHa, random start | 0 of 25 |
| Largest Hartree-Fock error, no VQE at all | 159.0 mHa |
| VQE time per point, start from Hartree-Fock | 1.63 s ± 0.38 s |
| PySCF full configuration interaction, time per point | 0.011 s |
Run vqe-dissociation-curves of 2026-11-03, mean and spread over 5 seeds, on Molecular Hamiltonians of H2 and LiH in the STO-3G basis, integrals computed by PySCF. Errors are against the exact energy, in millihartree. Random starts: five seeds at five bond lengths. Times are wall-clock on one laptop and are indicative only. The whole run, with hydrogen and every classical method, is on the bond scan page.
Reading the run
Started from the Hartree-Fock state, VQE with UCCSD matched the exact energy at every bond length. Started from random angles, with the same circuit, the same optimiser and exact gradients, not one run came within chemical accuracy: each settled in a local minimum far above the ground state. The method did not change. The starting point did.
This was the easy setting. The simulator had no noise and returned exact energies, so the optimiser never had to tell a small improvement from sampling error. On hardware both of those are added to the same landscape.
The classical solver was much faster at this size, and that is expected: ten qubits is far inside what full configuration interaction handles. VQE only has a case where the exact classical method runs out of memory, and there its own costs, measurements and optimisation, have grown too.
VQE next to the alternatives
| Method | Runs on | What limits it | Where it stands |
|---|---|---|---|
| VQE | Today's QPUs and simulators | Measurements for chemical accuracy; local minima and barren plateaus; gate noise in the ansatz | Molecules of up to six qubits[3] on hardware in 2017, a Hartree-Fock state on a dozen qubits[4] in 2020 |
| Quantum phase estimation | Error-corrected hardware | Circuit depth far beyond current devices; needs a good starting state | The long-term route for chemistry; demonstrated on a few logical qubits |
| Sample-based quantum diagonalization | Today's QPUs with a classical cluster | The quantum samples must hit the important configurations; the diagonalisation is classical | Circuits of up to 77 qubits and 10,570 gates[14] on iron-sulfur clusters, with classical methods still ahead on accuracy |
| Classical: CCSD(T), DMRG, full configuration interaction | A laptop to a supercomputer | Strong correlation in large active spaces | The method to beat. A 2023 study concluded that evidence for an exponential quantum advantage in ground-state chemistry has yet to be found[13] |
The chemistry overview has the numbers and sources for each row: quantum computing for chemistry.
Running VQE so that the result can be trusted
Keep an exact reference while you can
Up to about 14 qubits a dense diagonalisation gives the true ground-state energy of the same qubit Hamiltonian. Every choice below should be validated there before the system grows past it.
Start from a physical state
For a molecule, start from Hartree-Fock with small or zero amplitudes, not from random angles. Our lithium hydride run shows the difference this makes.
Check the ansatz can hold the answer
An ansatz that is too shallow converges cleanly to the wrong energy. Raise the repetitions or layers and see whether the energy moves.
Restart, and report all the runs
Several starting points and the spread of their final energies say more than the best single run. A result that appears in one start of five is a local minimum until shown otherwise.
Budget the shots before going to hardware
Count the measurement groups of the Hamiltonian and the shots each needs for the precision you want, and multiply by the number of energy evaluations the optimiser took on the simulator. If the product is not affordable, the hardware run will not converge either.
Compare with the classical method at the same size
Same molecule, same basis, same active space. If CCSD(T) or DMRG gives the answer in seconds, the VQE result is a test of the hardware, not a chemistry result.
Questions
What is VQE in quantum computing?
The variational quantum eigensolver is a hybrid algorithm that estimates the lowest eigenvalue of a Hamiltonian, usually the ground-state energy of a molecule. A quantum computer prepares a trial state with a parametrised circuit and measures its energy, and a classical optimiser adjusts the parameters to lower it.
How does VQE work?
The Hamiltonian is written as a sum of Pauli strings. A parametrised circuit, the ansatz, prepares a state; the expectation value of each Pauli string is measured over many shots and summed into an energy; a classical optimiser proposes new parameters. The loop repeats until the energy stops falling. By the variational principle the result is an upper bound on the true ground-state energy.
What is VQE used for?
Ground-state energies of small molecules and of lattice models such as the Hubbard model, and from them bond lengths, reaction energies and dissociation curves. The same loop with a different cost function is used for optimisation, where it is called QAOA, and for training quantum machine learning models.
Is VQE better than classical methods?
Not so far. Every molecule solved with VQE on hardware or on a simulator is solved faster and as accurately by classical methods such as coupled cluster or full configuration interaction. Resource analyses find that the number of measurements needed for chemical accuracy is the main obstacle to an advantage, even on an ideal device.
Why does VQE give the wrong energy?
Usually for one of three reasons: the ansatz cannot represent the ground state, the optimiser stopped in a local minimum, or the constant term of the Hamiltonian was left out. The optimiser reports success in all three cases. Compare with exact diagonalisation on a small system, start from the Hartree-Fock state, and repeat from several starting points.
What is the difference between VQE and QAOA?
Both are variational loops. VQE minimises the energy of a physical Hamiltonian with an ansatz chosen for the system. QAOA minimises a cost Hamiltonian that encodes an optimisation problem, with an ansatz that alternates between the cost and a mixing term. QAOA can be seen as VQE with a fixed, problem-derived ansatz.
What is the difference between VQE and quantum phase estimation?
VQE uses many short circuits and a classical optimiser, and its precision is limited by sampling: precision ε costs about 1/ε² shots per energy. Phase estimation uses one long coherent circuit and reaches precision ε with about 1/ε applications of the evolution, but it needs error-corrected hardware.
Does eigenkit implement VQE?
Yes. eigenkit.chemistry has a VQE solver with Jordan-Wigner and Bravyi-Kitaev mappings, UCCSD and hardware-efficient ansätze, random restarts and an exact reference for small systems. Model Hamiltonians run on the basic install; real molecules need PySCF from the chemistry extra.
Sources
- A. Peruzzo, J. McClean, P. Shadbolt, M.-H. Yung, X.-Q. Zhou, P. J. Love, A. Aspuru-Guzik, J. L. O'Brien. A variational eigenvalue solver on a photonic quantum processor. Nature Communications 5, 4213, 2014. arXiv:1304.3061.
- J. R. McClean, J. Romero, R. Babbush, A. Aspuru-Guzik. The theory of variational hybrid quantum-classical algorithms. New Journal of Physics 18, 023023, 2016. arXiv:1509.04279.
- A. Kandala, A. Mezzacapo, K. Temme, M. Takita, M. Brink, J. M. Chow, J. M. Gambetta. Hardware-efficient variational quantum eigensolver for small molecules and quantum magnets. Nature 549, 242–246, 2017. arXiv:1704.05018.
- F. Arute, K. Arya, R. Babbush, D. Bacon, J. C. Bardin, R. Barends, S. Boixo, M. Broughton et al. Hartree-Fock on a superconducting qubit quantum computer. Science 369, 1084–1089, 2020. arXiv:2004.04174.
- D. Wecker, M. B. Hastings, M. Troyer. Progress towards practical quantum variational algorithms. Physical Review A 92, 042303, 2015. arXiv:1507.08969.
- J. F. Gonthier, M. D. Radin, C. Buda, E. J. Doskocil, C. M. Abuan, J. Romero. Measurements as a roadblock to near-term practical quantum advantage in chemistry: resource analysis. Physical Review Research 4, 033154, 2022. arXiv:2012.04001.
- J. Tilly, H. Chen, S. Cao, D. Picozzi, K. Setia, Y. Li, E. Grant, L. Wossnig, I. Rungger, G. H. Booth, J. Tennyson. The variational quantum eigensolver: a review of methods and best practices. Physics Reports 986, 1–128, 2022. arXiv:2111.05176.
- M. Cerezo, A. Arrasmith, R. Babbush, S. C. Benjamin, S. Endo, K. Fujii, J. R. McClean, K. Mitarai et al. Variational quantum algorithms. Nature Reviews Physics 3, 625–644, 2021. arXiv:2012.09265.
- J. R. McClean, S. Boixo, V. N. Smelyanskiy, R. Babbush, H. Neven. Barren plateaus in quantum neural network training landscapes. Nature Communications 9, 4812, 2018. arXiv:1803.11173.
- L. Bittel, M. Kliesch. Training variational quantum algorithms is NP-hard. Physical Review Letters 127, 120502, 2021. arXiv:2101.07267.
- H. R. Grimsley, S. E. Economou, E. Barnes, N. J. Mayhall. An adaptive variational algorithm for exact molecular simulations on a quantum computer. Nature Communications 10, 3007, 2019. arXiv:1812.11173.
- J. Romero, R. Babbush, J. R. McClean, C. Hempel, P. J. Love, A. Aspuru-Guzik. Strategies for quantum computing molecular energies using the unitary coupled cluster ansatz. Quantum Science and Technology 4, 014008, 2018. arXiv:1701.02691.
- S. Lee, J. Lee, H. Zhai, Y. Tong, A. M. Dalzell, A. Kumar, P. Helms, J. Gray et al. Evaluating the evidence for exponential quantum advantage in ground-state quantum chemistry. Nature Communications 14, 1952, 2023. arXiv:2208.02199.
- J. Robledo-Moreno, M. Motta, H. Haas, A. Javadi-Abhari, P. Jurcevic, W. Kirby, S. Martiel, K. Sharma et al. Chemistry beyond the scale of exact diagonalization on a quantum-centric supercomputer. Science Advances 11, eadu9991, 2025. arXiv:2405.05068.
Run it yourself with eigenkit
eigenkit is EigenOrbit's open-source Python library: write a circuit once, run it on any simulator or QPU, and test it against a classical baseline on your own data before you invest in it or rule it out.
$ pip install eigenkit