Technical report · bp-from-scratch

Barren Plateaus from Scratch

A NumPy State-Vector Study of Trainability in Variational Quantum Circuits

bp-from-scratch v0.1.0 · NumPy state-vector simulator · 2–16 qubits · experiments E0–E7 · every point cached in results/

Abstract

Barren plateaus — gradients whose variance vanishes exponentially in the number of qubits — are the central obstacle to training variational quantum circuits. We present a small, fully auditable state-vector simulator written in NumPy (about 500 lines, exact adjoint gradients, validated against independent references and PennyLane) and use it to reproduce and extend the main results of the barren-plateau literature on 22–1616 qubits. We derive closed-form Haar (unitary 2-design) values for the gradient variance with the circuit before and/or after a rotation drawn at random, and verify them numerically to within sampling error. With these references we measure how a hardware-efficient ansatz approaches the 2-design value as a function of depth and find that (i) the approach is non-monotonic, (ii) the gradient distribution is strongly heavy-tailed at shallow depth (kurtosis up to ∼80\sim 80) and becomes Gaussian only where the variance saturates, and (iii) the variance saturates at a depth where the half-chain entanglement entropy of the output state is still less than half of the Page value. We confirm the cost-function dependence of Cerezo et al. (global costs decay as 4−n4^{-n}, local costs much more slowly), compare small-angle and identity-block initialisations, and show that with exact gradients Adam prepares |0⟩⊗n|0\rangle^{\otimes n} through a global cost even at n=14n=14 where ∥∇C∥≈10−4\|\nabla C\|\approx 10^{-4}, whereas with 10410^4-shot gradient noise the same optimisation fails progressively beyond n=10n=10 while the local cost keeps succeeding. QAOA for MaxCut on random 3-regular graphs shows no plateau at fixed depth. Finally, we compute dynamical Lie algebras (DLAs) exactly for four ansatz families and test the Lie-algebraic prediction Var[C]=𝒫𝔤(ρ)𝒫𝔤(H)/dim⁡𝔤\mathrm{Var}[C]=\mathcal P_\mathfrak{g}(\rho)\mathcal P_\mathfrak{g}(H)/\dim\mathfrak{g} of Ragone et al.: it holds to within 10% for the three families that reach the 2-design regime, including a hardware-efficient family whose DLA turns out to be 𝔰𝔬(2n)\mathfrak{so}(2n), of polynomial dimension n(2n−1)n(2n-1). Every figure in this report is regenerated by a single script.

Results at a glance

Headline numbers, generated from the results files.

1 Introduction

Variational quantum algorithms (VQAs) optimise the parameters θ\theta of a quantum circuit U(θ)U(\theta) to minimise a cost C(θ)=⟨0|U(θ)†HU(θ)|0⟩C(\theta)=\langle 0|U(\theta)^\dagger H U(\theta)|0\rangle. McClean et al. [1] showed that for circuits that are random enough to form unitary 2-designs, the gradient of CC has mean zero and a variance that shrinks exponentially with the number of qubits nn — a barren plateau (BP). A large literature has since characterised when plateaus occur: they depend on the locality of the cost [2], on the entanglement of the states the ansatz produces [3], on how parameters are initialised [4, 5], and, most generally, on the dimension of the dynamical Lie algebra (DLA) generated by the circuit [6, 7, 8]; see [9] for a review.

These results are precise and quantitative, and most of them can be tested on 22–1616 qubits with a few hundred thousand cheap gradient evaluations. This report does exactly that, with two goals. The first is pedagogical and engineering-oriented: a transparent simulator with exact analytic gradients that fits in a few hundred lines, is verified against independent references and against an established library, and runs every experiment reported here on a single CPU core in under an hour. The second is scientific: to put the main theoretical predictions side by side with controlled numerics and to report the quantitative discrepancies and non-obvious behaviours that appear in the process.

Contributions.

  1. Simulator. A NumPy state-vector simulator (qsim) with in-place gate application, fast paths for diagonal and controlled gates, parameter-shift and adjoint-mode gradients supporting shared and scaled parameters (Sec. 3). It is 2–8×\times faster than PennyLane’s default.qubit for the circuits used here, and returns the full gradient of 320 parameters at n=16n=16 in 0.660.66 s.

  2. Closed-form references. Haar-average gradient variances for a rotation with a 2-design before, after, or on both sides (Appendix A), verified numerically (Table 5).

  3. Approach to the plateau. The variance of a hardware-efficient ansatz converges to the two-sided Haar value non-monotonically with depth; the gradient distribution is heavy-tailed until it does; and the variance saturates long before the output entanglement does (Secs. 5.1–5.2).

  4. Reproductions with quantified discrepancies. Cost locality (Sec. 5.3), initialisation strategies (Sec. 5.4), QAOA (Sec. 5.6).

  5. Plateaus versus optimisation. With exact gradients Adam is insensitive to the plateau at these sizes; with realistic shot noise it is not (Sec. 5.5).

  6. Lie-algebraic check. Exact DLA dimensions and 𝔤\mathfrak{g}-purities for four ansatz families, compared with the variance of deep circuits (Sec. 5.7).

2 Background and conventions

A parameterised circuit is a product U(θ)=UM⋯U1U(\theta)=U_M\cdots U_1 of fixed gates and rotations Uk=exp⁡(−iakGk/2)U_k=\exp(-i\,a_k G_k/2) with Hermitian, involutory generators (Gk2=𝟙G_k^2=\mathbb 1: Pauli strings). The angle aka_k is either fixed or ak=skθp(k)a_k=s_k\theta_{p(k)}, so that one parameter may drive several gates (as in QAOA) with a scale sks_k. Qubit 00 is the most significant bit and rotations follow the exp⁡(−iaG/2)\exp(-iaG/2) convention of PennyLane and Qiskit. Because every generator is involutory, CC is a sinusoid in every gate angle and the parameter-shift rule is exact, ∂C∂ak=12[C(ak+π2)−C(ak−π2)].(1)\begin{equation} \frac{\partial C}{\partial a_k} = \tfrac12\big[C(a_k+\tfrac\pi2)-C(a_k-\tfrac\pi2)\big].\qquad\text{(1)} \end{equation} In simulation the whole gradient is obtained with O(M)O(M) state-vector operations by the adjoint method [10] (Appendix B).

Barren plateaus.

