Calculating the energy gradient in parameter space has become an almost ubiquitous subroutine of variational near-term quantum algorithms. "Faithful" classical emulation of this subroutine mimics its quantum evaluation, and scales as O(P^2) gate operations for P variational parameters. This is often the bottleneck for the moderately-sized simulations, and has attracted HPC strategies like "batch-circuit" evaluation. We here present a novel derivation of an emulation strategy to precisely calculate the gradient in O(P) time and using O(1) state-vectors, compatible with "full-state" state-vector simulators. The prescribed algorithm resembles the optimised technique for automatic differentiation of reversible cost functions, often used in classical machine learning, and first employed in quantum simulators like Yao.jl. In contrast, our scheme derives directly from a recurrent form of quantum operators, and may be more familiar to a quantum computing community. Our strategy is very simple, uses only 'apply gate', 'clone state' and 'inner product' primitives and is hence straightforward to implement and integrate with existing simulators. It is compatible with gate parallelisation schemes, and hardware accelerated and distributed simulators. We describe the scheme in an instructive way, including details of how common gate derivatives can be performed, to clearly guide implementation in existing quantum simulators. We furthermore demonstrate the scheme by implementing it in Qiskit, and perform some comparative benchmarking with faithful simulation. Finally, we remark upon the difficulty of extending the scheme to density-matrix simulation of noisy channels.
Calculating the energy gradient in parameter space has become an almost ubiquitous subroutine of variational near-term quantum algorithms. "Faithful" classical emulation of this subroutine mimics its quantum evaluation, and scales as O(P^2) gate operations for P variational parameters. This is often the bottleneck for the moderately-sized simulations, and has attracted HPC strategies like "batch-circuit" evaluation. We here present a novel derivation of an emulation strategy to precisely calculate the gradient in O(P) time and using O(1) state-vectors, compatible with "full-state" state-vector simulators. The prescribed algorithm resembles the optimised technique for automatic differentiation of reversible cost functions, often used in classical machine learning, and first employed in quantum simulators like Yao.jl. In contrast, our scheme derives directly from a recurrent form of quantum operators, and may be more familiar to a quantum computing community. Our strategy is very simple, uses only 'apply gate', 'clone state' and 'inner product' primitives and is hence straightforward to implement and integrate with existing simulators. It is compatible with gate parallelisation schemes, and hardware accelerated and distributed simulators. We describe the scheme in an instructive way, including details of how common gate derivatives can be performed, to clearly guide implementation in existing quantum simulators. We furthermore demonstrate the scheme by implementing it in Qiskit, and perform some comparative benchmarking with faithful simulation. Finally, we remark upon the difficulty of extending the scheme to density-matrix simulation of noisy channels.
Quantum natural gradient has emerged as a superior minimisation technique in quantum variational algorithms. Classically simulating the algorithm running on near-future quantum hardware is paramount in its study, as it is for all variational algorithms. In this case, state-vector simulation of the P-parameter/gate ansatz circuit does not dominate the runtime; instead, calculation of the Fisher information matrix becomes the bottleneck, involving O(P^3) gate evaluations, though this can be reduced to O(P^2) gates by using O(P) temporary state-vectors. This is similar to the gradient calculation subroutine dominating the simulation of quantum gradient descent, which has attracted HPC strategies and bespoke simulation algorithms with asymptotic speedups. We here present a novel simulation strategy to precisely calculate the quantum natural gradient in O(P^2) gates and O(1) state-vectors. While more complicated, our strategy is in the same spirit as that presented for gradients in Reference 6, and involves iteratively evaluating recurrent forms of the Fisher information matrix. Our strategy uses only "apply gate", "clone state" and "inner product" operations which are present in practically all quantum computing simulators. It is furthermore compatible with parallelisation schemes, like hardware acceleration and distribution. Since our scheme leverages a form of the Fisher information matrix for strictly unitary ansatz circuits, it cannot be simply extended to density matrix simulation of quantum natural gradient with non-unitary circuits.
Quantum Computing is believed to be the ultimate solution for quantum chemistry problems. Before the advent of large-scale, fully fault-tolerant quantum computers, the variational quantum eigensolver (VQE) is a promising heuristic quantum algorithm to solve real world quantum chemistry problems on near-term noisy quantum computers. Here we propose a highly parallelizable classical simulator for VQE based on the matrix product state representation of quantum state, which significantly extend the simulation range of the existing simulators. Our simulator seamlessly integrates the quantum circuit evolution into the classical auto-differentiation framework, thus the gradients could be computed efficiently similar to the classical deep neural network, with a scaling that is independent of the number of variational parameters. As applications, we use our simulator to study commonly used small molecules such as HF, HCl, LiH and H 2 O, as well as larger molecules CO 2 , BeH 2 and H 4 with up to 40 qubits. The favorable scaling of our simulator against the number of qubits and the number of parameters could make it an ideal testing ground for near-term quantum algorithms and a perfect benchmarking baseline for oncoming large scale VQE experiments on noisy quantum computers.
Abstract Many near-term quantum computing algorithms are conceived as variational quantum algorithms, in which parameterized quantum circuits are optimized in a hybrid quantum–classical setup. Examples are variational quantum eigensolvers, quantum approximate optimization algorithms as well as various algorithms in the context of quantum-assisted machine learning. A common bottleneck of any such algorithm is constituted by the optimization of the variational parameters. A popular set of optimization methods work on the estimate of the gradient, obtained by means of circuit evaluations. We will refer to the way in which one can combine these circuit evaluations as gradient rules. This work provides a comprehensive picture of the family of gradient rules that vary parameters of quantum gates individually. The most prominent known members of this family are the parameter shift rule (PSR) and the finite differences method. To unite this family, we propose a generalized PSR that expresses all members of the aforementioned family as special cases, and discuss how all of these can be seen as providing access to a linear combination of exact first- and second-order derivatives. We further prove that a PSR with one non-shifted evaluation and only one shifted circuit evaluation does not exist, and introduce a novel perspective for approaching new gradient rules.
Quantum computing has become a potential way to solve complex problems that conventional computers can’t handle, especially those involving strongly correlated quantum systems. Classical simulation of these systems becomes exponentially more challenging as the number of interacting particles rises, resulting in significant computational and memory limitations. As a result, classical computational approaches are unable to handle many significant physical and chemical systems, including molecular structures, biological molecules, and quantum materials. Quantum computers operate using the same quantum mechanical principles as these systems. Consequently, they provide a natural framework for exploring large Hilbert spaces and capturing complex quantum correlations. This thesis begins by discussing the fundamental principles of quantum mechanics that are applicable to computation, such as qubits, superposition, and entanglement. The construction of quantum circuits is discussed after a discussion of basic quantum gates and their matrix representations. These ideas are the foundation of quantum algorithms and offer the essential framework for comprehending the modeling and manipulation of complicated quantum states using quantum hardware. Building on this foundation, the thesis focuses on Variational Quantum Algorithms (VQAs), which offer a feasible hybrid quantum-classical approach to optimizing near-term quantum devices. In VQAs, a parameterized quantum circuit is used to approximate the ground-state energy of the quantum system. A classical optimizer then iteratively updates the variational parameters to minimize a cost function, usually the expectation value of the system’s Hamiltonian. A thorough analysis of the function of gradient-based optimization is conducted, encompassing the parameter-shift rule that is employed to calculate precise energy derivatives. The discussion is expanded to include major applications such as the Quantum Approximate Optimization Algorithm and developing approaches to quantum machine learning, emphasizing the importance of efficient and accurate gradient evaluation. A major challenge in the real-world application of VQAs is the high resource cost of gradient estimation using conventional direct measurement techniques. These techniques require repeated projective measurements and several executions of parameter-shifted quantum circuits, which lead to significant measurement overhead and deeper circuits. Quantum Non-Demolition Measurement (QNDM) is examined in this thesis as a potential framework for gradient evaluation to get around this limitation. Based on recent theoretical advances, QNDM introduces an ancillary detector qubit that coherently stores gradient information within its phase. Derivatives can then be estimated indirectly through detector measurements. This allows gradient information to be extracted without destroying the quantum state and with a greatly reduced number of measurements. The efficiency of QNDM is evaluated by extending the study to systems with bigger Hamiltonians and greater molecular complexity, as well as by comparing it in detail with direct measurement techniques utilizing benchmark molecular systems like LiH, Li2, and H2. Although both methods successfully converge to the ground-state energy, as shown by numerical results, QNDM consistently uses fewer quantum resources in terms of logical gate operations, measurement shots, and circuit executions. Additionally, as system size grows, QNDM’s resource advantage becomes more noticeable, suggesting that it has favorable scalability for bigger molecular systems. This thesis concludes that, while both direct measurement and quantum non-demolition measurement approaches allow for precise variational optimization, QNDM gives a significant decrease in quantum resources. These results establish QNDM as an effective and scalable method for developing quantum simulations of realistic physical and chemical systems and for executing variational quantum algorithms on near-term quantum hardware.
Training parameterised quantum circuits (PQCs) on quantum hardware is bottlenecked by the measurement cost of gradient estimation, which under the parameter-shift rule scales linearly in the number of trainable parameters and dominates the total shot budget of training at scale. In this work, we propose a framework of forward gradient estimators for PQCs, based on the forward mode of automatic differentiation, that yields an unbiased estimator of the gradient by averaging a freely tunable number of random directional derivatives and recovers SPSA, random coordinate descent, and the parameter-shift rule as limiting cases, with no ancilla qubits or controlled-gate overhead. We prove that stochastic quantum forward gradient descent converges under standard assumptions, with an explicit second-moment expansion that interpolates between the single-direction extreme of SPSA and the full-gradient extreme of parameter-shift. Within this framework we derive QUIVER (Quantum Iterative V-adaptive Estimator Rule), an adaptive optimiser for parameterised circuits whose update rule follows from a closed-form minimum measurement-cost allocation. We show numerically that forward gradients train Hamming-weight-preserving orthogonal quantum neural networks with up to 60 qubits and 1770 parameters on the ECG5000 and MNIST datasets orders of magnitude more efficiently than the parameter-shift rule. We also demonstrate that our proposed QUIVER optimiser can outperform iCANS and gCANS measurement-frugal optimisers on optimisation problems using the quantum approximate optimisation algorithm and quantum simulation with the variational quantum eigensolver.
The past few years have seen a significant transfer of tools from machine learning to solve quantum physics problems. Automatic differentiation is one standard algorithm used to efficiently compute gradients of loss functions for generic neural networks. In this work we show how to extend automatic differentiation to the case of complex loss function in a way that can be readily implemented in existing frameworks and which is compatible with the common case of real loss functions. We then combine this tool with matrix product states and apply it to compute the ground state and the steady state of a close and an open quantum system. Compared to the traditional density matrix renormalization group algorithm, complex automatic differentiation allows both straightforward GPU accelerations as well as generalizations to different types of tensor and neural networks.