Training and barren plateaus
In Variational circuits you trained a one-parameter model by following its gradient downhill. That works when there is a slope to follow. This lesson is about the discovery that for many large circuits there is almost none, and about what that does to the prospects of training them.
The landscape and the cost of seeing it
Section titled “The landscape and the cost of seeing it”Collect all the trainable angles into a list . The quantity being minimised, the cost , is some expectation value measured at the end of the circuit. Picture it as a landscape over the space of angles. Training means walking downhill, and the gradient says which way is down.
On a quantum computer the gradient is never known exactly. Each expectation value is an average over repeated runs, or shots, and an average over shots has a statistical error of about . To see a gradient of size at all, the error has to be smaller than , which takes roughly
shots, for each parameter, at each step.
A gradient component has size about 0.001. Roughly how many shots does it take to tell it from zero?
. With fewer shots the estimate is mostly noise, and its sign, which is all that says which way is downhill, is close to a coin flip.
So the size of a typical gradient is not a detail. It sets the bill.
What a barren plateau is
Section titled “What a barren plateau is”Pick the angles of a circuit at random. Each component of the gradient is then a random number, and for the circuits considered here its average is zero: uphill is as likely as downhill. The useful question is how large it typically is, which is measured by its variance.
In 2018 McClean and co-workers showed that for circuits which are deep and unstructured enough to behave like random unitaries, the variance of every gradient component shrinks exponentially with the number of qubits :
Such a landscape is flat almost everywhere, with the interesting valleys occupying a vanishing fraction of it. This is a barren plateau. Fifty qubits would mean gradients around , and by the formula above something like shots to detect one.
Here is the reason in outline. A random state of qubits is spread thinly over basis states. Measure any fixed observable on it and the answer is almost always very close to the average over all states, with fluctuations of order . If the cost is nearly the same number at almost every point of the landscape, the slopes between those points must be tiny as well. This is the effect that made kernel values concentrate in the last lesson, appearing in a different place.
See it
Section titled “See it”The simulator draws random circuits, computes one gradient component for each by the parameter-shift rule, and plots the variance against the number of qubits. The vertical axis is logarithmic, so exponential decay shows as a straight line sloping down.
Each layer applies RY and RZ with random angles to every qubit, then CZ gates around a ring. For each point on the plot, 200 random circuits are drawn and the derivative with respect to the first angle is computed by the parameter-shift rule.
- 2 layers, cost = ⟨Z⟩ on one qubit
- 2 layers, cost = probability that all qubits read 0
- 3n layers, cost = ⟨Z⟩ on one qubit
Press the button and compare the three lines.
- Deep circuit, one-qubit cost (purple). The variance falls by roughly half for every qubit added. This is the barren plateau of the formula above.
- Two layers, one-qubit cost (blue). The variance stays near 0.3 however many qubits there are. A shallow circuit cannot spread the state over the whole space, and the measured qubit is only influenced by its neighbours.
- Two layers, all-qubit cost (orange). The circuit is just as shallow, yet the variance falls even faster than in the deep case.
Eight qubits is as far as a quick simulation in a browser goes, and at that size the gradients are still easy to measure. The point is the trend. A straight line on this plot keeps going.
The cost function matters
Section titled “The cost function matters”The orange line shows that depth is not the only cause. That cost is the probability that all qubits read 0. Such a cost is called global, because it depends on every qubit at once. For a state with no special relation to , that probability is a product of numbers smaller than one, so it is exponentially small, and so is its slope.
A local cost is built from terms that each involve only a few qubits, like the on one qubit in the blue and purple lines. Cerezo and co-workers showed in 2021 that with a local cost, a circuit whose depth grows only logarithmically with keeps gradients that vanish at worst polynomially, while a global cost gives a barren plateau even at constant depth.
Many natural-sounding training objectives are global: “make the output state equal to this target state” is one. They can often be replaced by a local cost with the same minimum.
Four circuits on 40 qubits start from random angles. Which one has the largest gradients?
Shallow depth with a local cost is the combination that keeps gradients large. A global cost produces a plateau even when the circuit is shallow, and great depth produces one whatever the cost.
Other roads to the same place
Section titled “Other roads to the same place”Later work found that plateaus arise in several ways besides random depth.
- Noise. If every layer of gates adds a little noise, a deep circuit’s output drifts towards the maximally mixed state whatever the angles are. The landscape flattens, and the minimum itself is washed out. Unlike the other kinds, this one cannot be avoided by a clever starting point.
- Entanglement. If the measured qubits are highly entangled with the rest, their reduced state is close to maximally mixed, as in Density matrices, and carries little signal.
- Expressibility. The more of the full state space a circuit family can reach, the closer it comes to the random-unitary behaviour that causes the plateau.
One cause is not on the list: the optimiser. The slope is absent from the landscape itself, so switching to an optimiser that does not use gradients does not bring it back. Those methods compare values of the cost at nearby points, and the differences between those values are exponentially small too.
If gradients are tiny, why not simply multiply them by a large learning rate?
Scaling up a number does not improve its signal-to-noise ratio. The cost of a barren plateau is the number of shots needed to learn which way is downhill.
What helps, and the catch
Section titled “What helps, and the catch”Barren plateaus are a statement about unstructured circuits started at random points. That leaves ways out.
- Problem-specific circuits. Use few gates, arranged to respect the structure or symmetries of the problem, so the circuit explores a small relevant corner of the state space.
- Careful starting points. Begin near the identity, or from a known approximate solution, where the landscape is not typical.
- Layer-by-layer training. Train a shallow circuit first and then grow it.
- Local costs, as above.
All of these are in use, and they do help at the sizes tested so far. Two cautions go with them.
First, avoiding a plateau does not make training easy. Landscapes can also be full of poor local minima, a separate problem with its own hardness results.
Second, and more awkward: the reason a circuit family provably avoids plateaus is usually that it stays inside a small, well-understood part of the state space, and small, well-understood parts of state space are what classical computers are good at simulating. A 2023 study by Cerezo and many co-authors examined the known plateau-free families and argued that for most of them the cost function can be computed classically, sometimes after an initial stage of collecting data from the quantum device. This is an observation about the known cases together with a conjecture, not a theorem, and warm starts and other untypical regions of the landscape are not covered by it. But it frames the difficulty clearly. A variational model has to be structured enough to train, and unstructured enough that a classical computer cannot do the same job.
That tension returns in the last lesson of this track. First, the next lesson looks at the two best-known variational algorithms, which use the same training loop for problems that have no data to load.
Remember it
Section titled “Remember it”What is a barren plateau?
A cost landscape in which the gradient is exponentially small in the number of qubits almost everywhere. Its variance shrinks roughly like for deep unstructured circuits.
Roughly how many shots does it take to detect a gradient of size ?
About , because the statistical error of an average over shots is about .
What is the difference between a global and a local cost function, and why does it matter?
A global cost depends on all qubits at once and has a barren plateau even for shallow circuits. A local cost is a sum of few-qubit terms and keeps usable gradients at shallow depth.
Name three causes of barren plateaus.
Deep unstructured (highly expressive) circuits, global cost functions, and hardware noise. Too much entanglement is a fourth.
What is the catch with circuits designed to avoid barren plateaus?
The structure that keeps their gradients large often also makes them efficient to simulate classically.
Does a gradient-free optimiser escape a barren plateau?
No. The landscape itself is flat, so differences in cost between nearby points are exponentially small too.