Computing the gradients with respect to all parameters of a quantum neural network using a single circuit
Guang Ping He
TL;DR
The paper tackles the high cost of gradient computation in quantum neural networks by leveraging a single-circuit approach that uses two ancilla qubits to probabilistically realize all parameter shifts within one circuit run. This reduces circuit depth from $O(n^2)$ to $O(n)$ and lowers memory requirements, while still enabling accurate estimation of all gradients via shot statistics. Experimental results on simulators and IBM hardware demonstrate substantial compilation-time savings and a speedup in total runtime for larger data sets, despite increased running time per shot and additional qubits. The method generalizes to other parameter-shift gates and suggests hardware and algorithmic refinements to further improve performance in practical quantum training tasks.
Abstract
Finding gradients is a crucial step in training machine learning models. For quantum neural networks, computing gradients using the parameter-shift rule requires calculating the cost function twice for each adjustable parameter in the network. When the total number of parameters is large, the quantum circuit must be repeatedly adjusted and executed, leading to significant computational overhead. Here we propose an approach to compute all gradients using a single circuit only, significantly reducing both the circuit depth and the number of classical registers required. We experimentally validate our approach on both quantum simulators and IBM's real quantum hardware, demonstrating that our method significantly reduces circuit compilation time compared to the conventional approach, resulting in a substantial speedup in total runtime.
