paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Perturbation confusion in forward automatic differentiation of higher-order functions

高阶函数前向自动微分中的扰动混淆
JFP vol.292019匹配度 2/10 · 论文关注高阶函数前向自动微分中的扰动标记 bug,属于函数式编程与 AD 实现正确性问题;与用户主攻的 ML/Agentic 程序静态分析、LLM 改进静态分析/形式化验证、浮点程序分析与 LLM 交叉等方向没有直接关联。引用 20 inbox
OLEKSANDR MANZYUK, BARAK A. PEARLMUTTER, ALEXEY ANDREYEVICH RADUL, DAVID R. RUSH, JEFFREY MARK SISKIND
crossref: 2026-09-10

AI 速览

一句话:揭示高阶函数前向自动微分中扰动标记失效导致结果错误的微妙 bug,并讨论两种修复方案及其缺陷。

自动微分(AD)在前向模式中给每个数附加扰动,并通过重载算术运算传播导数。嵌套求导时,不同导数计算及其扰动必须被区分,现有实现通常为每次求导创建唯一标签并标记扰动。本文指出一个已部署实现中的微妙缺陷:尽管有标签机制,扰动仍会混淆并导致错误结果,尤其在高阶函数上。其根源是:标签应对应每个导数计算,而现有实现却在“在点求函数导数”时创建标签;对高阶函数(如柯里化函数)二者不必一致。作者给出反例并讨论两种修复方案:用 eta 展开延迟新标签创建,或包装导数算子输出做标签替换;两者都难以不破坏前向 AD 复杂度保证。

问题
在高阶函数的前向自动微分中,嵌套导数需要区分不同扰动,但现有标签机制在标签创建时机上出错,导致扰动混淆和错误结果。
方法
分析已部署实现的标签机制,构造一个其导数本身是求导函数的高阶函数反例,并讨论 eta 展开与标签替换两种修复方案。
评估
以概念分析和反例揭示缺陷,定性讨论两种方案的不足及其对前向 AD 复杂度保证的影响,未进行实证基准评估。
原文摘要(Abstract)

Abstract Automatic differentiation (AD) is a technique for augmenting computer programs to compute derivatives. The essence of AD in its forward accumulation mode is to attach perturbations to each number, and propagate these through the computation by overloading the arithmetic operators. When derivatives are nested, the distinct derivative calculations, and their associated perturbations, must be distinguished. This is typically accomplished by creating a unique tag for each derivative calculation and tagging the perturbations. We exhibit a subtle bug, present in fielded implementations which support derivatives of higher-order functions, in which perturbations are confused despite the tagging machinery, leading to incorrect results. The essence of the bug is as follows: a unique tag is needed for each derivative calculation, but in existing implementations unique tags are created when taking the derivative of a function at a point. When taking derivatives of higher-order functions, these need not correspond! We exhibit a simple example: a higher-order function f whose derivative at a point x , namely f ′( x ), is itself a function which calculates a derivative. This situation arises naturally when taking derivatives of curried functions. Two potential solutions are presented, and their deficiencies discussed. One uses eta expansion to delay the creation of fresh tags in order to put them into one-to-one correspondence with derivative calculations. The other wraps outputs of derivative operators with tag substitution machinery. Both solutions seem very difficult to implement without violating the desirable complexity guarantees of forward AD.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot720,
  title = {Perturbation confusion in forward automatic differentiation of higher-order functions},
  author = {OLEKSANDR MANZYUK and BARAK A. PEARLMUTTER and ALEXEY ANDREYEVICH RADUL and DAVID R. RUSH and JEFFREY MARK SISKIND},
  journal = {Journal of Functional Programming},
  volume = {29},
  year = {2019},
  doi = {10.1017/s095679681900008x}
}