Attention Sinks and Compression Valleys in LLMs are Two Sides of the Same Coin
作者: Enrique Queipo-de-Llano, Álvaro Arroyo, Federico Barbero, Xiaowen Dong, Michael Bronstein, Yann LeCun, Ravid Shwartz-Ziv
分类: cs.LG, cs.AI
发布日期: 2025-10-07
💡 一句话要点
揭示LLM中Attention Sink与压缩谷的关联,提出Mix-Compress-Refine信息流理论
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 大型语言模型 Attention Sink 压缩谷 信息流理论 表征压缩
📋 核心要点
- 现有研究孤立地看待LLM中的Attention Sinks和压缩谷现象,缺乏统一解释。
- 论文核心思想是将两者联系起来,归因于残差流中大规模激活的形成,并提出Mix-Compress-Refine信息流理论。
- 实验验证了理论预测,并解释了不同任务在不同层表现的差异,为理解LLM的计算组织方式提供了新视角。
📝 摘要(中文)
Attention sinks和压缩谷是大型语言模型(LLM)中两个令人困惑的现象,但一直被孤立地研究。本文揭示了attention sinks和压缩谷之间令人惊讶的联系,并将两者都追溯到残差流中大规模激活的形成。我们从理论上证明了大规模激活必然会产生表征压缩,并建立了由此产生的熵减少的界限。通过对多个模型(410M-120B参数)的实验,我们证实了当序列起始token在中间层中发展出极端的激活范数时,压缩谷和attention sinks会同时出现。有针对性的消融研究验证了我们的理论预测。这种统一的观点促使我们提出Mix-Compress-Refine信息流理论,试图解释LLM如何通过控制attention和通过大规模激活进行表征压缩来组织其深度计算。具体来说,我们假设基于Transformer的LLM分三个不同的阶段处理token:(1)早期层的广泛混合,(2)中间层的压缩计算和有限混合,以及(3)后期层的选择性细化。我们的框架有助于解释为什么嵌入任务在中间层表现最佳,而生成任务受益于全深度处理,从而阐明了任务相关表示的差异。
🔬 方法详解
问题定义:大型语言模型(LLM)中存在Attention Sinks和压缩谷两种现象,Attention Sinks指的是模型在处理序列时,初始的几个token会吸引大部分的注意力,导致后续token的信息丢失;压缩谷指的是模型在中间层会发生表征压缩,导致信息损失。现有研究通常将这两种现象孤立地看待,缺乏统一的解释和理解。这阻碍了我们深入理解LLM内部的信息处理机制,并可能影响模型性能的优化。
核心思路:论文的核心思路是将Attention Sinks和压缩谷联系起来,认为它们都是由残差流中大规模激活的形成引起的。具体来说,当序列起始token在中间层发展出极端的激活范数时,会导致后续token的信息被压缩,从而形成压缩谷,同时也会吸引大部分的注意力,形成Attention Sinks。通过这种联系,论文试图建立一个统一的理论框架来解释这两种现象。
技术框架:论文提出了Mix-Compress-Refine信息流理论,该理论将Transformer-based LLM的信息处理过程分为三个阶段:(1)Mix阶段:在早期层,模型进行广泛的混合,将输入token的信息进行初步融合。(2)Compress阶段:在中间层,模型进行压缩计算,通过大规模激活来压缩信息,形成压缩谷和Attention Sinks。(3)Refine阶段:在后期层,模型进行选择性细化,对压缩后的信息进行精细处理,生成最终的输出。
关键创新:论文最重要的技术创新点在于建立了Attention Sinks和压缩谷之间的联系,并提出了Mix-Compress-Refine信息流理论。该理论提供了一个新的视角来理解LLM内部的信息处理机制,并解释了不同任务在不同层表现的差异。与现有方法相比,该理论更加全面和统一,能够更好地解释LLM的内部工作原理。
关键设计:论文通过理论分析推导了大规模激活导致表征压缩的数学界限,并设计了针对性的消融实验来验证理论预测。实验中,作者使用了不同规模的LLM(410M-120B参数),并对序列起始token的激活范数进行了控制和干预,观察Attention Sinks和压缩谷的变化。此外,作者还分析了不同任务(如嵌入任务和生成任务)在不同层的表现,验证了Mix-Compress-Refine信息流理论的有效性。
🖼️ 关键图片
📊 实验亮点
实验结果表明,当序列起始token在中间层发展出极端的激活范数时,压缩谷和Attention Sinks会同时出现,验证了论文的理论预测。此外,实验还发现嵌入任务在中间层表现最佳,而生成任务受益于全深度处理,这与Mix-Compress-Refine信息流理论相符,进一步证明了该理论的有效性。
🎯 应用场景
该研究成果可应用于提升大型语言模型的性能和可解释性。通过理解Attention Sinks和压缩谷的形成机制,可以设计更有效的训练策略和模型结构,从而提高模型的生成质量和推理能力。此外,该研究还有助于开发更高效的知识压缩和检索技术,以及更好地理解人类语言的认知过程。
📄 摘要(原文)
Attention sinks and compression valleys have attracted significant attention as two puzzling phenomena in large language models, but have been studied in isolation. In this work, we present a surprising connection between attention sinks and compression valleys, tracing both to the formation of massive activations in the residual stream. We prove theoretically that massive activations necessarily produce representational compression and establish bounds on the resulting entropy reduction. Through experiments across several models (410M-120B parameters), we confirm that when the beginning-of-sequence token develops extreme activation norms in the middle layers, both compression valleys and attention sinks emerge simultaneously. Targeted ablation studies validate our theoretical predictions. This unified view motivates us to propose the Mix-Compress-Refine theory of information flow, as an attempt to explain how LLMs organize their computation in depth by controlling attention and representational compression via massive activations. Specifically, we posit that Transformer-based LLMs process tokens in three distinct phases: (1) broad mixing in the early layers, (2) compressed computation with limited mixing in the middle layers, and (3) selective refinement in the late layers. Our framework helps explain why embedding tasks perform best at intermediate layers, whereas generation tasks benefit from full-depth processing, clarifying differences in task-dependent representations.