General parameter-shift rules for quantum gradients

David Wierichs1,2, Josh Izaac1, Cody Wang3, and Cedric Yen-Yu Lin3

1Xanadu, Toronto, ON, M5G 2C8, Canada
2Institute for Theoretical Physics, University of Cologne, Germany
3AWS Quantum Technologies, Seattle, Washington 98170, USA

Find this paper interesting or want to discuss? Scite or leave a comment on SciRate.


Variational quantum algorithms are ubiquitous in applications of noisy intermediate-scale quantum computers. Due to the structure of conventional parametrized quantum gates, the evaluated functions typically are finite Fourier series of the input parameters. In this work, we use this fact to derive new, general parameter-shift rules for single-parameter gates, and provide closed-form expressions to apply them. These rules are then extended to multi-parameter quantum gates by combining them with the stochastic parameter-shift rule. We perform a systematic analysis of quantum resource requirements for each rule, and show that a reduction in resources is possible for higher-order derivatives. Using the example of the quantum approximate optimization algorithm, we show that the generalized parameter-shift rule can reduce the number of circuit evaluations significantly when computing derivatives with respect to parameters that feed into many gates. Our approach additionally reproduces reconstructions of the evaluated function up to a chosen order, leading to known generalizations of the Rotosolve optimizer and new extensions of the quantum analytic descent optimization algorithm.

Cody Wang on general parameter-shift rules

A PennyLane demo on general parameter-shift rules:

Many near-term applications of quantum computing are concerned with parametrized quantum circuits and cost functions arising from them. This cost function is to be minimized, which often is done with optimization algorithms that use the gradient or higher-order derivatives. These derivatives can in turn be computed using so-called parameter-shift rules.
Previously, shift rules were known for all single-parameter quantum gates $U(x)=\exp(ixG)$ that are generated by operators satisfying the relation $G^3=G$. Other gates had to be decomposed into gates of this form in order to compute the cost function derivatives via a parameter-shift rule. In this work, we present general parameter-shift rules for all single-parameter gates. We compare the cost of these rules to that of decomposing a gate and applying the original shift rule to the constituents and find that the general shift rule can reduce the cost significantly for large gates that are relevant in applications. This advantage over decomposition-based derivatives grows with the order of the derivative.
Our approach is based on a discrete Fourier transform and is directly linked to known optimization algorithms that use single-parameter reconstructions of the cost function. The new shift rule allows gradient-based optimizers to run at the same cost as these reconstruction-based algorithms.

► BibTeX data

► References

[1] Amazon Web Services. ``Amazon Braket''. url:​braket/​.

[2] J.M. Arrazola, V. Bergholm, K. Brádler, T.R. Bromley, M.J. Collins, I. Dhand, A. Fumagalli, T. Gerrits, A. Goussev, L.G. Helt, J. Hundal, T. Isacsson, R.B. Israel, J. Izaac, S. Jahangiri, R. Janik, N. Killoran, S.P. Kumar, J. Lavoie, A.E. Lita, D.H. Mahler, M. Menotti, B. Morrison, S.W. Nam, L. Neuhaus, H.Y. Qi, N. Quesada, A. Repingon, K.K. Sabapathy, M. Schuld, D. Su, J. Swinarton, A. Száva, K. Tan, P. Tan, V.D. Vaidya, Z. Vernon, Z. Zabaneh, and Y. Zhang. ``Quantum circuits with many photons on a programmable nanophotonic chip''. Nature 591, 54–60 (2021).

[3] IBM Corporation. ``IBM Quantum''. url:​.

[4] Microsoft. ``Azure Quantum''. url:​../​quantum/​.

[5] Marcello Benedetti, Erika Lloyd, Stefan Sack, and Mattia Fiorentini. ``Parameterized quantum circuits as machine learning models''. Quantum Science and Technology 4, 043001 (2019).

[6] Marco Cerezo, Andrew Arrasmith, Ryan Babbush, Simon C. Benjamin, Suguru Endo, Keisuke Fujii, Jarrod R. McClean, Kosuke Mitarai, Xiao Yuan, Lukasz Cincio, and Patrick J. Coles. ``Variational quantum algorithms''. Nature Reviews Physics 3, 625–644 (2021).

