arXiv:2605.31558cs.LGcs.AI2026-05

对比位置与符号注意力头,发现符号机制更适应长序列推理。

Positional versus Symbolic Attention Heads: Learning Dynamics, RoPE Geometry, and Length Generalization

  • 通过控制实验对比两类注意力头的学习动态
  • 符号头在长序列上泛化能力更强,位置头受限明显
  • 揭示了RoPE几何结构对注意力机制的决定性影响

基于Transformer的语言模型广泛应用,理解其解决结构化任务的机制并预测其在新场景下的表现对安全部署至关重要。我们在受控环境下训练仅解码器的Transformer(GPT-J),在两个结构等价的多跳推理任务上进行实验:一个需要位置推理的数字任务,另一个需要符号推理的字母任务。利用最新提出的注意力头行为分类指标,我们发现成功学习伴随着纯头的出现,即注意力头表现为纯粹的位置或符号机制。尽管任务结构相同,但数字任务需同时具备位置和符号头,而字母任务仅需符号头。我们进一步识别这些头的计算角色,刻画其基本功能,并提出理论构造,表明单层基于RoPE的注意力可通过可解释的查询、键和值操作实现这些功能。该分析通过新提出的偏差概念,量化了位置与符号机制在长序列鲁棒性上的差异。我们在受控和真实模型中实证验证了预测结果,显示符号机制能更可靠地外推至更长序列,而位置机制面临更严峻限制。

原文摘要 · Abstract (English)

Transformer-based language models are widespread in today's society. As such, understanding the mechanisms by which they solve structured tasks and predicting how they may behave in novel scenarios is of great importance for safe deployment. We study the learning dynamics of attention heads in a controlled setting by training a decoder-only Transformer (GPT-J) on two structurally equivalent multi-hop reasoning tasks: a number task requiring positional reasoning and a letter task requiring symbolic reasoning. Using a recently introduced metric that classifies attention-head behavior as positional or symbolic for a given prompt, we show that successful learning is associated with the emergence of pure heads, i.e., heads that express themselves as either positional or symbolic. Despite the tasks' structural equivalence, they impose different mechanistic demands: the number task requires both positional and symbolic heads, whereas the letter task requires only symbolic heads. We then identify the computational roles of these heads, characterize the basic functions they implement, and give theoretical constructions showing how single-layer RoPE-based attention can realize these functions through geometrically interpretable query, key, and value operations. This analysis yields a quantitative separation between positional and symbolic mechanisms in their robustness to longer sequences, formalized through a novel notion of discrepancy. We empirically validate the resulting predictions in both controlled and real-world models, showing that symbolic mechanisms extrapolate more reliably to longer sequences while positional mechanisms face sharper limitations.

注意力机制长序列推理RoPE机制分析

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