Abstract
We develop a compositional approach for automatic and symbolic differentiation based on categorical constructions in functional analysis where derivatives are linear functions on abstract vectors rather than being limited to scalars, vectors, matrices or tensors represented as multi-dimensional arrays. We show that both symbolic and automatic differentiation can be performed using a differential calculus for generating linear functions representing Fréchet derivatives based on rules for primitive, constant, linear and bilinear functions as well as their sequential and parallel composition. Linear functions are represented in a combinatory domain-specific language. Finally, we provide a calculus for symbolically computing the adjoint of a derivative without using matrices, which are too inefficient to use on high-dimensional spaces. The resulting symbolic representation of a derivative retains the data-parallel operations from the input program. The combination of combinatory differentiation and computing formal adjoints turns out to be behaviorally equivalent to reverse-mode automatic differentiation. In particular, it provides opportunities for optimizations where matrices are too inefficient to represent linear functions.
Original language | English |
---|---|
Title of host publication | Proceedings Ninth Workshop on Mathematically Structured Functional Programming (MSFP 2022). |
Volume | 360 |
Publisher | EPTCS |
Publication date | 2022 |
Pages | 1-26 |
DOIs | |
Publication status | Published - 2022 |
Event | 9th Workshop on Mathematically Structured Functional Programming, MSFP 2022 - Munich, Germany Duration: 2 Apr 2022 → … |
Conference
Conference | 9th Workshop on Mathematically Structured Functional Programming, MSFP 2022 |
---|---|
Country/Territory | Germany |
City | Munich |
Period | 02/04/2022 → … |
Series | Electronic Proceedings in Theoretical Computer Science, EPTCS |
---|---|
Volume | 360 |
ISSN | 2075-2180 |
Bibliographical note
Funding Information:Acknowledgements. This work was made possible by Independent Research Fund Denmark grants FUTHARK: Functional Technology for High-performance Architectures, Deep Probabilistic Programming for Protein Structure Prediction (DPP), and DFF–International Postdoc 0131-00025B. We would like to thank Gabriele Keller, Ken Friis Larsen and Dimitrios Vytionitis for collaborative discussions over the last six years that have greatly helped in developing the foundations of combinatory differentiation and our colleagues on FUTHARK and DPP, in particular Cosmin Oancea, Troels Henriksen, Thomas Hamelryck and Ola Rønning. Furthermore, the second author would like to thank Conal Elliott for stimulating exchanges on AD in the period he was working on his ICFP 2018 paper [13]. We greatly appreciate and thank the three anonymous referees for their recommendations.
Funding Information:
This work was made possible by Independent Research Fund Denmark grants FUTHARK: Functional Technology for High-performance Architectures, Deep Probabilistic Programming for Protein Structure Prediction (DPP), and DFF-International Postdoc 0131-00025B.We would like to thank Gabriele Keller, Ken Friis Larsen and Dimitrios Vytionitis for collaborative discussions over the last six years that have greatly helped in developing the foundations of combinatory differentiation and our colleagues on FUTHARK and DPP, in particular Cosmin Oancea, Troels Henriksen, Thomas Hamelryck and Ola Rønning. Furthermore, the second author would like to thank Conal Elliott for stimulating exchanges on AD in the period he was working on his ICFP 2018 paper [13]. We greatly appreciate and thank the three anonymous referees for their recommendations.
Publisher Copyright:
© 2022 Elsman, Henglein, Kaarsgaard, Mathiesen, Schenck.