[7] Alberto Peruzzo, Jarrod McClean, Peter Shadbolt, Man-Hong Yung, Xiao-Qi Zhou, Peter J. Love, Alán Aspuru-Guzik, and Jeremy L. O'Brien. ``A variational eigenvalue solver on a photonic quantum processor''. Nature Communications 5, 4213 (2014).

[8] Edward Farhi, Jeffrey Goldstone, and Sam Gutmann. ``A quantum approximate optimization algorithm'' (2014). arXiv:1411.4028.

[9] Tyson Jones, Suguru Endo, Sam McArdle, Xiao Yuan, and Simon C. Benjamin. ``Variational quantum algorithms for discovering Hamiltonian spectra''. Phys. Rev. A 99, 062304 (2019).

[10] Gian-Luca R Anselmetti, David Wierichs, Christian Gogolin, and Robert M Parrish. ``Local, expressive, quantum-number-preserving VQE ansätze for fermionic systems''. New Journal of Physics 23, 113010 (2021).

[11] Harper R. Grimsley, Sophia E. Economou, Edwin Barnes, and Nicholas J. Mayhall. ``An adaptive variational algorithm for exact molecular simulations on a quantum computer''. Nature communications 10, 1–9 (2019).

[12] Ken M. Nakanishi, Kosuke Mitarai, and Keisuke Fujii. ``Subspace-search variational quantum eigensolver for excited states''. Phys. Rev. Research 1, 033062 (2019).

[13] Alain Delgado, Juan Miguel Arrazola, Soran Jahangiri, Zeyue Niu, Josh Izaac, Chase Roberts, and Nathan Killoran. ``Variational quantum algorithm for molecular geometry optimization''. Phys. Rev. A 104, 052402 (2021).

[14] Eric Anschuetz, Jonathan Olson, Alán Aspuru-Guzik, and Yudong Cao. ``Variational quantum factoring''. In International Workshop on Quantum Technology and Optimization Problems. Pages 74–85. Springer (2019).

[15] Sumeet Khatri, Ryan LaRose, Alexander Poremba, Lukasz Cincio, Andrew T. Sornborger, and Patrick J. Coles. ``Quantum-assisted quantum compiling''. Quantum 3, 140 (2019).

[16] Jun Li, Xiaodong Yang, Xinhua Peng, and Chang-Pu Sun. ``Hybrid quantum-classical approach to quantum optimal control''. Phys. Rev. Lett. 118, 150503 (2017).

[17] Ryan LaRose, Arkin Tikku, Étude O’Neel-Judy, Lukasz Cincio, and Patrick J. Coles. ``Variational quantum state diagonalization''. npj Quantum Information 5, 1–10 (2019).

[18] Benjamin Commeau, Marco Cerezo, Zoë Holmes, Lukasz Cincio, Patrick J. Coles, and Andrew Sornborger. ``Variational Hamiltonian diagonalization for dynamical quantum simulation'' (2020). arXiv:2009.02559.

[19] Jonathan Romero, Jonathan P. Olson, and Alan Aspuru-Guzik. ``Quantum autoencoders for efficient compression of quantum data''. Quantum Science and Technology 2, 045001 (2017).

[20] Guillaume Verdon, Michael Broughton, and Jacob Biamonte. ``A quantum algorithm to train neural networks using low-depth circuits'' (2017). arXiv:1712.05304.

[21] Edward Farhi and Hartmut Neven. ``Classification with quantum neural networks on near term processors'' (2018). arXiv:1802.06002.

[22] Maria Schuld and Nathan Killoran. ``Quantum machine learning in feature Hilbert spaces''. Phys. Rev. Lett. 122, 040504 (2019).

[23] Kosuke Mitarai, Makoto Negoro, Masahiro Kitagawa, and Keisuke Fujii. ``Quantum circuit learning''. Phys. Rev. A 98, 032309 (2018).

[24] Maria Schuld, Alex Bocharov, Krysta M. Svore, and Nathan Wiebe. ``Circuit-centric quantum classifiers''. Phys. Rev. A 101, 032308 (2020).

