Abstract
Large Language Models (LLMs) often exhibit slash attention patterns, where attention scores concentrate along the $\Delta$-th sub-diagonal for some offset $\Delta$. These patterns play a key role in passing information across tokens. But why do they emerge? In this paper, we demystify the emergence of these Slash-Dominant Heads (SDHs) from both empirical and theoretical perspectives. First, by analyzing open-source LLMs, we find that SDHs are intrinsic to models and generalize to out-of-distribution prompts. To explain the intrinsic emergence, we analyze the queries, keys, and Rotary Position Embedding (RoPE), which jointly determine attention scores. Our empirical analysis reveals two characteristic conditions of SDHs: (1) Queries and keys are almost rank-one, and (2) RoPE is dominated by medium- and high-frequency components. Under these conditions, queries and keys are nearly identical across tokens, and interactions between medium- and high-frequency components of RoPE give rise to SDHs. Beyond empirical evidence, we theoretically show that these conditions are sufficient to ensure the emergence of SDHs by formalizing them as our modeling assumptions. Particularly, we analyze the training dynamics of a shallow Transformer equipped with RoPE under these conditions, and prove that models trained via gradient descent exhibit SDHs. The SDHs generalize to out-of-distribution prompts.
Abstract (translated)
大型语言模型(LLMs)常常表现出斜向注意力模式,其中注意分数集中在第$\Delta$个副对角线上。这种模式在跨令牌传递信息中起着关键作用。但是为什么会出现这种情况呢?在这篇论文中,我们从实证和理论两个角度解开了这些斜向主导头(Slash-Dominant Heads, SDHs)出现的神秘面纱。 首先,通过对开源LLMs进行分析,我们发现SDHs是模型固有的,并且能够推广到分布外提示。为了解释这种内在出现的现象,我们分析了查询、键和旋转位置嵌入(RoPE),它们共同决定了注意分数。我们的实证分析揭示了SDH的两个特征条件:(1) 查询和键几乎是秩一的;(2) RoPE主要由中频和高频成分主导。 在这些条件下,查询和键几乎在各个令牌之间是相同的,并且RoPE中的中频和高频部分之间的相互作用会导致SDHs。除了实证证据之外,我们还从理论上证明了在给定条件下的训练过程中会出现SDHs。具体来说,我们在浅层Transformer装备有RoPE的情况下分析这些条件下的训练动态,并证明通过梯度下降训练的模型会表现出SDHs。 SDH能够推广到分布外提示中。
URL
https://arxiv.org/abs/2601.08297