发现注意力与残差异常值是训练稳定的关键,需通过归一化协同调控。
A Unified View of Attention and Residual Sinks: Outlier-Driven Rescaling is Essential for Transformer Training
- 异常值与归一化共同作用,实现对模型各部分的动态重标度。
- 移除异常值或不加归一化会降低训练稳定性和性能,证明其必要性。
- 可将异常值融入可学习参数,提升量化鲁棒性与训练效果。
我们研究了大语言模型中涌现的异常值功能,特别是注意力异常值(少数持续获得高注意力得分的标记)和残差异常值(少数在多数标记中保持高激活的维度)。假设这些异常值与归一化方法(如softmax注意力和RMSNorm)协同,有效重标度其他非异常值组件。我们称之为‘异常值驱动重标度’,并在多种模型架构和训练样本量下验证该假设。主要结论包括:(1) 异常值与归一化共同作用,移除归一化会消除对应异常值但损害训练稳定性与性能;保留归一化但直接裁剪异常值同样导致性能下降,表明异常值驱动重标度对训练稳定性的贡献不可替代。(2) 异常值更多作为重标度因子而非实际贡献者,其最终贡献远小于非异常值。(3) 可将异常值吸收进可学习参数或通过显式门控重标度进行缓解,平均提升2分性能,且在W4A4量化下降低1.2分退化。
原文摘要 · Abstract (English)
We investigate the functional role of emergent outliers in large language models, specifically attention sinks (a few tokens that consistently receive large attention logits) and residual sinks (a few fixed dimensions with persistently large activations across most tokens). We hypothesize that these outliers, in conjunction with the corresponding normalizations (\textit{e.g.}, softmax attention and RMSNorm), effectively rescale other non-outlier components. We term this phenomenon \textit{outlier-driven rescaling} and validate this hypothesis across different model architectures and training token counts. This view unifies the origin and mitigation of both sink types. Our main conclusions and observations include: (1) Outliers function jointly with normalization: removing normalization eliminates the corresponding outliers but degrades training stability and performance; directly clipping outliers while retaining normalization leads to degradation, indicating that outlier-driven rescaling contributes to training stability. (2) Outliers serve more as rescale factors rather than contributors, as the final contributions of attention and residual sinks are significantly smaller than those of non-outliers. (3) Outliers can be absorbed into learnable parameters or mitigated via explicit gated rescaling, leading to improved training performance (average gain of 2 points) and enhanced quantization robustness (1.2 points degradation under W4A4 quantization).
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。