[25] Edward Grant, Marcello Benedetti, Shuxiang Cao, Andrew Hallam, Joshua Lockhart, Vid Stojevic, Andrew G. Green, and Simone Severini. ``Hierarchical quantum classifiers''. npj Quantum Information 4, 1–8 (2018).

[26] Jin-Guo Liu and Lei Wang. ``Differentiable learning of quantum circuit Born machines''. Phys. Rev. A 98, 062324 (2018).

[27] Vojtěch Havlíček, Antonio D. Córcoles, Kristan Temme, Aram W. Harrow, Abhinav Kandala, Jerry M. Chow, and Jay M. Gambetta. ``Supervised learning with quantum-enhanced feature spaces''. Nature 567, 209–212 (2019).

[28] Hongxiang Chen, Leonard Wossnig, Simone Severini, Hartmut Neven, and Masoud Mohseni. ``Universal discriminative quantum neural networks''. Quantum Machine Intelligence 3, 1–11 (2021).

[29] Nathan Killoran, Thomas R. Bromley, Juan Miguel Arrazola, Maria Schuld, Nicolás Quesada, and Seth Lloyd. ``Continuous-variable quantum neural networks''. Phys. Rev. Research 1, 033063 (2019).

[30] Gregory R. Steinbrecher, Jonathan P. Olson, Dirk Englund, and Jacques Carolan. ``Quantum optical neural networks''. npj Quantum Information 5, 1–9 (2019).

[31] Andrea Mari, Thomas R. Bromley, Josh Izaac, Maria Schuld, and Nathan Killoran. ``Transfer learning in hybrid classical-quantum neural networks''. Quantum 4, 340 (2020).

[32] Ryan Sweke, Frederik Wilde, Johannes Meyer, Maria Schuld, Paul K. Faehrmann, Barthélémy Meynard-Piganeau, and Jens Eisert. ``Stochastic gradient descent for hybrid quantum-classical optimization''. Quantum 4, 314 (2020).

[33] Martín Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, Manjunath Kudlur, Josh Levenberg, Rajat Monga, Sherry Moore, Derek G. Murray, Benoit Steiner, Paul Tucker, Vijay Vasudevan, Pete Warden, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. ``TensorFlow: a system for large-scale machine learning''. In OSDI. Volume 16, pages 265–283. Berkeley, CA, USA (2016). USENIX Association. url:​..3026877.3026899.

[34] Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. ``Automatic differentiation in PyTorch''. NIPS 2017 Workshop Autodiff (2017). url:​forum?id=BJJsrmfCZ.

[35] Dougal Maclaurin, David Duvenaud, and Ryan P. Adams. ``Autograd: Effortless gradients in NumPy''. In ICML 2015 AutoML Workshop. (2015). url:​.

[36] Atılım Güneş Baydin, Barak A. Pearlmutter, Alexey Andreyevich Radul, and Jeffrey Mark Siskind. ``Automatic differentiation in machine learning: a survey''. Journal of Machine Learning Research 18, 1–153 (2018). url: http:/​/​​papers/​v18/​17-468.html.

[37] Ville Bergholm, Josh Izaac, Maria Schuld, Christian Gogolin, M. Sohaib Alam, Shahnawaz Ahmed, Juan Miguel Arrazola, Carsten Blank, Alain Delgado, Soran Jahangiri, Keri McKiernan, Johannes Jakob Meyer, Zeyue Niu, Antal Száva, and Nathan Killoran. ``PennyLane: Automatic differentiation of hybrid quantum-classical computations'' (2020). arXiv:1811.04968.

[38] Maria Schuld, Ville Bergholm, Christian Gogolin, Josh Izaac, and Nathan Killoran. ``Evaluating analytic gradients on quantum hardware''. Phys. Rev. A 99, 032331 (2019).

[39] Leonardo Banchi and Gavin E. Crooks. ``Measuring analytic gradients of general quantum evolution with the stochastic parameter shift rule''. Quantum 5, 386 (2021).

