“I think this paper describes relatively well what is so special about the Julia autodiff tools”
Don't Unroll Adjoint: Differentiating SSA-Form Programs
基于 SSA 形式的源码变换反向自动微分,Julia 的 Zygote 的原理
论文提出基于源码变换的反向模式自动微分(AD),针对现代编译器使用的静态单赋值(SSA)形式。该方法能支持控制流、嵌套、变异、递归、数据结构和高阶函数等语言结构,其输出交给现有编译器生成高效的微分代码。作者在 Julia 语言上实现了名为 Zygote 的新 AD 工具,对外呈现高层动态语义,同时在底层透明地编译伴随代码,并讨论了这种做法对 AD 工具易用性与性能的好处。
HN 上的人用它说明 Julia 自动微分的特别之处:把 AD 作为编译器对 SSA 的变换,从而避开 JAX 那类追踪(tracing)方式的限制,常在谈 Zygote.jl 时引用。
学习路径
读这篇之前,按顺序读书架上的 2 篇 · 参考文献来自 OpenAlex,顺序和要点由 Claude Code 排出这条路径帮你看到动态神经网络工具包对自动微分的新需求,以及 Julia 上整体编译的背景,再读基于 SSA 的反向微分。
- 1
动态网络工具包要求框架能处理随输入变化的计算,说明为什么需要支持控制流的微分。
读动态声明(dynamic declaration)计算图的思路。
- 2
同在 Julia 生态,说明如何把 Julia 程序整体编译到加速器上,与源码变换式微分相互配合。
读把 Julia 代码交给 XLA 整体编译的流程;不必深究 TPU 实验。
- 3Don't Unroll Adjoint: Differentiating SSA-Form Programs
对编译器使用的 SSA 形式做源码变换式反向微分,原理实现为 Zygote。
读SSA 形式上的反向模式微分如何处理控制流和数据结构。
HN 书评
推荐在前,同类按时间 · 每篇最多保留 20 条,统计用全部提及“Mike has some details in an earlier paper: Don't Unroll Adjoint.”
“I have not read the paper yet but, reading the abstract, the idea of using continuation to store the differentiation information is reminiscent of the technique used in Zygote[0].”
“see the description of Zygote.jl Don't Unroll Adjoint”
“If you see the paper that was the synthesis for Zygote.jl, it was all about while loops and scalar operations.”
- Don't Unroll Adjoint: Differentiating SSA-Form Programs ↗ChrisRackauckas · 2018-10-20 · 1 分
- Don't Unroll Adjoint: Differentiating SSA-Form Programs ↗one-more-minute · 2018-10-23 · 2 分
- Don't Unroll Adjoint: Differentiating SSA-Form Programs ↗ViralBShah · 2018-10-24 · 1 分
- Differentiating SSA-Form Programs in Julia (2018) [pdf] ↗idiliv · 2019-02-08 · 87 分