arXiv:2607.19363cs.AIcs.CL2026-07中稿 · ICML

不同注意力头应有不同旋转频率和缩放,提升长文本理解能力

AdaRoPE: Not All Attention Heads Should Rotate and Scale Equally

论文配图:AdaRoPE: Not All Attention Heads Should Rotate and Scale Equally
图 1 · 摘自论文原文
  • 为每个注意力头设计可学习的旋转频率和缩放因子
  • 在长上下文任务中性能优于现有RoPE变体,提升明显
  • 适合追求长序列建模精度的LLM开发者或研究者

旋转位置编码(RoPE)广泛用于Transformer模型以编码位置信息,但标准实现对所有注意力头采用统一的频率调度和缩放。通过简化检索任务与长度泛化场景,我们从实证和理论上证明:具有不同功能角色的注意力头需要不同的频率范围和注意力缩放因子才能高效运作。忽略这种差异会导致嵌入维度利用不充分,尤其在长上下文设置下性能下降。为此,我们提出AdaRoPE,为每个注意力头配备可学习的旋转频率和注意力缩放因子。使用AdaRoPE预训练的大语言模型持续优于现有RoPE变体,包括部分RoPE和NoPE基线。对于上下文扩展,我们进一步表明,如YaRN所采用的统一频率与缩放策略是次优的。通过引入头级缩放,AdaRoPE在保持短上下文性能的同时,实现了更优的上下文扩展能力,无论是在外推设置还是长上下文持续预训练设置中。这些结果强调了在个体注意力头层面优化旋转位置编码的重要性。

原文摘要 · Abstract (English)

Rotary Position Embedding (RoPE) is widely adopted in Transformers to encode positional information, yet standard implementations enforce a uniform frequency schedule and scaling across all attention heads. Using simplified retrieval tasks and length generalization scenarios, we show -- both empirically and theoretically -- that heads with different functional roles require distinct frequency ranges and attention scaling factors to operate effectively. Ignoring this structure leads to suboptimal utilization of embedding dimensions and degraded performance, particularly under long-context settings. To address these limitations, we propose AdaRoPE, which equips each attention head with learnable rotation frequencies and attention scaling factors. Pretrained LLMs with AdaRoPE consistently outperform existing RoPE variants, including partial RoPE and NoPE baselines. For context extension, we further show that uniform frequency and attention scaling, used in methods such as YaRN, are suboptimal. By applying head-specific scaling, AdaRoPE enables better context extension while better preserving short-context performance in both the extrapolation setting and the long-context continued pretraining setting. These results highlight the importance of optimizing rotary position embedding at the level of individual attention heads.

位置编码注意力机制大模型长序列

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