[40] Gavin E. Crooks. ``Gradients of parameterized quantum gates using the parameter-shift rule and gate decomposition'' (2019). arXiv:1905.13311.

[41] Jakob S. Kottmann, Abhinav Anand, and Alán Aspuru-Guzik. ``A feasible approach for automatically differentiable unitary coupled-cluster on quantum computers''. Chemical Science 12, 3497–3508 (2021).

[42] Javier Gil Vidal and Dirk Oliver Theis. ``Calculus on parameterized quantum circuits'' (2018). arXiv:1812.06323.

[43] Francisco Javier Gil Vidal and Dirk Oliver Theis. ``Input redundancy for parameterized quantum circuits''. Frontiers in Physics 8, 297 (2020).

[44] Maria Schuld, Ryan Sweke, and Johannes Jakob Meyer. ``Effect of data encoding on the expressive power of variational quantum-machine-learning models''. Phys. Rev. A 103, 032430 (2021).

[45] Ken M. Nakanishi, Keisuke Fujii, and Synge Todo. ``Sequential minimal optimization for quantum-classical hybrid algorithms''. Phys. Rev. Research 2, 043158 (2020).

[46] Andrea Mari, Thomas R. Bromley, and Nathan Killoran. ``Estimating the gradient and higher-order derivatives on quantum hardware''. Phys. Rev. A 103, 012405 (2021).

[47] Johannes Jakob Meyer. ``Fisher information in noisy intermediate-scale quantum applications''. Quantum 5, 539 (2021).

[48] James Stokes, Josh Izaac, Nathan Killoran, and Giuseppe Carleo. ``Quantum natural gradient''. Quantum 4, 269 (2020).

[49] Bálint Koczor and Simon C. Benjamin. ``Quantum analytic descent'' (2020). arXiv:2008.13774.

[50] Mateusz Ostaszewski, Edward Grant, and Marcello Benedetti. ``Structure optimization for parameterized quantum circuits''. Quantum 5, 391 (2021).

[51] Robert M. Parrish, Joseph T. Iosue, Asier Ozaeta, and Peter L. McMahon. ``A Jacobi diagonalization and Anderson acceleration algorithm for variational quantum algorithm parameter optimization'' (2019). arXiv:1904.03206.

[52] Artur F. Izmaylov, Robert A. Lang, and Tzu-Ching Yen. ``Analytic gradients in variational quantum algorithms: Algebraic extensions of the parameter-shift rule to general unitary transformations''. Phys. Rev. A 104, 062443 (2021).

[53] Oleksandr Kyriienko and Vincent E. Elfving. ``Generalized quantum circuit differentiation rules''. Phys. Rev. A 104, 052417 (2021).

[54] Thomas Hubregtsen, Frederik Wilde, Shozab Qasim, and Jens Eisert. ``Single-component gradient rules for variational quantum algorithms'' (2021). arXiv:2106.01388v1.

[55] Antoni Zygmund. ``Trigonometric series, Volume II''. Cambridge University Press (1988).

[56] Kosuke Mitarai and Keisuke Fujii. ``Methodology for replacing indirect measurements with direct measurements''. Phys. Rev. Research 1, 013006 (2019).

[57] Sam McArdle, Tyson Jones, Suguru Endo, Ying Li, Simon C. Benjamin, and Xiao Yuan. ``Variational ansatz-based quantum simulation of imaginary time evolution''. npj Quantum Information 5 (2019).

[58] Ying Li and Simon C. Benjamin. ``Efficient variational quantum simulator incorporating active error minimization''. Phys. Rev. X 7, 021050 (2017).

[59] David Wierichs, Christian Gogolin, and Michael Kastoryano. ``Avoiding local minima in variational quantum eigensolvers with the natural gradient optimizer''. Phys. Rev. Research 2, 043246 (2020).

[60] Mauro E. S. Morales, Jacob D. Biamonte, and Zoltán Zimborás. ``On the universality of the quantum approximate optimization algorithm''. Quantum Information Processing 19, 1–26 (2020).

[61] Seth Lloyd. ``Quantum approximate optimization is computationally universal'' (2018). arXiv:1812.11075.

