Affiliation:
1. Utrecht University, Netherlands
Abstract
Where dual-numbers forward-mode automatic differentiation (AD) pairs each scalar value with its tangent value, dual-numbers
reverse-mode
AD attempts to achieve reverse AD using a similarly simple idea: by pairing each scalar value with a backpropagator function. Its correctness and efficiency on higher-order input languages have been analysed by Brunel, Mazza and Pagani, but this analysis used a custom operational semantics for which it is unclear whether it can be implemented efficiently. We take inspiration from their use of
linear factoring
to optimise dual-numbers reverse-mode AD to an algorithm that has the correct complexity and enjoys an efficient implementation in a standard functional language with support for mutable arrays, such as Haskell. Aside from the linear factoring ingredient, our optimisation steps consist of well-known ideas from the functional programming community. We demonstrate the use of our technique by providing a practical implementation that differentiates most of Haskell98.
Publisher
Association for Computing Machinery (ACM)
Subject
Safety, Risk, Reliability and Quality,Software
Reference34 articles.
1. A simple differentiable programming language
2. Automatic Differentiation in Machine Learning: a Survey;Baydin Atilim Gunes;J. Mach. Learn. Res.,2017
3. Linear Haskell: practical linearity in a higher-order polymorphic language
4. Backpropagation in the simply typed lambda-calculus with linear negation
5. Paulo Emílio de Vilhena and François Pottier. 2021. Verifying a Minimalist Reverse-Mode AD Library. arXiv preprint arXiv:2112.07292. Paulo Emílio de Vilhena and François Pottier. 2021. Verifying a Minimalist Reverse-Mode AD Library. arXiv preprint arXiv:2112.07292.
Cited by
4 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. A Tensor Algebra Compiler for Sparse Differentiation;2024 IEEE/ACM International Symposium on Code Generation and Optimization (CGO);2024-03-02
2. Efficient CHAD;Proceedings of the ACM on Programming Languages;2024-01-05
3. Automatic Differentiation in Prolog;Theory and Practice of Logic Programming;2023-07
4. ωPAP Spaces: Reasoning Denotationally About Higher-Order, Recursive Probabilistic and Differentiable Programs;2023 38th Annual ACM/IEEE Symposium on Logic in Computer Science (LICS);2023-06-26