arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2512.07525cs.CL
收藏

超越现实:旋转位置嵌入的虚数扩展用于长上下文LLM

Beyond Real: Imaginary Extension of Rotary Position Embeddings for Long-Context LLMs

Fudan University(复旦大学);Shanghai Innovation Institute(上海创新研究院);Shanghai AI Lab(上海人工智能实验室);China Unicom(中国联合网络通信集团)

Xiaoran Liu, Yuerong Song, Zhigeng Liu, Zengfeng Huang, Qipeng Guo, Zhaoxiang Liu, Shiguo Lian, Ziwei He, Xipeng Qiu

AI总结:

本文提出通过复数扩展提升旋转位置嵌入,以增强长上下文LLM对位置信息的建模能力。

摘要:

旋转位置嵌入(RoPE)通过在复平面上对查询和键向量应用旋转,已成为大型语言模型(LLMs)中编码序列顺序的标准方法。然而,标准实现仅使用复值点积的实部来计算注意力得分,这种简化舍弃了包含有价值相位信息的虚部,可能导致在建模长上下文依赖关系时丢失关键的相对细节。在本文中,我们提出了一种扩展,重新纳入被舍弃的虚部。我们的方法利用完整的复值表示来创建双组件注意力得分。我们通过理论和实证证明,这种方法通过保留更多的位置信息增强了长上下文依赖关系的建模。此外,对一系列长上下文语言建模基准的评估显示,我们的方法在标准RoPE上始终表现出更好的性能,随着上下文长度的增加,收益变得更加显著。代码可在https://github.com/OpenMOSS/rope_pp上获得。

英文摘要:

Rotary Position Embeddings (RoPE) have become a standard for encoding sequence order in Large Language Models (LLMs) by applying rotations to query and key vectors in the complex plane. Standard implementations, however, utilize only the real component of the complex-valued dot product for attention score calculation. This simplification discards the imaginary component, which contains valuable phase information, leading to a potential loss of relational details crucial for modeling long-context dependencies. In this paper, we propose an extension that re-incorporates this discarded imaginary component. Our method leverages the full complex-valued representation to create a dual-component attention score. We theoretically and empirically demonstrate that this approach enhances the modeling of long-context dependencies by preserving more positional information. Furthermore, evaluations on a suite of long-context language modeling benchmarks show that our method consistently improves performance over the standard RoPE, with the benefits becoming more significant as context length increases. The code is available at https://github.com/OpenMOSS/rope_pp.

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

↑