[62] Matthew B. Hastings. ``Classical and quantum bounded depth approximation algorithms'' (2019). arXiv:1905.07047.

[63] Zhihui Wang, Stuart Hadfield, Zhang Jiang, and Eleanor G. Rieffel. ``Quantum approximate optimization algorithm for MaxCut: A fermionic view''. Phys. Rev. A 97, 022304 (2018).

[64] Wen Wei Ho and Timothy H. Hsieh. ``Efficient variational simulation of non-trivial quantum states''. SciPost Phys 6, 29 (2019).

[65] Leo Zhou, Sheng-Tao Wang, Soonwon Choi, Hannes Pichler, and Mikhail D. Lukin. ``Quantum approximate optimization algorithm: Performance, mechanism, and implementation on near-term devices''. Phys. Rev. X 10, 021067 (2020).

[66] Matthew P. Harrigan, Kevin J. Sung, Matthew Neeley, Kevin J. Satzinger, Frank Arute, Kunal Arya, Juan Atalaya, Joseph C. Bardin, Rami Barends, Sergio Boixo, et al. ``Quantum approximate optimization of non-planar graph problems on a planar superconducting processor''. Nature Physics 17, 332–336 (2021).

[67] Charles Delorme and Svatopluk Poljak. ``The performance of an eigenvalue bound on the MaxCut problem in some classes of graphs''. Discrete Mathematics 111, 145–156 (1993).

[68] William N. Anderson Jr. and Thomas D. Morley. ``Eigenvalues of the Laplacian of a graph''. Linear and Multilinear Algebra 18, 141–145 (1985).

[69] Vladimir Brankov, Pierre Hansen, and Dragan Stevanović. ``Automated conjectures on upper bounds for the largest Laplacian eigenvalue of graphs''. Linear Algebra and its Applications 414, 407–424 (2006).

[70] Michel X. Goemans and David P. Williamson. ``Improved approximation algorithms for Maximum Cut and satisfiability problems using semidefinite programming''. J. ACM 42, 1115–1145 (1995).

[71] Miguel F. Anjos and Henry Wolkowicz. ``Geometry of semidefinite MaxCut relaxations via matrix ranks''. Journal of Combinatorial Optimization 6, 237–270 (2002).

[72] Liu Hongwei, Sanyang Liu, and Fengmin Xu. ``A tight semidefinite relaxation of the MaxCut problem''. J. Comb. Optim. 7, 237–245 (2003).

[73] Andrea Skolik, Jarrod R. McClean, Masoud Mohseni, Patrick van der Smagt, and Martin Leib. ``Layerwise learning for quantum neural networks''. Quantum Machine Intelligence 3, 1–11 (2021).

[74] Marcello Benedetti, Mattia Fiorentini, and Michael Lubasch. ``Hardware-efficient variational quantum algorithms for time evolution''. Phys. Rev. Research 3, 033083 (2021).

[75] Ernesto Campos, Aly Nasrallah, and Jacob Biamonte. ``Abrupt transitions in variational quantum circuit training''. Phys. Rev. A 103, 032607 (2021).

[76] Aharon Ben-Tal and Arkadi Nemirovski. ``Lectures on modern convex optimization: Analysis, algorithms, and engineering applications''. SIAM (2001).

[77] Elies Gil-Fuster and David Wierichs. ``Quantum analytic descent (demo)''. url:​qml/​demos/​.. (accessed: 2022-01-23).

[78] Bálint Koczor (2021). code: balintkoczor/​quantum-analytic-descent.

[79] David Wierichs, Josh Izaac, Cody Wang, and Cedric Yen-Yu Lin (2022). code: dwierichs/​General-Parameter-Shift-Rules.

[80] Leonard Benjamin William Jolley. ``Summation of series''. Dover Publications (1961).

[81] falagar. ``Prove that $\sum\limits_{k=1}^{n-1}\tan^{2}\frac{k \pi}{2n} = \frac{(n-1)(2n-1)}{3}$''. url:​q/​2343. (accessed: 2022-01-23).

Cited by

