断裂的RoPE与长输入:一种几何视角
Frayed RoPE and Long Inputs: A Geometric Perspective
AI总结:
本文从几何角度分析RoPE在长输入下的问题,发现注意力机制导致键和查询向量紧密聚类,而RoPE在长输入时破坏这种聚类,产生病态行为。提出RoPE-ID方法通过高频率应用部分通道解决此问题。
摘要:
Rotary Positional Embedding (RoPE) 是一种广泛用于语言模型中编码位置的技巧,虽然有效,但当输入长度超过训练长度时会导致性能下降。先前分析认为长输入会使通道旋转「超出分布」,但不清楚额外旋转如何导致病态行为。通过经验与理论分析,本文提出了RoPE的统一几何理解。发现注意力机制使分离的键和查询潜在点云紧密聚类,允许创建沉底标记:允许注意力头在不需要时避免token混合。RoPE应用于更长的输入会破坏这种键/查询聚类分离,通过抑制沉底标记功能产生病态行为。从这种几何视角,我们提出RoPE-ID(在分布),一种简单的修改,允许注意力层直接泛化到更长的输入:对部分通道应用高频率RoPE。我们通过1B和3B参数Transformer在LongBench和RULER信息检索基准上展示了RoPE-ID在长输入中的有效性。
英文摘要:
Rotary Positional Embedding (RoPE) is a widely adopted technique for encoding position in language models, which, while effective, causes performance breakdown when input length exceeds training length. Prior analyses assert (rightly) that long inputs cause channels to rotate ``out of distribution,'' but it is not clear how extra rotation relates to or causes pathological behavior. Through empirical and theoretical analysis we advance a unified geometric understanding of attention behavior with RoPE. We find that attention induces tight clustering of separated key and query latent point clouds, allowing for creation of sink tokens: placeholders that allow attention heads to avoid token mixing when not required. RoPE applied to longer inputs damages this key/query cluster separation, producing pathological behavior by inhibiting sink token functionality. From this geometric perspective, we propose RoPE-ID (In Distribution), a straightforward modification that allows attention layers to generalize to longer inputs out of the box: apply RoPE with high frequency to a subset of channels. We demonstrate the effectiveness of RoPE-ID for extended inputs using 1B and 3B parameter Transformers on the LongBench and RULER information retrieval benchmarks.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。