We introduce Combinatory Homomorphic Automatic Differentiation (CHAD), a principled, pure, provably correct define-then-run method for performing forward- and reverse-mode automatic differentiation (AD) on programming languages with expressive features. It implements AD as a compositional, type-respecting source-code transformation that generates purely functional code. This code transformation is principled in the sense that it is the unique homomorphic (structure-preserving) extension to expressive languages of Elliott's well-known and unambiguous definitions of AD for a first-order functional language. Correctness of the method follows by a compositional logical-relations argument that shows that the semantics of the syntactic derivative is the usual calculus derivative of the semantics of the original program. In their most elegant formulation, the transformations generate code with linear types. However, the code transformations can be implemented in a standard functional language lacking linear types: while the correctness proof requires tracking linearity, the actual transformations do not. In fact, even in a standard functional language, we can get all the type safety that linear types give us: we can implement all linear types used to type the transformations as abstract types by using a basic module system. In this paper, we detail the method when applied to a simple higher-order language for manipulating statically sized arrays. However, we explain how the methodology applies, more generally, to functional languages with other expressive features. Finally, we discuss how the scope of CHAD extends beyond applications in AD to other dynamic program analyses that accumulate data in a commutative monoid.


翻译:我们提出组合同态自动微分(CHAD),这是一种用于对具有表达性特征的编程语言执行前向和反向模式自动微分(AD)的原则性、纯函数式且可证明正确的先定义后运行方法。它将AD实现为一种组合的、保持类型的源代码变换,生成纯函数式代码。该代码变换具有原则性,因为它是对Elliott在一阶函数式语言中关于AD的著名且无歧义定义的唯一同态(保持结构)扩展到表达性语言。该方法的正确性通过组合逻辑关系论证得以证明,表明语法导数的语义是原始程序语义的通常微积分导数。在其最优雅的表述中,这些变换生成具有线性类型的代码。然而,这些代码变换可以在缺乏线性类型的标准函数式语言中实现:虽然正确性证明需要追踪线性性,但实际变换并不需要。事实上,即使在标准函数式语言中,我们也能获得线性类型所提供的全部类型安全性:通过使用基本模块系统,我们可以将用于类型化这些变换的所有线性类型实现为抽象类型。本文详细阐述了该方法应用于操作静态大小数组的简单高阶语言时的情形,并解释了该方法如何更普遍地适用于具有其他表达性特征的函数式语言。最后,我们讨论了CHAD的应用范围如何超越自动微分领域,扩展到在交换幺半群中累积数据的其他动态程序分析。

0
下载
关闭预览

相关内容

最新《自动微分》综述教程,71页ppt
专知会员服务
22+阅读 · 2020年11月22日
自动结构变分推理,Automatic structured variational inference
专知会员服务
41+阅读 · 2020年2月10日
变分自编码器VAE:一步到位的聚类方案
PaperWeekly
25+阅读 · 2018年9月18日
再谈变分自编码器VAE:从贝叶斯观点出发
PaperWeekly
13+阅读 · 2018年4月2日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Arxiv
0+阅读 · 3月31日
VIP会员
最新内容
AutoScientists:自组织智能体团队驱动长期科学实验
战略前沿人工智能的再思考(中文)
专知会员服务
3+阅读 · 今天14:53
《量化地基防空系统间接效应的博弈论方法》
专知会员服务
3+阅读 · 今天14:51
“史诗怒火行动”中美军损失的作战飞机
专知会员服务
2+阅读 · 今天14:38
ICML 2026 | 理解上下文持续学习中的泛化与遗忘
专知会员服务
5+阅读 · 5月28日
Agent Harness综述:大模型智能体执行器工程全景
专知会员服务
13+阅读 · 5月28日
《基于理论的威慑效能评估》
专知会员服务
8+阅读 · 5月28日
相关VIP内容
最新《自动微分》综述教程,71页ppt
专知会员服务
22+阅读 · 2020年11月22日
自动结构变分推理,Automatic structured variational inference
专知会员服务
41+阅读 · 2020年2月10日
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员