一句话:从简单规约推导通用自动微分算法,特化后得到无图、无磁带、无变异的简洁反向模式 AD。
反向模式自动微分(RAD)是深度学习和大规模优化的核心组件,但常用的反向传播等算法复杂且带状态,难以理解、改进和并行执行。本文从一条简单自然的规约出发,推导出一个通用 AD 算法,并通过改变导数的表示来特化该算法。特别是,对朴素表示应用已知构造,可得到两个远比以往简洁的 RAD 算法。所得算法不涉及图、磁带、变量、偏导数或变异,因而天然适合并行、构造即正确,并可借助与 AD 无关的编译器插件直接在现有编程语言中使用,无需新数据类型或编程风格。
Automatic differentiation (AD) in reverse mode (RAD) is a central component of deep learning and other uses of large-scale optimization. Commonly used RAD algorithms such as backpropagation, however, are complex and stateful, hindering deep understanding, improvement, and parallel execution. This paper develops a simple, generalized AD algorithm calculated from a simple, natural specification. The general algorithm is then specialized by varying the representation of derivatives. In particular, applying well-known constructions to a naive representation yields two RAD algorithms that are far simpler than previously known. In contrast to commonly used RAD implementations, the algorithms defined here involve no graphs, tapes, variables, partial derivatives, or mutation. They are inherently parallel-friendly, correct by construction, and usable directly from an existing programming language with no need for new data types or programming style, thanks to use of an AD-agnostic compiler plugin.