[1] Weikang Li and Dong-Ling Deng, "Recent advances for quantum classifiers", Science China Physics, Mechanics, and Astronomy 65 2, 220301 (2022).

[2] Maria Schuld and Nathan Killoran, "Is quantum advantage the right goal for quantum machine learning?", arXiv:2203.01340.

[3] Tobias Haug, Kishor Bharti, and M. S. Kim, "Capacity and Quantum Geometry of Parametrized Quantum Circuits", PRX Quantum 2 4, 040309 (2021).

[4] Artur F. Izmaylov, Robert A. Lang, and Tzu-Ching Yen, "Analytic gradients in variational quantum algorithms: Algebraic extensions of the parameter-shift rule to general unitary transformations", Physical Review A 104 6, 062443 (2021).

[5] Oleksandr Kyriienko and Vincent E. Elfving, "Generalized quantum circuit differentiation rules", Physical Review A 104 5, 052417 (2021).

[6] Bálint Koczor and Simon C. Benjamin, "Quantum analytic descent", Physical Review Research 4 2, 023017 (2022).

[7] Annie E. Paine, Vincent E. Elfving, and Oleksandr Kyriienko, "Quantum Kernel Methods for Solving Differential Equations", arXiv:2203.08884.

[8] Abhinav Anand, Philipp Schleich, Sumner Alperin-Lea, Phillip W. K. Jensen, Sukin Sim, Manuel Díaz-Tinoco, Jakob S. Kottmann, Matthias Degroote, Artur F. Izmaylov, and Alán Aspuru-Guzik, "A Quantum Computing View on Unitary Coupled Cluster Theory", arXiv:2109.15176.

[9] Roeland Wiersema and Nathan Killoran, "Optimizing quantum circuits with Riemannian gradient flow", arXiv:2202.06976.

[10] Saad Yalouz, Emiel Koridon, Bruno Senjean, Benjamin Lasorne, Francesco Buda, and Lucas Visscher, "Analytical nonadiabatic couplings and gradients within the state-averaged orbital-optimized variational quantum eigensolver", arXiv:2109.04576.

[11] Norihito Shirai, Kenji Kubo, Kosuke Mitarai, and Keisuke Fujii, "Quantum tangent kernel", arXiv:2111.02951.

[12] Kaining Zhang, Min-Hsiu Hsieh, Liu Liu, and Dacheng Tao, "Gaussian initializations help deep variational quantum circuits escape from the barren plateau", arXiv:2203.09376.

[13] Robert M. Parrish, Gian-Luca R. Anselmetti, and Christian Gogolin, "Analytical Ground- and Excited-State Gradients for Molecular Electronic Structure Theory from Hybrid Quantum/Classical Methods", arXiv:2110.05040.

[14] Owen Lockwood, "An Empirical Review of Optimization Techniques for Quantum Variational Circuits", arXiv:2202.01389.

[15] Juan Miguel Arrazola, Soran Jahangiri, Alain Delgado, Jack Ceroni, Josh Izaac, Antal Száva, Utkarsh Azad, Robert A. Lang, Zeyue Niu, Olivia Di Matteo, Romain Moyard, Jay Soni, Maria Schuld, Rodrigo A. Vargas-Hernández, Teresa Tamayo-Mendoza, Cedric Yen-Yu Lin, Alán Aspuru-Guzik, and Nathan Killoran, "Differentiable quantum computational chemistry with PennyLane", arXiv:2111.09967.

[16] Dirk Oliver Theis, "Optimality of Finite-Support Parameter Shift Rules for Derivatives of Variational Quantum Circuits", arXiv:2112.14669.

[17] Olivia Di Matteo, Josh Izaac, Tom Bromley, Anthony Hayes, Christina Lee, Maria Schuld, Antal Száva, Chase Roberts, and Nathan Killoran, "Quantum computing with differentiable quantum transforms", arXiv:2202.13414.

The above citations are from SAO/NASA ADS (last updated successfully 2022-05-29 04:00:23). The list may be incomplete as not all publishers provide suitable and complete citation data.

On Crossref's cited-by service no data on citing works was found (last attempt 2022-05-29 04:00:20).