Diagrammatic Differentiation for Quantum Machine Learning

We introduce diagrammatic differentiation for tensor calculus by generalising the dual number construction from rigs to monoidal categories. Applying this to ZX diagrams, we show how to calculate diagrammatically the gradient of a linear map with respect to a phase parameter. For diagrams of parametrised quantum circuits, we get the well-known parameter-shift rule at the basis of many variational quantum algorithms. We then extend our method to the automatic differentation of hybrid classical-quantum circuits, using diagrams with bubbles to encode arbitrary non-linear operators. Moreover, diagrammatic differentiation comes with an open-source implementation in DisCoPy, the Python library for monoidal categories. Diagrammatic gradients of classical-quantum circuits can then be simplified using the PyZX library and executed on quantum hardware via the tket compiler. This opens the door to many practical applications harnessing both the structure of string diagrams and the computational power of quantum machine learning.

[1]  Aleks Kissinger,et al.  Reducing the number of non-Clifford gates in quantum circuits , 2020, Physical Review A.

[2]  Marcello Benedetti,et al.  Parameterized quantum circuits as machine learning models , 2019, Quantum Science and Technology.

[3]  M. Stone On One-Parameter Unitary Groups in Hilbert Space , 1932 .

[4]  Chen Zhao,et al.  Analyzing the barren plateau phenomenon in training quantum neural network with the ZX-calculus , 2021, Quantum.

[5]  R. Penrose,et al.  Spinors and Space‐Time, Volume I: Two‐Spinor Calculus and Relativistic Fields , 1986 .

[6]  Ross Duncan,et al.  Architecture-aware synthesis of phase polynomials for NISQ devices , 2020, 2004.06052.

[7]  R. Penrose,et al.  Spinors and Space–Time: Subject and author index , 1984 .

[8]  Aleks Kissinger,et al.  Picturing Quantum Processes by Bob Coecke , 2017 .

[9]  A. Joyal,et al.  The geometry of tensor calculus, I , 1991 .

[10]  B. Coecke,et al.  Quantum Natural Language Processing on Near-Term Quantum Computers , 2020, QPL.

[11]  C. Gogolin,et al.  Evaluating analytic gradients on quantum hardware , 2018, Physical Review A.

[12]  Bob Coecke,et al.  Foundations for Near-Term Quantum Natural Language Processing , 2020, ArXiv.

[13]  Aleks Kissinger,et al.  PyZX: Large Scale Automated Diagrammatic Reasoning , 2019, Electronic Proceedings in Theoretical Computer Science.

[14]  Neil Ghani,et al.  Categorical Foundations of Gradient-Based Learning , 2021, ArXiv.

[15]  A. Fowler,et al.  Flexible layout of surface code computations using AutoCCZ states , 2019, 1905.08916.

[16]  Stefan Zohren,et al.  Graphical structures for design and verification of quantum error correction , 2016, Quantum Science and Technology.

[17]  Philipp H. W. Hoffmann,et al.  A Hitchhiker’s Guide to Automatic Differentiation , 2014, Numerical Algorithms.

[18]  J. Robin B. Cockett,et al.  Reverse derivative categories , 2019, CSL.

[19]  Lucas Dixon,et al.  Graphical reasoning in compact closed categories for quantum computation , 2009, Annals of Mathematics and Artificial Intelligence.

[20]  Aleks Kissinger,et al.  Picturing Quantum Processes: A First Course in Quantum Theory and Diagrammatic Reasoning , 2017 .

[21]  Kristan Temme,et al.  Supervised learning with quantum-enhanced feature spaces , 2018, Nature.

[22]  Miriam Backens,et al.  There and back again: A circuit extraction tale , 2021, Quantum.

[23]  Aleks Kissinger,et al.  Graph-theoretic Simplification of Quantum Circuits with the ZX-calculus , 2019, Quantum.

[24]  Gaël Varoquaux,et al.  The NumPy Array: A Structure for Efficient Numerical Computation , 2011, Computing in Science & Engineering.

[25]  G. M. Kelly,et al.  Coherence for compact closed categories , 1980 .

[26]  Pawel Sobocinski,et al.  Compositional Diagrammatic First-Order Logic , 2020, Diagrams.

[27]  Samson Abramsky,et al.  Categorical quantum mechanics , 2008, 0808.1023.

[28]  Andy R. Terrel,et al.  SymPy: Symbolic computing in Python , 2017, PeerJ Prepr..

[29]  Bob Coecke,et al.  DisCoPy: Monoidal Categories in Python , 2021, Electronic Proceedings in Theoretical Computer Science.

[30]  Richie Yeung,et al.  Diagrammatic Design and Study of Ansätze for Quantum Machine Learning , 2020, ArXiv.

[31]  Simon Perdrix,et al.  A Complete Axiomatisation of the ZX-Calculus for Clifford+T Quantum Mechanics , 2017, LICS.

[32]  J. Robin B. Cockett,et al.  Differential categories , 2006, Mathematical Structures in Computer Science.

[33]  Quanlong Wang,et al.  Fast and Effective Techniques for T-Count Reduction via Spider Nest Identities , 2020, TQC.

[34]  Ross Street,et al.  Functorial Calculus in Monoidal Bicategories , 2003, Appl. Categorical Struct..

[35]  Clifford,et al.  Preliminary Sketch of Biquaternions , 1871 .

[36]  Ross Duncan,et al.  Phase Gadget Synthesis for Shallow Circuits , 2019, QPL.

[37]  Ross Duncan,et al.  t|ket⟩: a retargetable compiler for NISQ devices , 2020, Quantum Science and Technology.

[38]  Quanlong Wang,et al.  Two complete axiomatisations of pure-state qubit quantum computing , 2018, LICS.