Modeling quantum neural network gradient with reinforcement learning
Authors: Nhan Trong Luu, Duong Trung Luu, Nam Ngoc Pham, Thang Cong Truong
Organizations: College of Information and Communication Technology, Can Tho University, Can Tho, Vietnam · College of Engineering and Computer Science, VinUniversity, Hanoi, Vietnam · Center for Digital Transformation and Communications, Can Tho University, Can Tho, Vietnam · Department of Computer Science and Engineering, The University of Aizu, Fukushima, Japan
Training quantum neural networks (QNNs) on near-term hardware remains hampered by two compounding difficulties: the exponential vanishing of gradient variance known as the barren plateau, and the O(L⋅2n) time and memory cost of differentiating through an n-qubit, L-layer circuit. We propose RLQ-Grad, a reinforcement-learning-based optimizer in which a classical policy πφ (a spectrally-normalized PPO agent) learns to propose parameter updates directly, conditioned on the QNN's current parameters, loss, accuracy, and previous update. Because the surrogate gradient is emitted by a classical network rather than obtained by differentiating through the unitary U(θ), its variance is not constrained by the barren plateau concentration bound, and its cost scales with the number of trainable parameters rather than the Hilbert-space dimension. We prove these properties formally and verify them on a hardware-efficient ansatz across four supervised benchmarks with up to n=20 qubits. RLQ-Grad preserves a near-flat gradient-variance curve where backpropagation, parameter-shift, and adjoint differentiation decay by 1 to 2 orders of magnitude. Accounting for the full training pipeline (PPO rollouts, actor-critic updates, and optimizer states), RLQ-Grad needs under 2 MB of memory and runs 2490×, 7876×, and 673× faster per iteration than these three methods at n=20. It improves top-1 accuracy by up to +10% over gradient-based baselines on circuits of up to 12 qubits, and matches dedicated barren plateau mitigation methods on CIFAR-10 at 14 to 20 qubits, where evolutionary and gradient-free optimizers collapse to chance.
Figures & tables
Figure 1: Illustration of a n -qubit l -depth HEA circuit utilized in the majority of our experiments.
Figure 2: Comparison of gradient variance of the first trainable parameter in the HEA Var(⟨∂θ1,1(1)E⟩) of gradient computation strategies for a depth- L , n -qubit QNN with PQNN trainable parameters. Variance results for RLQ-Grad are obtained from post training agent on BC dataset on Section 3.2 .
Figure 3: End-to-end memory (a, CPU RAM) and per-iteration CPU wall-clock time (b) of QNN gradient computation methods from 2 to 20 qubits (log scale, mean over 12 trials after 4 warm-up iterations). RLQ-Grad costs cover the full training pipeline: PPO rollout, actor and critic updates, gradient buffers, and Adam optimizer states. Hollow markers denote measurements below the 0.1 MB resolution. Exact values are listed in Appendix D.6 .
Method
Time Complexity Otime
Memory Complexity Omemory
Backpropagation [ 21 ]
L⋅2n
L⋅2n
Parameter-shift [ 19 ]
PQNN⋅L⋅2n
PQNN⋅2n
Adjoint differentiation [ 18 ]
PQNN⋅2n
1
RLQ-Grad (actor inference)
LMLPd2+dPQNN
d+PQNN
RLQ-Grad (full pipeline)
PRL
4PRL
Table 1: Theoretical complexity of gradient computation strategies for a depth- L , n -qubit QNN with PQNN trainable parameters. Forward pass complexity is identical for all methods and therefore omitted. For an MLP agent of depth LMLP and width d , PRL=O(LMLPd2+dPQNN) counts actor and critic parameters.
Datasets
Algorithms
Top 1 validation accuracy per configuration
2q1d (Param = 6)
4q2d (Param = 24)
6q3d (Param = 54)
8q4d (Param = 96)
10q5d (Param = 150)
12q6d (Param = 216)
BC
Backpropagation [ 21 ]
80.62±10.64
90.86±1.998
91.88±2.057
91.88±1.126
91.96±2.402
93.15±2.942
Parameter-shift [ 19 ]
85.71±7.082
89.77±1.316
89.60±5.526
89.77±2.010
91.99±5.385
92.11±5.526
Adjoint-differentiation [ 18 ]
83.01±11.64
84.93±14.82
85.04±3.689
87.32±8.476
92.75±10.28
93.02±8.926
RLQ-Grad (Ours)
95.52±0.080
95.20±2.379
95.79±3.418
95.96±0.380
96.18±4.178
96.58±5.612
MNIST
Backpropagation [ 21 ]
59.24±3.171
78.52±1.371
88.81±0.434
91.43±0.624
91.74±0.305
92.48±0.225
Table 2: Comparison of top 1 validation accuracy (in percentage, averaged over 4 runs) of gradient computation strategies for a n -qubit, L -depth HEA. Best performance per variant is denoted in bold and second best is underlined.
Type
Method
Top 1 validation accuracy per configuration
14q7d (Param = 294)
16q8d (Param = 384)
18q9d (Param = 486)
20q10d (Param = 600)
Gradient-based
Backpropagation [ 21 ]
38.72±3.21
40.45±2.67
39.86±3.48
40.13±2.91
Gradient-free
CMA-ES [ 33 ]
10.10±0.14
10.12±0.21
10.11±0.20
10.13±0.15
sep-CMA-ES [ 34 ]
10.09±0.23
10.14±0.17
10.11±0.26
10.15±0.19
SPSA [ 35 ]
10.08±0.27
10.15±0.18
10.11±0.32
10.14±0.24
BP mitigation
Layerwise [ 16 ]
44.73±3.21
48.58±2.74
50.92±3.47
53.16±3.65
Table 3: CIFAR-10 top-1 validation accuracy (in percentage, mean ± std over 3 runs) at larger circuit scales. Best performance per configuration is denoted in bold and second best is underlined.
Appendix figures & tables9 assets
Supplementary material from the paper’s appendix.
Appendix
Agents
Buffer type
Buffer size
Params
MACs
Top 1 validation accuracy per dataset
BC
MNIST
F-MNIST
CIFAR10
SAC
Replay
1000000
17,038
16,640
95.61±1.519
65.53±0.521
72.27±0.437
28.64±0.516
TD3
Replay
1000000
16,648
16,256
96.71±0.380
68.55±0.989
73.52±0.367
28.72±0.287
DDPG
Replay
1000000
11,079
10,816
85.53±6.837
55.23±0.372
65.28±0.098
23.14±0.457
TRPO
Rollout
lrollout
10,695
10,432
93.20±1.899
60.27±0.298
70.65±0.428
26.46±0.623
PPO
Rollout
lrollout
5,575
5,440
90.05±4.760
59.52±0.212
68.52±0.534
25.12±0.961
Appendix
Table 4: Preliminary studies on different agent type with RLQ-Grad. lrollout is correspondingly 400 for BC, 46800 for MNIST and FMNIST, 39000 for CIFAR10.
Agents
Top 1 validation accuracy per dataset
0.2⋅lrollout
0.4⋅lrollout
0.6⋅lrollout
0.8⋅lrollout
lrollout
TRPO
57.13±0.199
58.35±0.467
58.73±0.512
59.35±0.408
60.27±0.298
PPO
57.22±0.204
57.62±0.259
58.79±0.315
58.94±0.342
59.52±0.212
Appendix
Table 5: Accuracy comparison of PPO and TRPO across lrollout length on MNIST.
Figure 4: Accuracy convergence of RLQ-Grad (with PPO) variants (with (a) both last layer of policy and value function SN, (b) only last layer of value function SN [ 25 ] and (c) no SN applied) on BC dataset (denoted blue with fluctuation region) when compare with maximum achievable accuracy of other gradient calculating methods on 2-qubits HEA.
Agents
Params
MACs
Top 1 validation accuracy per dataset
BC
MNIST
F-MNIST
CIFAR10
PPO
5,575
5,440
90.05±4.760
59.52±0.212
68.52±0.534
25.12±0.961
PPO (SN)
11847
10,432
95.52±0.080
61.36±2.216
73.64±0.415
27.17±0.782
Appendix
Table 6: Accuracy comparison between ValueSN[-1] and non-SN PPO across datasets.
Figure 5: Accuracy convergence of RLQ-Grad (denoted blue with fluctuation region) when compare with maximum achievable accuracy of other gradient calculating methods on 2-qubits HEA.
Method
2q1d
4q2d
6q3d
8q4d
10q5d
12q6d
14q7d
16q8d
18q9d
20q10d
Backpropagation
<0.1 MB
187.15 KB
416.55 KB
619.74 KB
1.96 MB
10.10 MB
63.30 MB
282.70 MB
1227 MB
6174 MB
Parameter-shift
<0.1 MB
282.89 KB
1.06 MB
6.38 MB
7.32 MB
9.98 MB
18.59 MB
22.37 MB
24.23 MB
22.55 MB
Adjoint-differentiation
<0.1 MB
<0.1 MB
<0.1 MB
<0.1 MB
<0.1 MB
<0.1 MB
<0.1 MB
<0.1 MB
<0.1 MB
<0.1 MB
RLQ-Grad (full)
161.22 KB
215.64 KB
306.35 KB
433.33 KB
596.60 KB
796.14 KB
1.02 MB
1.30 MB
1.61 MB
1.95 MB
Appendix
Table 7: End-to-end CPU RAM usage of gradient computation methods ( n=2 to 20 qubits).
Method
2q1d
4q2d
6q3d
8q4d
10q5d
12q6d
14q7d
16q8d
18q9d
20q10d
Backpropagation
0.0042
0.0123
0.0260
0.1295
0.1033
0.1662
0.2719
0.5112
2.3262
219.41
Parameter-shift
0.0067
0.0425
0.1333
0.3921
0.9860
2.3931
5.2019
16.2818
66.3288
693.96
Adjoint-differentiation
0.0027
0.0055
0.0109
0.0161
0.0266
0.0569
0.0836
0.6666
10.0897
59.3241
RLQ-Grad (full)
0.0455
0.0545
0.0641
0.0565
0.0815
0.0858
0.0842
0.0862
0.0875
0.0881
Appendix
Table 8: Per-iteration CPU wall-clock time (in seconds) of gradient computation methods.
Method
2q1d
4q2d
6q3d
8q4d
10q5d
12q6d
14q7d
16q8d
18q9d
20q10d
Backpropagation
23.37
65.54
126.96
218.95
322.98
451.28
605.74
807.99
1026.45
1457.06
RLQ-Grad (full)
22.51
56.60
111.49
184.76
276.88
390.89
523.60
785.93
957.31
1190.83
Appendix
Table 9: Per-iteration GPU wall-clock time (in milliseconds, NVIDIA RTX 3090, 15 trials). Parameter-shift and adjoint differentiation are omitted as they lack efficient GPU kernels in current QNN frameworks.
Figure 6: Loss landscape visualization across benchmarked gradient computation methods over HEA-2b1q on BC and F-MNIST. Loss landscape change from smooth on BC dataset (overparameterized) to becomes more noisy (underparameterized) with sharp local minima in F-MNIST.
Training quantum neural networks (QNNs) on quantum hardware is currently bottlenecked by the cost of gradient estimation: standard parameter-shift methods require a number of circuit evaluations that grows quadratically with the number of trainable parameters, making hardware-based optimisation impractical beyond small system sizes. In this work, we introduce a training framework that reduces this cost to logarithmic in the number of qubits, making gradient-based QNN optimisation feasible on near-term hardware at increasing scales. Our framework combines three co-designed ingredients: (i) a structured, subspace-preserving Butterfly circuit architecture with O(nlogn) parameters and logarithmic depth; (ii) a layer-wise training strategy that confines on-hardware optimisation to one small, well-structured layer at a time; and (iii) a parallelised parameter-shift rule that exploits the commuting structure within each Butterfly layer to extract all gradients in a constant number of circuit executions. Together these reduce the number of distinct circuit evaluations per optimisation step from O(n2) to O(logn). We validate the framework on clinical data imputation using the MIMIC-III electronic health record dataset, a demanding benchmark sensitive to optimisation instability and model variance. Hybrid classical-quantum models are trained directly on IonQ Forte Enterprise trapped-ion hardware at 16 qubits without performance degradation relative to ideal or noisy simulation and via tensor-network simulation at 32 qubits, with 32-qubit inference executed on hardware. The resulting models match or exceed strong classical neural baselines in downstream patient survival prediction while exhibiting reduced variance across runs, demonstrating that the proposed framework enables practical, scalable QNN training under realistic hardware constraints.
Variational quantum algorithms are often limited by barren plateaus: gradients vanish as circuit size and depth increase, making quantum neural networks difficult to train. We propose Q-Capsule, a localized capsule-based quantum neural architecture that mitigates this problem through register partitioning, local readout, sparse inter-capsule coupling, trainable data re-uploading, and Quantum Fisher Information Matrix (QFIM)-guided adaptive depth growth. By restricting the dominant support of each observable to a small capsule and controlling inter-capsule entanglement, Q-Capsule preserves useful gradient signals while retaining communication between local quantum representations. As the register width increases, Q-Capsule consistently maintains stable gradient variance, whereas globally entangling baselines exhibit exponential suppression with a log-gradient-variance slope near -ln 2 per qubit. Q-Capsule also produces more structured optimization landscapes, higher parameter efficiency, improved robustness to depolarizing noise, and lower measurement requirements. Its adaptive policy achieves 98.1% accuracy on binary classification and 97.7% on four-class classification, while using approximately 73% fewer two-qubit gates than the fixed-deep model on the multiclass task.
Awal Ahmed Fime, Tasfia Zaman Samiha, Saika Zaman +4
Florida Atlantic University, Boca Raton, Florida, USA · Khulna University of Engineering & Technology, Khulna, Bangladesh · Southern Illinois University Carbondale, Carbondale, Illinois, USA
Quantum Machine Learning (QML) is fundamentally limited by two challenges: barren plateaus (exponentially vanishing gradients) and the fragility of parameterized quantum circuits under noise. Despite extensive empirical studies, a unified theoretical framework remains lacking. We introduce LieTrunc-QNN, an algebraic-geometric framework that characterizes trainability via Lie-generated dynamics. Parameterized quantum circuits are modeled as Lie subalgebras of u(2^n), whose action induces a Riemannian manifold of reachable quantum states. Expressivity is reinterpreted as intrinsic manifold dimension and geometry. We establish a geometric capacity-plateau principle: increasing effective dimension leads to exponential gradient suppression due to concentration of measure. By restricting to structured Lie subalgebras (LieTrunc), the manifold is contracted, preventing concentration and preserving non-degenerate gradients. We prove two main results: (1) a trainability lower bound for LieTrunc-QNN, and (2) that the Fubini-Study metric rank is bounded by the algebraic span of generators, showing expressivity is governed by structure rather than parameter count. Compact Lie subalgebras also provide inherent robustness to perturbations. Importantly, we establish a polynomial trainability regime where gradient variance decays polynomially instead of exponentially. Experiments (n=2-6) validate the theory: LieTrunc-QNN maintains stable gradients and high effective dimension, while random truncation leads to metric rank collapse. At n=6, full metric rank is preserved (rank=16). Results support a scaling law between gradient variance and effective dimension. This work provides a unified geometric framework for QNN design, linking Lie algebra, manifold geometry, and optimization.
Haijian Shao, Dalong Zhao, Xing Deng +2
School of Computer, Jiangsu University of Science and Technology, Zhenjiang 212003, China · Department of Electrical and Computer Engineering, University of Nevada, Las Vegas, USA