arXiv:2602.01893cs.AIcs.LG2026-02

用几何视角解析大模型注意力机制的选词行为。

Geometric Analysis of Token Selection in Multi-Head Attention

  • 将注意力视为顶N选择,从值状态空间分析选中与未选中词元的分离性。
  • 理论预测小N时分离度最强,且序列长度与锚点相似性影响关键指标。
  • 发现模型头具三类几何特征,可解释注意力机制设计与稀疏化优化。

本文提出一个几何框架,用于分析大型语言模型中的多头注意力机制。在不改变原有机制的前提下,将标准注意力视为一种顶N选择过程,并直接在值状态空间中研究其行为。我们定义了精度、召回率和F分数等几何度量,量化选中与未选中词元之间的可分性,并在经验合理的假设下推导出非渐近界——依赖维度与边界大小。理论预测小N条件下存在最强的非平凡可分性,且序列长度与锚点相似性显著影响指标表现。实验在LLaMA-2-7B、Gemma-7B和Mistral-7B上验证:顶N选择确实提升可分性,锚点相似性与召回率正相关。还发现LLaMA-2-7B中头部分化为三类——检索器、混合器、重置器,具有不同几何特征。整体表明注意力如结构化几何分类器,具备可测量的选择标准,为头级可解释性及几何感知的稀疏化与注意力设计提供依据。

原文摘要 · Abstract (English)

We present a geometric framework for analysing multi-head attention in large language models (LLMs). Without altering the mechanism, we view standard attention through a top-N selection lens and study its behaviour directly in value-state space. We define geometric metrics - Precision, Recall, and F-score - to quantify separability between selected and non-selected tokens, and derive non-asymptotic bounds with explicit dependence on dimension and margin under empirically motivated assumptions (stable value norms with a compressed sink token, exponential similarity decay, and piecewise attention weight profiles). The theory predicts a small-N operating regime of strongest non-trivial separability and clarifies how sequence length and sink similarity shape the metrics. Empirically, across LLaMA-2-7B, Gemma-7B, and Mistral-7B, measurements closely track the theoretical envelopes: top-N selection sharpens separability, sink similarity correlates with Recall. We also found that in LLaMA-2-7B heads specialize into three regimes - Retriever, Mixer, Reset - with distinct geometric signatures. Overall, attention behaves as a structured geometric classifier with measurable criteria for token selection, offering head level interpretability and informing geometry-aware sparsification and design of attention in LLMs.

注意力机制几何分析可解释性大模型

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。