教你怎么正确对复数做自动微分,避开复杂分析陷阱
A tutorial on automatic differentiation with complex numbers
- 用线性代数推导复数的Jacobian乘积,不依赖复分析
- 明确给出前向与反向模式的梯度规则,可直接实现
- 适合开发自定义梯度的工程师和研究人员
自动微分广泛使用,但复数域上的实现缺乏清晰文档。现有资料仅简单指出复空间ℂᵈ等价于ℝ²ᵈ,或浅谈Wirtinger微分,这在需要自定义梯度规则时(如跳过昂贵的线性代数函数或微分方程模拟器)已不足。本文系统梳理复数的前向与反向自动微分,涵盖Wirtinger导数、修正链式法则及不同梯度约定,完全避免依赖全纯性与Cauchy-Riemann方程(过于严格)。通过纯线性代数推导并实现复数的Jacobian-向量积与向量-Jacobian积,为开发者提供可落地的指南。本文呼吁用户与开发者正视复数值梯度传播,本稿即为此提供方法。
原文摘要 · Abstract (English)
Automatic differentiation is everywhere, but there exists only minimal documentation of how it works in complex arithmetic beyond stating "derivatives in $\mathbb{C}^d$" $\cong$ "derivatives in $\mathbb{R}^{2d}$" and, at best, shallow references to Wirtinger calculus. Unfortunately, the equivalence $\mathbb{C}^d \cong \mathbb{R}^{2d}$ becomes insufficient as soon as we need to derive custom gradient rules, e.g., to avoid differentiating "through" expensive linear algebra functions or differential equation simulators. To combat such a lack of documentation, this article surveys forward- and reverse-mode automatic differentiation with complex numbers, covering topics such as Wirtinger derivatives, a modified chain rule, and different gradient conventions while explicitly avoiding holomorphicity and the Cauchy--Riemann equations (which would be far too restrictive). To be precise, we will derive, explain, and implement a complex version of Jacobian-vector and vector-Jacobian products almost entirely with linear algebra without relying on complex analysis or differential geometry. This tutorial is a call to action, for users and developers alike, to take complex values seriously when implementing custom gradient propagation rules -- the manuscript explains how.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。