发现大模型注意力集中在特定标记上,通过捕获、标记、释放机制传递语义信息。
Attention Sinks: A 'Catch, Tag, Release' Mechanism for Embeddings
- 用捕获-标记-释放机制解释注意力集中现象
- 标记包含语义信息如陈述真假性,影响后续推理
- 适用于推理模型和归一化架构,适合研究注意力机制者
大型语言模型常将注意力集中在少数特定标记上,称为注意力汇聚点。常见例子包括首标记(与提示无关)和标点符号(与提示相关),这些标记虽无直接语义,但对模型性能至关重要,尤其在模型压缩和键值缓存场景下。尽管其普遍存在,但注意力汇聚点的功能、语义角色及起源仍不清晰,尤其超出首标记的情况。本文通过全面研究发现:注意力汇聚点会捕获一段标记序列,在嵌入空间中用同一方向进行标记,再将其释放回残差流,后续可通过标签检索对应内容。探针实验表明,这些标签携带有意义的语义信息,如陈述真伪。该机制延伸至推理模型,覆盖更多注意力头并解释更大嵌入方差;也适用于采用查询-键归一化的近期模型,其中汇聚点依然普遍存在。为促进未来理论分析,我们提出一个最小问题,其解可通过‘捕获-标记-释放’机制实现,且在训练中自然涌现。
原文摘要 · Abstract (English)
Large language models (LLMs) often concentrate their attention on a few specific tokens referred to as attention sinks. Common examples include the first token, a prompt-independent sink, and punctuation tokens, which are prompt-dependent. While the tokens causing the sinks often lack direct semantic meaning, the presence of the sinks is critical for model performance, particularly under model compression and KV-caching. Despite their ubiquity, the function, semantic role, and origin of attention sinks -- especially those beyond the first token -- remain poorly understood. In this work, we conduct a comprehensive investigation demonstrating that attention sinks: catch a sequence of tokens, tag them using a common direction in embedding space, and release them back into the residual stream, where tokens are later retrieved based on the tags they have acquired. Probing experiments reveal these tags carry semantically meaningful information, such as the truth of a statement. These findings extend to reasoning models, where the mechanism spans more heads and explains greater variance in embeddings, or recent models with query-key normalization, where sinks remain just as prevalent. To encourage future theoretical analysis, we introduce a minimal problem which can be solved through the 'catch, tag, release' mechanism, and where it emerges through training.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。