Using Rewrite Strategies for Efficient Functional Automatic Differentiation

Timon Böhler, D. Richter, M. Mezini
{"title":"Using Rewrite Strategies for Efficient Functional Automatic Differentiation","authors":"Timon Böhler, D. Richter, M. Mezini","doi":"10.1145/3605156.3606456","DOIUrl":null,"url":null,"abstract":"Automatic Differentiation (AD) has become a dominant technique in ML. AD frameworks have first been implemented for imperative languages using tapes. Meanwhile, functional implementations of AD have been developed, often based on dual numbers, which are close to the formal specification of differentiation and hence easier to prove correct. But these papers have focussed on correctness not efficiency. Recently, it was shown how an approach using dual numbers could be made efficient through the right optimizations. Optimizations are highly dependent on order, as one optimization can enable another. It can therefore be useful to have fine-grained control over the scheduling of optimizations. One method expresses compiler optimizations as rewrite rules, whose application can be combined and controlled using strategy languages. Previous work describes the use of term rewriting and strategies to generate high-performance code in a compiler for a functional language. In this work, we implement dual numbers AD in a functional array programming language using rewrite rules and strategy combinators for optimization. We aim to combine the elegance of differentiation using dual numbers with a succinct expression of the optimization schedule using a strategy language. We give preliminary evidence suggesting the viability of the approach on a micro-benchmark.","PeriodicalId":254071,"journal":{"name":"Proceedings of the 25th ACM International Workshop on Formal Techniques for Java-like Programs","volume":"82 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2023-07-05","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the 25th ACM International Workshop on Formal Techniques for Java-like Programs","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/3605156.3606456","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

Abstract

Automatic Differentiation (AD) has become a dominant technique in ML. AD frameworks have first been implemented for imperative languages using tapes. Meanwhile, functional implementations of AD have been developed, often based on dual numbers, which are close to the formal specification of differentiation and hence easier to prove correct. But these papers have focussed on correctness not efficiency. Recently, it was shown how an approach using dual numbers could be made efficient through the right optimizations. Optimizations are highly dependent on order, as one optimization can enable another. It can therefore be useful to have fine-grained control over the scheduling of optimizations. One method expresses compiler optimizations as rewrite rules, whose application can be combined and controlled using strategy languages. Previous work describes the use of term rewriting and strategies to generate high-performance code in a compiler for a functional language. In this work, we implement dual numbers AD in a functional array programming language using rewrite rules and strategy combinators for optimization. We aim to combine the elegance of differentiation using dual numbers with a succinct expression of the optimization schedule using a strategy language. We give preliminary evidence suggesting the viability of the approach on a micro-benchmark.
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
利用重写策略实现高效的功能自动区分
自动区分(AD)已经成为机器学习中的主要技术。AD框架首先是在命令式语言中使用磁带实现的。同时,AD的功能实现已经被开发出来,通常基于对偶数,这更接近微分的形式规范,因此更容易证明是正确的。但是这些论文关注的是正确性而不是效率。最近,我们展示了如何通过正确的优化使使用对偶数的方法变得高效。优化高度依赖于顺序,因为一个优化可以启用另一个优化。因此,对优化调度进行细粒度控制是很有用的。一种方法将编译器优化表达为重写规则,其应用可以使用策略语言进行组合和控制。以前的工作描述了使用术语重写和策略在函数式语言的编译器中生成高性能代码。在这项工作中,我们使用重写规则和策略组合子进行优化,在函数数组编程语言中实现对偶数AD。我们的目标是将使用对偶数的微分的优雅性与使用策略语言的优化调度的简洁表达结合起来。我们给出了初步证据,表明该方法在微观基准上的可行性。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 去求助
来源期刊
自引率
0.00%
发文量
0
期刊最新文献
Runtime Verification of Hash Code in Mutable Classes Dependency-Free Capture Tracking Verifying Well-Typedness Preservation of Refactorings using Scope Graphs Correctness-by-Construction Meets Refinement Types Gradual Guarantee for FJ with lambda-Expressions
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1