你的注意力指标究竟在回答哪个问题?作为成分数据的注意力行
文章背景与核心概要
在深度学习和大语言模型研究中,Transformer 的注意力机制通常将 token 之间的关系表示为跨行的概率分布,其中很大一部分概率往往集中在单个“沉淀(sink)”token 上(通常是第一个 token)。当研究人员使用余弦相似度、詹森-香农散度或香农熵等标准指标比较注意力行时,他们往往会做出一个隐含且未加报告的选择:保留沉淀 token,还是将其丢弃并重新归一化。
本文深入探讨了这一看似微不足道的惯例选择,并证明其具有颠覆研究结论的重大影响。作者通过研究发现,在来自 5 个家族的 10 个预训练模型中,有 17% 到 47% 关于“哪个注意力头更相似”的结论会根据所选惯例完全翻转;标准 BERT 注意力头聚类管线中最显著的聚类结构实际上也是这种惯例的产物。
通过将注意力行视为成分数据(compositional data),作者提供了一个严谨的数学框架,巧妙地将两个截然不同的问题区分开来:沉淀 token 捕获了多少注意力?与剩余的注意力如何在内容 token 之间分布?利用这一方法可以防止严重的下游问题,例如误解训练过程中的熵坍缩,以及避免模型剪枝期间灾难性的困惑度飙升。
核心发现与方法论 (Key Findings & Methodology)
- 双重问题困扰: 标准的单一数字汇总将沉淀 token 的权重与剩余内容 token 的分布混为一谈。
- 成分数据分离:
- Aitchison 距离正交分裂为沉淀项和内容项。
- 熵(Entropy)通过精确恒等式进行分裂。
- 内容距离由 Transformer 架构固有的特定数学不变性来表征。
- 现实世界的影响:
- 模型训练期间测得的大多数“熵坍缩”实际上只是沉淀 token 变大了,而不是注意力变得更集中(在 70M 参数下占下降幅度的 30%,1.4B 下占 79%,在 1B 参数下高达 95%)。
- 使用错误的成分通道剪枝注意力头,可能会使模型的困惑度(perplexity)暴增一百多倍。
- The Two-Question Problem: Standard one-number summaries conflate the sink token's weight with the distribution of the remaining content tokens.
- Compositional Data Separation:
- The Aitchison distance splits orthogonally into a sink term and a content term.
- Entropy splits via an exact identity.
- Content distance is characterized by specific mathematical invariances native to the transformer architecture.
- Real-World Implications:
- Most measured "entropy collapse" during model training is actually just the sink token growing larger, rather than attention sharpening (accounting for 30% of the drop at 70M parameters, 79% at 1.4B, and up to 95% at 1B parameters).
- Pruning attention heads using the incorrect compositional channel can inflate a model's perplexity by over a hundredfold.
链接与资源 (Links & Resources)
- Full Text Access: View PDF | HTML Version | TeX Source
- Code & Replication: The authors provide code to regenerate every statistical claim and figure presented in the paper.
(This work is licensed under a Creative Commons Attribution 4.0 International License)