For a rotation UkU_k write U(θ)=ULUkURU(\theta)=U_L U_k U_R. If ULU_L and URU_R are independent unitary 2-designs, 𝔼[∂kC]=0\mathbb{E}[\partial_k C]=0 and, as derived in Appendix A, Var[∂kC]=dTrH2−(TrH)22(d+1)2(d−1),d=2n.(2)\begin{equation} \mathrm{Var}[\partial_k C] = \frac{d\,\mathrm{Tr}H^2-(\mathrm{Tr}H)^2}{2(d+1)^2(d-1)},\qquad d=2^n .\qquad\text{(2)} \end{equation} For a traceless Pauli string HH this is ≈1/(2d)=2−n/2\approx 1/(2d)=2^{-n}/2; for the projector H=|0⟩⟨0|⊗nH=|0\rangle\langle0|^{\otimes n} it is ≈4−n/2\approx 4^{-n}/2. If only one side is a 2-design the variance is still O(2−n)O(2^{-n}) [1]; the exact one-sided values are Eqs. (7)–(8). Cerezo et al. [2] proved for alternating-layered ansätze that a global cost (an operator acting non-trivially on all qubits) has exponentially small gradients at any depth, while a local cost (a sum of few-body terms) has gradients bounded below by 1/poly(n)1/\mathrm{poly}(n) for depth L∈O(log⁡n)L\in O(\log n). Ortiz Marrero et al. [3] connected plateaus to the entanglement between the measured and unmeasured qubits. Grant et al. [4] proposed initialising in blocks that compose to the identity, and Zhang et al. [5] proposed small-angle Gaussian initialisations. Finally, the Lie-algebraic theory [6, 7, 8] states that for deep circuits (a 2-design on e𝔤e^{\mathfrak{g}}) and ρ\rho or HH in i𝔤i\mathfrak{g}, Var[C]=𝒫𝔤(ρ)𝒫𝔤(H)dim⁡𝔤,𝒫𝔤(X)=∥X𝔤∥F2,(3)\begin{equation} \mathrm{Var}[C]=\frac{\mathcal P_\mathfrak{g}(\rho)\,\mathcal P_\mathfrak{g}(H)}{\dim\mathfrak{g}},\qquad \mathcal P_\mathfrak{g}(X)=\|X_\mathfrak{g}\|_F^2,\qquad\text{(3)} \end{equation} where X𝔤X_\mathfrak{g} is the orthogonal projection of XX onto the DLA 𝔤\mathfrak{g}; for 𝔤=𝔰𝔲(d)\mathfrak{g}=\mathfrak{su}(d) Eq. (3) reduces to the Haar value Var[C]=TrH2/(d(d+1))\mathrm{Var}[C]=\mathrm{Tr}H^2/(d(d+1)) for traceless HH.

3 The simulator

Representation.

The state is a flat, contiguous complex128 array of 2n2^n amplitudes. A single-qubit gate on qubit qq is applied by viewing the array as a (2q,2,2n−q−1)(2^q,2,2^{n-q-1}) tensor and combining the two slices along the middle axis; a two-qubit gate uses a (2lo,2,⋅,2,2n−hi−1)(2^\mathrm{lo},2,\cdot,2,2^{n-\mathrm{hi}-1}) view and the four slices indexed by the two qubit bits. No 2n×2n2^n\times 2^n matrix is ever formed. Diagonal gates multiply slices in place; CNOT and CZ are a slice swap and a sign flip. A generic kk-qubit gate falls back to tensordot. Pauli strings are applied letter by letter, which makes Pauli-sum expectation values and H|ψ⟩H|\psi\rangle cheap.

Gradients.

qsim implements Eq. (1) (shifting one gate occurrence at a time, so shared parameters are handled by summation) and the adjoint method. Both are checked against central finite differences on circuits with shared and scaled parameters, fixed gates, and generic two-qubit unitaries; they agree to 10−1010^{-10}.

Verification.

Fifty-eight tests compare gate application with an independent tensordot/moveaxis implementation and with Kronecker-product matrices, check Bell/GHZ states, Pauli-sum operators against dense matrices, entanglement entropies against Bell/GHZ/Page values, the Pauli algebra used for DLAs against matrix products, and — when PennyLane is installed — states, expectation values and parameter-shift gradients of a 13-parameter circuit against default.qubit (agreement to 10−810^{-8}).

Performance.

Table 1 lists wall-clock times on one CPU core for a hardware-efficient ansatz (RY, RZ on every qubit and a CNOT ladder, L=10L=10). The adjoint gradient costs ≈4\approx 4–55 forward passes independently of the number of parameters; the parameter-shift gradient costs 2P2P forward passes and is only used for cross-checks.

Table 1. Forward pass of a 10-layer hardware-efficient ansatz (2nL2nL parameters) and its full gradient; PennyLane 0.45 forward passes for the same circuit. Single core, NumPy 2.5, Python 3.12. lightning.qubit is a compiled C++ backend.
qsim PennyLane, forward pass
nn forward adjoint gradient parameter shift default.qubit lightning.qubit
8 2.5 ms 11 ms 0.83 s 19 ms 9 ms
12 9.3 ms 34 ms – 35 ms 15 ms
16 0.13 s 0.66 s – 0.28 s 0.035 s
18 0.48 s 4.2 s – 1.3 s 0.11 s

4 Experimental protocol

Ansätze.

