arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2512.23329cs.LG
收藏

深度学习中的行人:Transformer中的反向传播

Deep learning for pedestrians: backpropagation in Transformers

Oracle(甲骨文公司);Microsoft(微软)

Laurent Boué

AI总结:

本文通过手动推导Transformer中反向传播,展示如何通过无索引方法实现参数高效微调,并提供GPT-like网络的完整实现。

摘要:

本文是之前关于CNN中反向传播向量化推导论文的延续。遵循之前已经建立的原则和符号,我们现在专注于基于Transformer的下一个token预测架构。为此,我们应用我们的轻量级无索引方法到新的层类型,如嵌入、多头自注意力和层归一化。此外,我们还为LoRA层提供了梯度表达式,以说明参数高效微调。为什么还要手动进行反向传播,当已经有这么多自动执行此任务的工具?任何对值如何向前传播的理解不足,在尝试对损失函数进行微分时都会变得明显。通过手动处理反向传播,我们能更深入地理解每个操作如何影响最终输出。还提供了一个最小istic GPT-like网络的完整PyTorch实现,以及所有梯度更新的分析表达式。

英文摘要:

This document is a follow-up to our previous paper dedicated to a vectorized derivation of backpropagation in CNNs. Following the same principles and notations already put in place there, we now focus on transformer-based next-token-prediction architectures. To this end, we apply our lightweight index-free methodology to new types of layers such as embedding, multi-headed self-attention and layer normalization. In addition, we also provide gradient expressions for LoRA layers to illustrate parameter-efficient fine-tuning. Why bother doing manual backpropagation when there are so many tools that do this automatically? Any gap in understanding of how values propagate forward will become evident when attempting to differentiate the loss function. By working through the backward pass manually, we gain a deeper intuition for how each operation influences the final output. A complete PyTorch implementation of a minimalistic GPT-like network is also provided along with analytical expressions for of all of its gradient updates.

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

↑