arXiv:2603.16039cs.LGcs.AI2026-03被引 2

揭示了Transformer中残差路径的双重性,为优化设计提供新视角。

Residual Stream Duality in Modern Transformer Architectures

  • 从序列位置与层深度双维度重构Transformer架构理解
  • 发现残差流与短滑动窗口注意力在局部操作上本质等价
  • 建议根据目标选择深度学习或序列轴注意力机制

近期研究表明,残差路径不仅是优化工具,更是模型表征机制的一部分。本文提出,通过序列位置和层深度两个有序维度来理解Transformer架构最为清晰。自注意力已在序列轴上实现自适应混合,而残差流通常沿深度轴进行固定加法。若固定标记位置,将层索引视为有序变量,则因果深度残差注意力恰好等同于因果短滑动窗口注意力(ShortSWA),只是作用于深度而非序列。这一核心对偶性构成了Transformer²的基础。该视角也解释了现有文献:ELC-BERT与DenseFormer表明,学习到的深度聚合可优于均匀残差累加;而Vertical Attention、DeepCrossAttention(DCA)、MUDDFormer及Attention Residuals则进一步推进了显式注意力驱动的早期层路由。但需注意,操作层面的对偶性不等于系统级对称性。对于大规模自回归模型,序列轴的ShortSWA更利于硬件部署,因其可复用标记侧滑动窗口核、键值缓存布局与分块执行。若目标是改变捷径本身,则深度增量学习(DDL)更为直接,因为它直接修改残差算子,而非添加独立的跨层检索路径。因此建议:当关注捷径本身时采用DDL,追求局部自适应混合时使用序列轴ShortSWA。

原文摘要 · Abstract (English)

Recent work has made clear that the residual pathway is not mere optimization plumbing; it is part of the model's representational machinery. We agree, but argue that the cleanest way to organize this design space is through a two-axis view of the Transformer. A decoder evolves information along two ordered dimensions: sequence position and layer depth. Self-attention already provides adaptive mixing along the sequence axis, whereas the residual stream usually performs fixed addition along the depth axis. If we fix a token position and treat layer index as the ordered variable, then a causal depth-wise residual attention read is exactly the same local operator as causal short sliding-window attention (ShortSWA), except written over depth rather than over sequence. This is the core residual stream duality behind Transformer$^2$. This perspective also clarifies the recent literature. ELC-BERT and DenseFormer already show that learned aggregation over depth can outperform uniform residual accumulation, while Vertical Attention, DeepCrossAttention (DCA), MUDDFormer, and Attention Residuals move further toward explicit attention-based routing over earlier layers. The key point, however, is that operator-level duality does not imply systems-level symmetry. For large-scale autoregressive models, sequence-axis ShortSWA is usually the more hardware-friendly placement because it reuses token-side sliding-window kernels, KV-cache layouts, and chunked execution. If the goal is instead to change the shortcut itself, Deep Delta Learning (DDL) is the cleaner intervention because it modifies the residual operator directly rather than adding a separate cross-layer retrieval path. Our recommendation is therefore simple: use DDL when the shortcut is the object of interest, and use sequence-axis ShortSWA when the goal is local adaptive mixing.

Transformer残差路径注意力机制架构设计

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。