注意力汇:一种针对嵌入的“捕获、标记、释放”机制
Attention Sinks: A 'Catch, Tag, Release' Mechanism for Embeddings
AI总结:
本文系统揭示了LLM中注意力汇的“捕获、标记、释放”机制,证明其标记携带语义信息,并扩展至推理模型及查询-键归一化模型,为理论分析引入最小化问题。
摘要:
大型语言模型(LLMs)常常将其注意力集中在少数几个被称为注意力汇(attention sinks)的特定token上。常见的例子包括第一个token(一种与提示无关的汇)和标点符号token(与提示相关)。虽然导致这些汇的token通常缺乏直接的语义含义,但汇的存在对模型性能至关重要,尤其是在模型压缩和KV缓存场景下。尽管注意力汇普遍存在,但其功能、语义角色和起源——尤其是那些位于第一个token之外的汇——仍然未被充分理解。在这项工作中,我们进行了一项全面的研究,证明注意力汇会:捕获一个token序列,使用嵌入空间中的一个共同方向对它们进行标记,然后将它们释放回残差流中,之后这些token会根据其所获得的标记被检索。探测实验表明,这些标记携带具有语义意义的信息,例如陈述的真假。这些发现也扩展到推理模型(其中该机制涉及更多注意力头并解释了嵌入中更大的方差)以及具有查询-键归一化的近期模型(其中汇仍然同样普遍)。为了鼓励未来的理论分析,我们引入了一个最小化问题,该问题可以通过“捕获、标记、释放”机制解决,并且该机制会在训练过程中自然涌现。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。