(i) The random circuit of McClean et al. [1] (“McClean HEA”): a fixed layer of RY(π/4)R_Y(\pi/4), then LL layers each consisting of one rotation per qubit about an axis drawn uniformly from {X,Y,Z}\{X,Y,Z\} and a CZ ladder on the open chain; the axes are redrawn for every sample. (ii) The RY–RZ hardware-efficient ansatz: RYR_Y and RZR_Z on every qubit followed by a CZ ladder (“RY–RZ HEA”) or by CZs in a brick pattern (“ALA”, the alternating-layered ansatz of [2]). (iii) Identity blocks [4]: MM blocks B(θ′)A(θ)B(\theta')A(\theta) with A=[RYRZ]CZ[RYRZ]A=[R_YR_Z]\,\mathrm{CZ}\,[R_YR_Z], B=A†B=A^\dagger at initialisation. (iv) QAOA for MaxCut [12]: |+⟩⊗n|+\rangle^{\otimes n} followed by pp layers of e−iγ∑EZiZje−iβ∑iXie^{-i\gamma\sum_E Z_iZ_j}e^{-i\beta\sum_i X_i}. (v) Fully parameterised Pauli-rotation circuits for the DLA study (Sec. 5.7).

Costs.

H=Z⊗nH=Z^{\otimes n} (global, traceless); |0⟩⟨0|⊗n|0\rangle\langle0|^{\otimes n} (global projector); 12n∑iZi\tfrac{1}{2n}\sum_iZ_i and 1n∑iXi\tfrac1n\sum_iX_i (local); the cut operator ∑(i,j)∈E12(1−ZiZj)\sum_{(i,j)\in E}\tfrac12(1-Z_iZ_j); and the chain ∑iZiZi+1\sum_iZ_iZ_{i+1}.

Statistics.

For every configuration we draw NN random parameter vectors (uniform on [0,2π)[0,2\pi) unless stated) and compute the full gradient. We report the variance of the derivative with respect to a probe parameter in the middle layer and middle qubit (∂mid\partial_\mathrm{mid}), which has random circuit on both sides, and sometimes of the first-layer parameter (∂first\partial_\mathrm{first}). Error bars are 95% percentile-bootstrap intervals of the variance (400 resamples). Decay exponents are least-squares slopes of log⁡2Var\log_2\mathrm{Var} against nn over n≥6n\ge6. N=300N=300 for n≤14n\le14 in E1 and E4, N=200N=200 for n=16n=16 (N=100N=100 for L≥20L\ge20 at n=16n=16), N=200N=200 in E2, E3, E6 and N=400N=400 forward passes in E7. All seeds are fixed; make results regenerates every number in this report.

5 Results

5.1 E1: approach to the two-sided Haar value

Figure 1. McClean HEA, H=Z⊗nH=Z^{\otimes n}. (a) Variance of the middle-layer derivative versus nn for depths L=2L=2–5050; the dashed line is Eq. (2). (b) The same data divided by Eq. (2), versus depth. (c) Kurtosis 𝔼[g4]/𝔼[g2]2\mathbb{E}[g^4]/\mathbb{E}[g^2]^2 of the same derivative; a Gaussian has kurtosis 3.
Table 2. E1: fitted decay exponents of log⁡2Var\log_2\mathrm{Var} versus nn (n≥6n\ge6) for the middle-layer derivative and for the variance averaged over all parameters; the ratio of the measured variance to the two-sided Haar value and the kurtosis of the middle-layer derivative, both at n=16n=16.
decay exponent of log⁡2Var\log_2\mathrm{Var} at n=16n = 16
depth LL ∂midC\partial_\mathrm{mid}C mean over parameters Var/Haar kurtosis
2 −0.98-0.98 −0.97-0.97 2.732.73 55.455.4
5 −0.97-0.97 −1.02-1.02 1.291.29 76.876.8
10 −1.00-1.00 −1.05-1.05 0.620.62 20.620.6
20 −1.01-1.01 −1.00-1.00 0.710.71 3.43.4
50 −1.01-1.01 −1.00-1.00 0.900.90 3.13.1
Haar (two-sided) −0.99-0.99 – 1 3

Figure 1(a) shows the classic picture: at every depth the variance decays as 2−n2^{-n} — the fitted exponents in Table 2 lie between −0.97-0.97 and −1.01-1.01, against −0.99-0.99 for Eq. (2) — and the deepest circuits sit on the two-sided Haar prediction (at L=50L=50 the ratio to Eq. (2) is 0.950.95, 1.131.13, 1.041.04, 0.900.90, 0.900.90 for n=8,10,12,14,16n=8,10,12,14,16). Three features are less familiar.

Non-monotonic approach. Panel (b) shows that the ratio to the Haar value does not decrease monotonically from above. At L=2L=2 the probe sits in the last layer, where one third of the rotations are about ZZ and commute with HH, so the derivative vanishes exactly for one third of the samples; the remaining samples are large, and the variance exceeds the Haar value. At L=5L=5 and L=10L=10 the variance undershoots the Haar value by a factor of ≈1.5\approx 1.5–22 for n≥10n\ge 10 (e.g. 0.460.46 at n=12n=12, L=5L=5; 0.600.60 at n=14n=14, L=5L=5), and then converges from below between L=20L=20 and L=50L=50. Nothing forbids this: an ensemble that is not a 2-design may have a second moment smaller or larger than Haar’s, and the shallow McClean ensemble, with its ZZ-rotations that commute with the CZ ladder, is less random than its gate count suggests.

Heavy tails. Panel (c) is, to our knowledge, not usually shown: at shallow depth the derivative distribution has kurtosis 20–80 (and an atom at zero), so variance estimates from a few hundred samples carry wide confidence intervals, which the error bars in (a,b) reflect. The kurtosis drops to the Gaussian value 3 between L=10L=10 and L=20L=20 for n≥10n\ge10 — exactly where the variance reaches its plateau — and it does so earlier for larger nn. Kurtosis is therefore a convenient, essentially free diagnostic of whether a circuit ensemble has reached the 2-design regime.

Per-position dependence. The variance of the first- and last-layer derivatives differs from the middle one by O(1)O(1) factors that are predicted by the one-sided formulas of Appendix A (e.g. Var[∂lastC]→23(d+1)−1\mathrm{Var}[\partial_\mathrm{last}C]\to\tfrac{2}{3}\,(d+1)^{-1} for the random-axis ensemble, because the ZZ-axis samples contribute zero), while the exponent is the same.

5.2 E4: gradient variance saturates before entanglement does

Figure 2. (a) McClean HEA at n=12n=12 on a fine depth grid: variance of ∂midC\partial_\mathrm{mid}C divided by Eq. (2), and half-chain entanglement entropy of U(θ)|0⟩U(\theta)|0\rangle divided by the Page value SPage=3.66S_\mathrm{Page}=3.66 nats. (b) Half-chain entropy versus nn for the depths of E1; the dashed line is the exact Page value [11].

Entanglement-induced plateaus [3] suggest looking at the two quantities together. Figure 2(a) shows, at n=12n=12, that the variance is statistically indistinguishable from the Haar value from L≈16L\approx16–2424 onwards (ratios 0.980.98, 1.011.01, 0.910.91, 1.041.04, 1.001.00 at L=16,24,32,50,75L=16,24,32,50,75), whereas the half-chain entropy at L=16L=16 is only 1.351.35 nats, 37% of the Page value, and reaches 96% of it only at L=75L=75 (99% at L=100L=100, where the variance ratio is 0.990.99). Panel (b) shows the same across nn: at L=10L=10 the entropy is far from Page for every n≥8n\ge8 while the variance already decays as 2−n2^{-n}. The gradient of a global cost thus sees “enough” randomness much earlier than the bipartite entanglement does; the second moment of the ensemble converges faster than its Page-curve statistics. Conversely, large entanglement is not needed for a plateau in this cost.

5.3 E2: cost-function dependence

Figure 3. ALA (RY–RZ rotations, CZ bricks). Variance of the middle-layer derivative for (a) the global projector cost and (b) the local cost, versus nn for depths L=1L=1–1616. Dashed: two-sided Haar values, Eq. (2), for each operator.

Figure 3 reproduces the central result of [2]. For the projector cost the fitted exponents are −1.6-1.6 to −2.1-2.1 (approaching the 4−n4^{-n} Haar scaling with depth), and already at L=1L=1 the variance is 5×10−85\times10^{-8} at n=14n=14. For the local cost the exponents are −0.29-0.29 to −0.52-0.52: the decay is far slower than 2−n2^{-n} at all depths studied and the variance at n=14n=14, L=16L=16 is 2.2×10−52.2\times10^{-5}, four orders of magnitude above the global cost at the same size. The local-cost variance also lies well above its own Haar value (dashed) at every depth, i.e. these brick circuits are far from 2-designs for a local observable even at L=16L=16; the slow drift of the local exponent with LL is consistent with the O(log⁡n)O(\log n)-depth window of [2].

5.4 E3: initialisation strategies

Figure 4. RY–RZ HEA with 20 CZ layers, local cost 1n∑iXi\tfrac1n\sum_iX_i. Mean-square derivative 𝔼[(∂C)2]\mathbb{E}[(\partial C)^2] at initialisation for (a) the first-layer and (b) the middle-layer parameter, for uniform angles, Gaussian angles of width σ\sigma, and the identity-block construction (10 blocks).

We report the mean square rather than the variance because the identity-block initialisation gives a deterministic first-layer derivative: with every block equal to the identity, B∂aA=A1†∂aA1B\,\partial_aA=A_1^\dagger\partial_aA_1 for a gate in the first half-layer, so ∂aC=1/n\partial_aC=1/n exactly for every random draw (variance zero, magnitude 1/n1/n). Figure 4 shows that small-angle initialisations help as advertised [5]: at n=14n=14 the mean-square first-layer derivative is 9×10−59\times10^{-5} for uniform angles, 1.8×10−41.8\times10^{-4} for σ=0.1\sigma=0.1 and 1.2×10−31.2\times10^{-3} for σ=0.3\sigma=0.3, with fitted exponents −0.60-0.60 (uniform), −0.51-0.51 (σ=1\sigma=1), −0.36-0.36 (σ=0.3\sigma=0.3) and −0.35-0.35 (σ=0.1\sigma=0.1). The identity-block curve decays as 1/n21/n^2 by construction. Two caveats: with this local cost and L=20L=20 even the uniform initialisation decays with an exponent well above −1-1 (cf. Sec. 5.3), and a large gradient at θ=0\theta=0 says nothing about the landscape a few steps later, which is the regime that matters [9].

5.5 E5: plateaus versus optimisation

Figure 5. Preparing |0⟩⊗n|0\rangle^{\otimes n} with a 4-layer ALA and Adam (250 steps, learning rate 0.05) from uniformly random angles. (a) Final fidelity (mean ±\pm s.d. over seeds) for the global and local cost, with exact gradients and with Gaussian “shot noise” of standard deviation (2×104)−1/2(2\times10^4)^{-1/2} added to every cost and gradient entry. (b) Every run: exact initial gradient norm versus final fidelity.
Table 3. E5 summary. 16 seeds for exact gradients (10 for the local cost at n=14n=14), 12 seeds with shot noise.
nn 4 6 8 10 12 14
global cost, exact gradients
  mean fidelity 1.000 1.000 1.000 1.000 1.000 1.000
  fraction with F>0.9F>0.9 1.00 1.00 1.00 1.00 1.00 1.00
  mean ∥∇C∥\|\nabla C\| at initialisation 0.16 0.046 0.028 0.0045 0.0022 0.00015
local cost, exact gradients
  mean fidelity 1.000 1.000 1.000 1.000 1.000 1.000
  fraction with F>0.9F>0.9 1.00 1.00 1.00 1.00 1.00 1.00
  mean ∥∇C∥\|\nabla C\| at initialisation 0.24 0.19 0.16 0.14 0.13 0.12
global cost, 10410^4 shots
  mean fidelity 0.999 0.999 0.999 0.916 0.746 0.250
  fraction with F>0.9F>0.9 1.00 1.00 1.00 0.92 0.75 0.25
local cost, 10410^4 shots
  mean fidelity 0.998 0.994 0.991 0.984 0.974 0.967
  fraction with F>0.9F>0.9 1.00 1.00 1.00 1.00 1.00 1.00

A plateau at initialisation does not by itself prevent a classical simulation from training. With exact gradients, Adam — whose update is approximately scale-invariant — reaches fidelity >0.9999>0.9999 for both costs at every n≤14n\le14, including the global cost at n=14n=14 where the initial gradient norm is 1.5×10−41.5\times10^{-4} (Table 3, Fig. 5). The plateau becomes an obstacle when gradients must be estimated: adding Gaussian noise equivalent to 10410^4 shots per expectation value, the global-cost optimisation degrades from mean fidelity 0.9990.999 (n≤8n\le8) to 0.920.92 (n=10n=10), 0.750.75 (n=12n=12) and 0.250.25 (n=14n=14), while the local cost stays at 0.970.97–0.9980.998 with every run above 0.90.9. Panel (b) makes the mechanism explicit: failures occur exactly for the runs whose exact initial gradient norm lies below the noise level σP\sigma\sqrt{P}. In other words, the operational content of a barren plateau is the exponential number of measurements needed to resolve the gradient, not an intrinsic failure of gradient descent.

5.6 E6: a problem-inspired ansatz — QAOA for MaxCut

Figure 6. (a) Variance of ∂C/∂γ1\partial C/\partial\gamma_1 for QAOA on random 3-regular graphs (new graph and parameters for every sample; cost normalised by |E|=3n/2|E|=3n/2) versus nn for depths p=1p=1–88, compared with the McClean HEA at L=5L=5 and 1010 from E1. (b) Approximation ratio reached by Adam (150 steps) at n=10n=10 versus pp, for 3 graphs and 4 random starts each.

For the HEA the normalised variance decays with exponent −1-1; for QAOA at fixed depth the fitted exponents are −0.02-0.02 (p=1p=1), −0.05-0.05 (p=2p=2 and 44) and −0.15-0.15 (p=8p=8): no plateau at fixed depth, consistent with the parameter-concentration results for QAOA and with its small DLA (Sec. 5.7). The price is expressivity: the approximation ratio at n=10n=10 grows from 0.800.80 at p=1p=1 to 0.960.96 at p=4p=4 and 0.980.98 at p=8p=8 (best of four starts; the mean over starts saturates at 0.950.95 because local optima appear at p=8p=8).

5.7 E7: dynamical Lie algebras

Figure 7. (a) Exact DLA dimension versus nn for the four fully parameterised families; dashed: dim⁡𝔰𝔲(2n)=4n−1\dim\mathfrak{su}(2^n)=4^n-1. (b) Variance of the cost over uniformly random parameters of a 60-layer circuit (400 samples) versus the prediction of Eq. (3).
Table 4. E7: DLA dimensions and the ratio of the measured to the predicted cost variance.
family / nn 2 3 4 5 6 7 8 9 10
DLA dimension
  4n−14^n-1 15 63 255 1023 4095 16383 65535 262143 1048575
  HEA {Xi,Yi,ZiZi+1}\{X_i,Y_i,Z_iZ_{i+1}\} 15 63 255 1023 4095 16383 – – –
  HEA {Yi,ZiZi+1}\{Y_i,Z_iZ_{i+1}\} 6 15 28 45 66 91 120 – –
  QAOA MaxCut – – 15 – 176 – – – –
  HVA TFIM 4 9 16 25 36 49 64 81 100
measured / predicted Var[C]\mathrm{Var}[C]
  HEA {Xi,Yi,ZiZi+1}\{X_i,Y_i,Z_iZ_{i+1}\} 1.09 0.94 1.04 0.96 1.11 0.89 – – –
  HEA {Yi,ZiZi+1}\{Y_i,Z_iZ_{i+1}\} 1.00 1.08 1.02 1.03 1.06 0.94 0.98 – –
  QAOA MaxCut – – 0.60 – 0.59 – – – –
  HVA TFIM 0.32 1.22 0.86 1.00 1.00 1.03 0.91 1.03 0.94

We consider four families whose gates are all Pauli rotations with their own parameters unless stated: (a) {Xi,Yi,ZiZi+1}\{X_i,Y_i,Z_iZ_{i+1}\} (an HEA with RX,RYR_X,R_Y and RZZR_{ZZ} layers); (b) {Yi,ZiZi+1}\{Y_i,Z_iZ_{i+1}\} (the same without RXR_X); (c) the Hamiltonian variational ansatz of the transverse-field Ising chain, {∑iXi,∑iZiZi+1}\{\sum_iX_i,\sum_iZ_iZ_{i+1}\} with two shared parameters per layer; (d) QAOA for MaxCut on a random 3-regular graph, {∑EZiZj,∑iXi}\{\sum_EZ_iZ_j,\sum_iX_i\}. The cost is ∑iZiZi+1\sum_iZ_iZ_{i+1} (the cut operator for (d)), which is an element of 𝔤\mathfrak{g} in every case, and the initial state is |0⟩⊗n|0\rangle^{\otimes n} (|+⟩⊗n|+\rangle^{\otimes n} for (d)). DLAs are computed exactly: when every generator is a single Pauli string the closure is a breadth-first search over strings (commutators of Pauli strings are Pauli strings); otherwise we run an incremental Gram–Schmidt closure in the Pauli basis. The 𝔤\mathfrak{g}-purities 𝒫𝔤(ρ)\mathcal P_\mathfrak{g}(\rho) and 𝒫𝔤(H)\mathcal P_\mathfrak{g}(H) follow from the resulting orthonormal basis.

The results (Fig. 7, Table 4) show two polynomial and two exponential families. Family (a) generates the full 𝔰𝔲(2n)\mathfrak{su}(2^n) at every nn tested, and family (d) grows quickly (1515 at n=4n=4, 176176 at n=6n=6). Family (b), despite looking like a generic hardware-efficient ansatz, has dim⁡𝔤=n(2n−1)=6,15,28,45,66,91,120\dim\mathfrak{g}=n(2n-1)=6,15,28,45,66,91,120: it is 𝔰𝔬(2n)\mathfrak{so}(2n), the algebra of quadratic forms in 2n2n Majorana operators — under a Jordan–Wigner transformation YiY_i and ZiZi+1Z_iZ_{i+1} are quadratic in fermions, so this circuit is a free-fermion (matchgate-like) circuit [13]. Family (c), with only two global generators, closes into an even smaller n2n^2-dimensional subalgebra. Equation (3) is quantitatively accurate for (a), (b) and (c): the ratio of measured to predicted variance is 0.890.89–1.101.10, 0.940.94–1.081.08 and 0.860.86–1.221.22 respectively (for n≥3n\ge3; median over all points 1.001.00). The only clear failures are the smallest TFIM instance (n=2n=2, ratio 0.320.32) and QAOA (ratios 0.600.60 and 0.590.59), where a circuit with two parameters per layer evidently does not form a 2-design on e𝔤e^\mathfrak{g} at L=60L=60, which is the assumption behind Eq. (3).

The polynomial algebra of family (b) has a direct consequence for trainability: for a cost in 𝔤\mathfrak{g}, Var[C]\mathrm{Var}[C] is Ω(1/n2)\Omega(1/n^2) rather than 2−n2^{-n}, and indeed the measured variances in Table 4 increase with nn for (b) and (c) (because 𝒫𝔤(ρ)𝒫𝔤(H)\mathcal P_\mathfrak{g}(\rho)\mathcal P_\mathfrak{g}(H) grows faster than dim⁡𝔤\dim\mathfrak{g}). This does not contradict E1–E3, which use costs outside the algebra or ansätze with ZZ rotations: adding a single rotation family (RXR_X) turns 𝔰𝔬(2n)\mathfrak{so}(2n) into 𝔰𝔲(2n)\mathfrak{su}(2^n).

6 Discussion and limitations

What the numerics add to the theory.

The exact Haar values of Appendix A let us quantify how far a given finite-depth circuit is from the asymptotic regime instead of only checking the exponent. Doing so exposed the undershoot at intermediate depth, the heavy tails that make shallow-depth variance estimates unreliable (and that are a cheap diagnostic of the 2-design regime), and the decoupling between the convergence of the gradient variance and of the entanglement entropy. The DLA study turned a seemingly generic hardware-efficient family into a free-fermion circuit with a polynomial algebra, and confirmed Eq. (3) with exact purities rather than estimates.

Limitations.

All simulations are noiseless apart from the Gaussian shot-noise model of E5; noise-induced plateaus are a separate phenomenon. We go to at most 16 qubits, so exponents are fitted over about a decade of nn; the heavy tails at shallow depth widen the intervals of the smallest-depth points, and the n=16n=16 points at L≥20L\ge20 use only 100 samples. E5 uses a single optimiser configuration and a small learning-rate/step budget; the shot-noise model is additive Gaussian rather than binomial. For QAOA, the graph is resampled with the parameters, so the variance mixes graph and parameter randomness. The DLA closure caps at a few thousand dimensions, which limits QAOA to n≤6n\le6. Finally, the report is a reproduction-and-consolidation study: its new observations are empirical and would need larger nn and more ensembles to become claims.

7 Conclusion

A few hundred lines of NumPy, exact gradients and a few CPU-hours are enough to test the barren-plateau literature quantitatively rather than qualitatively. The main predictions — 2−n2^{-n} decay for 2-design circuits, 4−n4^{-n} versus slow decay for global versus local costs, the benefit of small-angle initialisation, the absence of plateaus at fixed QAOA depth, and the Lie-algebraic variance formula — all hold within the stated accuracies. Along the way we found that the approach to the plateau is non-monotonic and heavy-tailed, that it precedes the saturation of entanglement, that exact-gradient optimisation is blind to the plateau at these sizes while finite-shot optimisation is not, and that a common hardware-efficient family is secretly free-fermionic. The code, data and a single make target to regenerate every figure are released with this report.

Code and data availability

The simulator, the ansatz and experiment scripts, the cached results for every data point and the scripts that regenerate every figure and table are available at https://github.com/thanatchon36/bp-from-scratch under the MIT licence and archived on Zenodo (doi:10.5281/zenodo.23995488, version 0.2.0). The results are also published as a dataset at https://huggingface.co/datasets/thanatchon36/bp-from-scratch; Appendix C lists the commands.

A Haar averages of the gradient variance

Write the circuit around a rotation with Pauli generator GG (TrG=0\mathrm{Tr}G=0, G2=𝟙G^2=\mathbb 1) as U=ULR(θ)URU=U_LR(\theta)U_R, let A=UL†HULA=U_L^\dagger HU_L and σ=R(θ)URρ0UR†R(θ)†\sigma=R(\theta)U_R\rho_0U_R^\dagger R(\theta)^\dagger with ρ0=|0⟩⟨0|\rho_0=|0\rangle\langle0|. Since C=Tr[Aσ]C=\mathrm{Tr}[A\,\sigma] and ∂θσ=−i2[G,σ]\partial_\theta\sigma=-\tfrac i2[G,\sigma], ∂θC=12Tr(i[G,A]σ)=12Tr(AK),K=i[σ,G],(4)\begin{equation} \partial_\theta C=\tfrac12\mathrm{Tr}\big(i[G,A]\,\sigma\big)=\tfrac12\mathrm{Tr}\big(A\,K\big),\qquad K=i[\sigma,G],\qquad\text{(4)} \end{equation} with i[G,A]i[G,A] and KK Hermitian and traceless. We use the standard second moments of a Haar-random pure state σ\sigma in dimension dd, 𝔼σ[Tr(Bσ)2]=[(TrB)2+TrB2]/(d(d+1))\mathbb{E}_\sigma[\mathrm{Tr}(B\sigma)^2]=\big[(\mathrm{Tr}B)^2+\mathrm{Tr}B^2\big]/(d(d+1)), and of a Haar-random unitary, 𝔼UTr(UAU†BUCU†D)=TrATrCTr(BD)+Tr(AC)TrBTrDd2−1−TrATrCTrBTrD+Tr(AC)Tr(BD)d(d2−1),(5)𝔼U[Tr(UAU†B)]2=(TrA)2(TrB)2+TrA2TrB2d2−1−(TrA)2TrB2+TrA2(TrB)2d(d2−1).(6)\begin{align} \mathbb{E}_U\mathrm{Tr}(UAU^\dagger B\,UCU^\dagger D)&=\frac{\mathrm{Tr}A\mathrm{Tr}C\mathrm{Tr}(BD)+\mathrm{Tr}(AC)\mathrm{Tr}B\mathrm{Tr}D}{d^2-1}\nonumber\\ &\qquad-\frac{\mathrm{Tr}A\mathrm{Tr}C\mathrm{Tr}B\mathrm{Tr}D+\mathrm{Tr}(AC)\mathrm{Tr}(BD)}{d(d^2-1)},\qquad\text{(5)}\\ \mathbb{E}_U\big[\mathrm{Tr}(UAU^\dagger B)\big]^2&=\frac{(\mathrm{Tr}A)^2(\mathrm{Tr}B)^2+\mathrm{Tr}A^2\mathrm{Tr}B^2}{d^2-1}-\frac{(\mathrm{Tr}A)^2\mathrm{Tr}B^2+\mathrm{Tr}A^2(\mathrm{Tr}B)^2}{d(d^2-1)} .\qquad\text{(6)} \end{align}

Random circuit after the rotation only (UR=𝟙U_R=\mathbb 1).

Then σ\sigma is fixed, KK is fixed, and AA is a Haar conjugate of HH. With TrK=0\mathrm{Tr}K=0 and TrK2=−Tr[σ,G]2=2−2⟨G⟩σ2\mathrm{Tr}K^2=-\mathrm{Tr}[\sigma,G]^2=2-2\langle G\rangle_\sigma^2 for a pure σ\sigma, Var[∂θC]=TrK2[dTrH2−(TrH)2]4d(d2−1).(7)\begin{equation} \mathrm{Var}[\partial_\theta C]=\frac{\mathrm{Tr}K^2\,\big[d\mathrm{Tr}H^2-(\mathrm{Tr}H)^2\big]}{4d(d^2-1)} .\qquad\text{(7)} \end{equation}

Random circuit before the rotation only (UL=𝟙U_L=\mathbb 1).

Then A=HA=H and σ\sigma is a Haar-random pure state. With B=i[G,H]B=i[G,H], TrB=0\mathrm{Tr}B=0 and TrB2=2TrH2−2Tr(GHGH)\mathrm{Tr}B^2=2\mathrm{Tr}H^2-2\mathrm{Tr}(GHGH), Var[∂θC]=2TrH2−2Tr(GHGH)4d(d+1).(8)\begin{equation} \mathrm{Var}[\partial_\theta C]=\frac{2\mathrm{Tr}H^2-2\mathrm{Tr}(GHGH)}{4d(d+1)} .\qquad\text{(8)} \end{equation} For H=Z⊗nH=Z^{\otimes n} and GG an XX or YY rotation on one qubit, Tr(GHGH)=−d\mathrm{Tr}(GHGH)=-d and the variance is 1/(d+1)1/(d+1); for a ZZ rotation it vanishes. Averaging over the random axes of the McClean ensemble gives 23(d+1)−1\tfrac23(d+1)^{-1} for the last-layer probe of Sec. 5.1.

Random circuits on both sides.

Averaging Eq. (8) over the Haar conjugate AA of HH (independent of σ\sigma) with the four-fold formula gives 𝔼Tr(GAGA)=[d(TrH)2−TrH2]/(d2−1)\mathbb{E}\mathrm{Tr}(GAGA)=[d(\mathrm{Tr}H)^2-\mathrm{Tr}H^2]/(d^2-1) and hence Var[∂θC]=dTrH2−(TrH)22(d+1)2(d−1),\begin{equation*} \mathrm{Var}[\partial_\theta C]=\frac{d\mathrm{Tr}H^2-(\mathrm{Tr}H)^2}{2(d+1)^2(d-1)}, \end{equation*} which is Eq. (2): ≈1/(2d)\approx 1/(2d) for a traceless Pauli string and 1/(2(d+1)2)1/(2(d+1)^2) for the projector |0⟩⟨0|⊗n|0\rangle\langle0|^{\otimes n}. Table 5 compares the three formulas with direct sampling of Haar unitaries (400 samples, G=YG=Y on qubit 0, θ\theta uniform).

Table 5. Numerical check of Eqs. (2), (7), (8). Upper block: H=Z⊗nH=Z^{\otimes n}; lower block: H=|0⟩⟨0|⊗nH=|0\rangle\langle 0|^{\otimes n}. Sampling error is about 10% at 400 samples.
two-sided after only (UR=𝟙U_R = \mathbb{1}) before only (UL=𝟙U_L = \mathbb{1})
nn simulated Eq. (2) simulated Eq. (7) simulated Eq. (8)
H=Z⊗nH = Z^{\otimes n}
2 1.07×10−11.07\times10^{-1} 1.07×10−11.07\times10^{-1} 1.23×10−11.23\times10^{-1} 1.33×10−11.33\times10^{-1} 1.95×10−11.95\times10^{-1} 2.00×10−12.00\times10^{-1}
3 5.59×10−25.59\times10^{-2} 5.64×10−25.64\times10^{-2} 6.43×10−26.43\times10^{-2} 6.35×10−26.35\times10^{-2} 1.15×10−11.15\times10^{-1} 1.11×10−11.11\times10^{-1}
4 3.12×10−23.12\times10^{-2} 2.95×10−22.95\times10^{-2} 3.29×10−23.29\times10^{-2} 3.14×10−23.14\times10^{-2} 5.58×10−25.58\times10^{-2} 5.88×10−25.88\times10^{-2}
5 1.33×10−21.33\times10^{-2} 1.52×10−21.52\times10^{-2} 1.55×10−21.55\times10^{-2} 1.56×10−21.56\times10^{-2} 2.68×10−22.68\times10^{-2} 3.03×10−23.03\times10^{-2}
6 7.77×10−37.77\times10^{-3} 7.69×10−37.69\times10^{-3} 6.83×10−36.83\times10^{-3} 7.81×10−37.81\times10^{-3} 1.49×10−21.49\times10^{-2} 1.54×10−21.54\times10^{-2}
7 3.91×10−33.91\times10^{-3} 3.88×10−33.88\times10^{-3} 3.64×10−33.64\times10^{-3} 3.91×10−33.91\times10^{-3} 7.26×10−37.26\times10^{-3} 7.75×10−37.75\times10^{-3}
8 2.09×10−32.09\times10^{-3} 1.95×10−31.95\times10^{-3} 1.77×10−31.77\times10^{-3} 1.95×10−31.95\times10^{-3} 3.79×10−33.79\times10^{-3} 3.89×10−33.89\times10^{-3}
H=|0⟩⟨0|⊗nH = |0\rangle\langle 0|^{\otimes n}
2 1.99×10−21.99\times10^{-2} 2.00×10−22.00\times10^{-2} 2.46×10−22.46\times10^{-2} 2.50×10−22.50\times10^{-2} 2.62×10−22.62\times10^{-2} 2.50×10−22.50\times10^{-2}
3 6.07×10−36.07\times10^{-3} 6.17×10−36.17\times10^{-3} 6.98×10−36.98\times10^{-3} 6.94×10−36.94\times10^{-3} 6.30×10−36.30\times10^{-3} 6.94×10−36.94\times10^{-3}
4 1.72×10−31.72\times10^{-3} 1.73×10−31.73\times10^{-3} 2.01×10−32.01\times10^{-3} 1.84×10−31.84\times10^{-3} 1.99×10−31.99\times10^{-3} 1.84×10−31.84\times10^{-3}
5 4.74×10−44.74\times10^{-4} 4.59×10−44.59\times10^{-4} 4.34×10−44.34\times10^{-4} 4.73×10−44.73\times10^{-4} 4.81×10−44.81\times10^{-4} 4.73×10−44.73\times10^{-4}
6 1.61×10−41.61\times10^{-4} 1.18×10−41.18\times10^{-4} 1.08×10−41.08\times10^{-4} 1.20×10−41.20\times10^{-4} 1.22×10−41.22\times10^{-4} 1.20×10−41.20\times10^{-4}
7 3.22×10−53.22\times10^{-5} 3.00×10−53.00\times10^{-5} 3.05×10−53.05\times10^{-5} 3.03×10−53.03\times10^{-5} 2.93×10−52.93\times10^{-5} 3.03×10−53.03\times10^{-5}
8 7.68×10−67.68\times10^{-6} 7.57×10−67.57\times10^{-6} 6.86×10−66.86\times10^{-6} 7.60×10−67.60\times10^{-6} 7.50×10−67.50\times10^{-6} 7.60×10−67.60\times10^{-6}

B Adjoint-mode gradient

Let |ψk⟩=Uk⋯U1|0⟩|\psi_k\rangle=U_k\cdots U_1|0\rangle and |λk⟩=Uk+1†⋯UM†H|ψM⟩|\lambda_k\rangle=U_{k+1}^\dagger\cdots U_M^\dagger H|\psi_M\rangle. For a rotation Uk=exp⁡(−iskθp(k)Gk/2)U_k=\exp(-i\,s_k\theta_{p(k)}G_k/2), ∂Uk/∂θp(k)=−i2skGkUk\partial U_k/\partial\theta_{p(k)}=-\tfrac i2 s_kG_kU_k and therefore ∂C∂θp=∑k:p(k)=p2Re⟨λk|(−i2sk)Gk|ψk⟩.(9)\begin{equation} \frac{\partial C}{\partial\theta_p}=\sum_{k:\,p(k)=p}2\,\mathrm{Re}\Big\langle\lambda_k\Big|\Big(-\tfrac i2 s_k\Big)G_k\Big|\psi_k\Big\rangle .\qquad\text{(9)} \end{equation} Sweeping kk from MM down to 11 while applying Uk†U_k^\dagger to both |ψ⟩|\psi\rangle and |λ⟩|\lambda\rangle computes every term with three state-vector operations per gate and no extra memory [10]; shared parameters accumulate automatically. The parameter-shift rule, Eq. (1), is applied to one gate occurrence at a time and summed; both agree with finite differences to 10−1010^{-10} in the test suite.

C Reproduction

pip install -e ".[dev]"              # or ".[dev,compare]" for PennyLane checks
python -m pytest -q                  # 58 tests
BUDGET=100000 bash experiments/run_all.sh   # all experiments, ~1 CPU hour
python analysis/make_figures.py      # paper/figures/*.pdf, results/figures/*.png
python analysis/make_tables.py       # paper/tables/*.tex
bash paper/build.sh                  # PDF, web reader, Markdown mirror

Every experiment script skips cached points, so an interrupted run resumes where it stopped. Figures and tables in this document were produced by exactly these commands from the committed results/ directory.

References

  1. J. R. McClean, S. Boixo, V. N. Smelyanskiy, R. Babbush, H. Neven, Barren plateaus in quantum neural network training landscapes, Nat. Commun. 9, 4812 (2018), doi:10.1038/s41467-018-07090-4.

  2. M. Cerezo, A. Sone, T. Volkoff, L. Cincio, P. J. Coles, Cost function dependent barren plateaus in shallow parametrized quantum circuits, Nat. Commun. 12, 1791 (2021), doi:10.1038/s41467-021-21728-w.

  3. C. Ortiz Marrero, M. Kieferová, N. Wiebe, Entanglement-induced barren plateaus, PRX Quantum 2, 040316 (2021), doi:10.1103/PRXQuantum.2.040316.

  4. E. Grant, L. Wossnig, M. Ostaszewski, M. Benedetti, An initialization strategy for addressing barren plateaus in parametrized quantum circuits, Quantum 3, 214 (2019), doi:10.22331/q-2019-12-09-214.

  5. K. Zhang, L. Liu, M.-H. Hsieh, D. Tao, Escaping from the barren plateau via Gaussian initializations in deep variational quantum circuits, Adv. Neural Inf. Process. Syst. 35, 18612–18627 (2022), arXiv:2203.09376.

  6. M. Larocca, P. Czarnik, K. Sharma, G. Muraleedharan, P. J. Coles, M. Cerezo, Diagnosing barren plateaus with tools from quantum optimal control, Quantum 6, 824 (2022), doi:10.22331/q-2022-09-29-824.

  7. M. Ragone, B. N. Bakalov, F. Sauvage, A. F. Kemper, C. Ortiz Marrero, M. Larocca, M. Cerezo, A Lie algebraic theory of barren plateaus for deep parameterized quantum circuits, Nat. Commun. 15, 7172 (2024), doi:10.1038/s41467-024-49909-3.

  8. E. Fontana, D. Herman, S. Chakrabarti, N. Kumar, R. Yalovetzky, J. Heredge, S. H. Sureshbabu, M. Pistoia, Characterizing barren plateaus in quantum ansätze with the adjoint representation, Nat. Commun. 15, 7171 (2024), doi:10.1038/s41467-024-49910-w.

  9. M. Larocca, S. Thanasilp, S. Wang, K. Sharma, J. Biamonte, P. J. Coles, L. Cincio, J. R. McClean, Z. Holmes, M. Cerezo, Barren plateaus in variational quantum computing, Nat. Rev. Phys. 7, 174–189 (2025), doi:10.1038/s42254-025-00813-9.

  10. T. Jones, J. Gacon, Efficient calculation of gradients in classical simulations of variational quantum algorithms, arXiv:2009.02823 (2020).

  11. D. N. Page, Average entropy of a subsystem, Phys. Rev. Lett. 71, 1291–1294 (1993), doi:10.1103/PhysRevLett.71.1291.

  12. E. Farhi, J. Goldstone, S. Gutmann, A quantum approximate optimization algorithm, arXiv:1411.4028 (2014).

  13. E. Kökcü, T. Steckmann, Y. Wang, J. K. Freericks, E. F. Dumitrescu, A. F. Kemper, Fixed depth Hamiltonian simulation via Cartan decomposition, Phys. Rev. Lett. 129, 070501 (2022), doi:10.1103/PhysRevLett.129.070501.

How to cite

@techreport{chongmankhong2026barren,
  author = {Chongmankhong, Thanatchon},
  title  = {Barren Plateaus from Scratch: A NumPy State-Vector Study of Trainability in Variational Quantum Circuits},
  year   = {2026},
  type   = {Technical report},
  url    = {https://thanatchon36.github.io/bp-from-scratch/paper/}
}