arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2402.14212cs.LGcs.AI
收藏

Moonwalk: 逆-前向微分

Moonwalk: Inverse-Forward Differentiation

University of California, Irvine(加州大学尔湾分校)

Dmitrii Krylov, Armin Karamzade, Roy Fox

AI总结:

针对反向传播需要存储中间激活值导致网络深度受限的问题,提出Moonwalk方法,通过引入子mersive网络和碎片梯度检查点,利用向量-逆-雅可比乘积(vijp)操作在无需存储激活值的情况下重建梯度,实现了与反向传播相当的运行时间且支持更深的网络。

摘要:

反向传播的主要限制是它需要在正向传播过程中存储中间激活值(残差),这限制了可训练网络的深度。这引出了一个基本问题:我们能否避免存储这些激活值?我们通过重新审视梯度计算的结构来解决这个问题。反向传播通过一系列向量-雅可比乘积计算梯度,这一操作通常是不可逆的。丢失的信息位于每层雅可比矩阵的余核中。我们定义了浸没式网络——其层雅可比矩阵具有平凡余核的网络——在这种网络中,梯度可以在前向扫描中精确重建,而无需存储激活值。对于非浸没式层,我们引入了碎片梯度检查点,仅记录恢复被雅可比矩阵擦除的余切向量所需的最小残差子集。我们方法的核心是一种新的算子,即向量-逆-雅可比乘积(vijp),它反转了余核外的梯度流。我们的混合模式算法首先通过内存高效的反向传播计算输入梯度,然后使用vijp在前向扫描中重建参数梯度,从而消除了存储激活值的需要。我们在Moonwalk中实现了该方法,并表明它在相同内存预算下训练深度超过两倍的网络时,运行时间与反向传播相当。

英文摘要:

Backpropagation's main limitation is its need to store intermediate activations (residuals) during the forward pass, which restricts the depth of trainable networks. This raises a fundamental question: can we avoid storing these activations? We address this by revisiting the structure of gradient computation. Backpropagation computes gradients through a sequence of vector-Jacobian products, an operation that is generally irreversible. The lost information lies in the cokernel of each layer's Jacobian. We define submersive networks -- networks whose layer Jacobians have trivial cokernels -- in which gradients can be reconstructed exactly in a forward sweep without storing activations. For non-submersive layers, we introduce fragmental gradient checkpointing, which records only the minimal subset of residuals necessary to restore the cotangents erased by the Jacobian. Central to our approach is a novel operator, the vector-inverse-Jacobian product (vijp), which inverts gradient flow outside the cokernel. Our mixed-mode algorithm first computes input gradients with a memory-efficient reverse pass, then reconstructs parameter gradients in a forward sweep using the vijp, eliminating the need to store activations. We implement this method in Moonwalk and show that it matches backpropagation's runtime while training networks more than twice as deep under the same memory budget.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