arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2602.01893cs.AIcs.LG
收藏

多头注意机制中令牌选择的几何分析

Geometric Analysis of Token Selection in Multi-Head Attention

University of Luxembourg(卢森堡大学);London Institute for Mathematical Sciences(伦敦数学科学研究所)

Timur Mudarisov, Mikhal Burtsev, Tatiana Petrova, Radu State

AI总结:

本研究通过几何分析揭示了多头注意力机制中令牌选择的结构特性,提出了精度、召回率和F分数等指标,并展示了头部在不同制度下的几何特征。

摘要:

我们提出了一种几何框架,用于分析大型语言模型(LLMs)中的多头注意机制。在不改变机制的情况下,我们通过前N选择的视角审视标准注意机制,并直接在值-状态空间中研究其行为。我们定义了几何指标——精度、召回率和F分数——以量化所选令牌与非所选令牌之间的分离性,并推导出具有显式维度和边距依赖性的非渐近界限,基于经验驱动的假设(稳定的值范数与压缩的沉底令牌、指数相似性衰减、分段注意权重曲线)。理论预测了小N操作区域中最强的非平凡分离性,并澄清了序列长度和沉底相似性如何塑造这些指标。实验上,在LLaMA-2-7B、Gemma-7B和Mistral-7B中,测量结果紧密跟踪理论包络:前N选择增强了分离性,沉底相似性与召回率相关。我们还发现,在LLaMA-2-7B的头部中,专门形成了三种制度——检索器、混合器、重置器——具有不同的几何特征。总体而言,注意机制表现为具有可测量标准的结构几何分类器,为令牌选择提供了可解释性,并指导了几何感知的稀疏化和注意力机制的设计。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