Variational Quantum Eigensolver (VQE)¶
Many of the most important open problems in chemistry and materials science come down to one question: what is the lowest-energy configuration a quantum system can settle into? This page introduces the Variational Quantum Eigensolver (VQE), the algorithm most commonly used to attack that question on today's quantum hardware.
Assumed background
This page uses two ideas that don't have their own lesson yet in this module: a parameterized quantum circuit (a circuit whose gates depend on adjustable numbers) and measuring an expectation value (running a circuit many times and averaging the results). Enough of each is explained inline to follow the examples below — a fuller treatment belongs in earlier modules.
A Problem Too Big to Compute Directly¶
Every quantum system has a Hamiltonian \(H\), an operator whose eigenvalues are the energies the system can have, and a ground state \(|\psi_0\rangle\) — the lowest-energy configuration, with ground-state energy \(E_0\). Knowing \(E_0\) for a molecule tells you things like how stable it is or how it reacts.
For a small enough system, you can find \(E_0\) by directly diagonalizing \(H\). The catch is that \(H\)'s size grows exponentially with the number of qubits (or, physically, the number of interacting particles) needed to describe the system, so exact diagonalization stops being possible long before you reach a molecule anyone cares about.
What if, instead of computing the ground-state energy directly, you searched for it?
The Variational Principle¶
For any trial state \(|\psi(\theta)\rangle\) you can prepare, measuring its energy always gives a number greater than or equal to the true ground-state energy — an underestimate is never possible. So the lowest energy you can find by searching over \(\theta\) is a genuine, trustworthy bound, not a fluke. This is the "variational" in Variational Quantum Eigensolver: vary a trial state, and minimize what you measure.
The Ansatz: A Trial State You Can Tune¶
The circuit that prepares your trial state is called the ansatz. The example used throughout this page is about as simple as an ansatz gets: one qubit, one adjustable gate.
The gate \(RY(\theta)\) rotates the qubit by an angle \(\theta\) — the one adjustable parameter of this ansatz. Its trial state is \(|\psi(\theta)\rangle = \cos(\theta/2)|0\rangle + \sin(\theta/2)|1\rangle\).
To have something to measure, this page uses a small toy Hamiltonian:
This is a deliberately simplified stand-in for a real system's energy — a real molecule's Hamiltonian has far more terms, acting on far more qubits. But the shape of the problem is identical: prepare a trial state, measure its energy, adjust, repeat.
For this ansatz and this \(H\), the energy has an exact closed form:
Interactive: Explore the Energy Landscape¶
Drag the slider to try different values of \(\theta\) and watch the measured energy move along the curve below. The dashed line marks the true minimum — try to get the marker as close to it as you can, then let Step Downhill finish the job.
Try a few values of θ by hand, then let Step Downhill take over.
Step Downhill doesn't use any calculus — each click just checks a small step to either side of the current \(\theta\), moves toward whichever side has lower energy, and shrinks the step once neither side helps anymore. A classical optimizer does the same kind of thing, just with a more sophisticated strategy and, in real VQE, without being able to see the whole curve at once — only the energy at the point it's currently standing on.
The Hybrid Loop¶
In the demo above, you decided which way to move \(\theta\). In actual VQE, a classical optimizer does that automatically, based only on the energy it's just measured:
- The quantum computer prepares \(|\psi(\theta)\rangle\) using the ansatz circuit and the current \(\theta\).
- It's measured many times to estimate \(\langle \psi(\theta) | H | \psi(\theta) \rangle\) — a single measurement isn't enough; the expectation value comes from the statistics of many repeated runs.
- A classical optimizer looks at that measured energy and proposes a new \(\theta\) expected to lower it.
- Repeat until the energy stops improving.
Notice the division of labor: the quantum computer only ever does two things — prepare a state and get measured — using a circuit that stays short no matter how many iterations it takes. The classical computer does all of the iterative searching, on hardware that's cheap, reliable, and easy to scale.
Interactive: Run the Hybrid Loop¶
This time, step through the loop itself. The classical optimizer's proposed angles are scripted here — the point is to see the shape of the loop, not to control it by hand.
Iteration: 0
Click Prepare to begin the first iteration.
What VQE Is Good For (and Isn't)¶
- ✓ Uses short, shallow circuits — feasible on today's noisy ("NISQ") hardware
- ✓ Tends to produce reasonable energy estimates even when the hardware itself is noisy
- ✗ Not guaranteed to find the true global minimum — the search can get stuck partway down
- ✗ Needs many repeated circuit runs per iteration, and many iterations, to converge
Preview: local minima and barren plateaus
Getting stuck away from the true minimum, or having the energy landscape become too flat to navigate as systems grow larger, are real practical challenges for VQE. The details are left for a later, deeper treatment — for now it's enough to know the search isn't always as smooth as our one-parameter toy example.
Compare this to Shor's Algorithm or Grover's Algorithm: those need long, precise, fully fault-tolerant circuits to work at all — run them on today's noisy hardware and they simply fail. VQE was designed the opposite way: keep the quantum circuit as short as possible, and let a classical computer absorb as much of the difficulty as it can. That tradeoff — approximate answers now, instead of exact answers later — is what makes VQE one of the leading algorithms for near-term quantum hardware, aimed at problems, like large-molecule ground-state energies, that stay completely out of reach for classical computers no matter how much noise is involved.
Takeaway¶
VQE's pattern — guess, measure, adjust, repeat — is the blueprint for a whole family of near-term quantum algorithms. What changes from one to the next is the problem, the ansatz, and what's being measured.
What if, instead of a molecule's energy, the number you're trying to minimize described how good a solution is to a combinatorial choice — like how to split up a graph into two groups? That's the idea behind QAOA.