実世界を超えて:長文脈LLMのための回転位置埋め込みの虚数拡張
Beyond Real: Imaginary Extension of Rotary Position Embeddings for Long-Context LLMs
December 8, 2025
著者: Xiaoran Liu, Yuerong Song, Zhigeng Liu, Zengfeng Huang, Qipeng Guo, Zhaoxiang Liu, Shiguo Lian, Ziwei He, Xipeng Qiu
cs.AI
要旨
回転位置埋め込み(RoPE)は、複素平面におけるクエリベクトルとキーベクトルへの回転適用により、大規模言語モデル(LLM)の系列順序を符号化する標準的手法となっている。しかし、標準的な実装では、注意スコア計算に複素数値ドット積の実数成分のみを利用している。この単純化により、重要な位相情報を含む虚数成分が破棄され、長文脈依存性のモデル化に不可欠な関係的詳細の損失が生じる可能性がある。本論文では、この破棄された虚数成分を再統合する拡張手法を提案する。本手法は完全な複素数値表現を活用し、二成分からなる注意スコアを生成する。理論的・実証的に、このアプローチがより多くの位置情報を保持することで長文脈依存性のモデル化を強化することを示す。さらに、一連の長文脈言語モデリングベンチマークによる評価では、本手法が標準RoPEを一貫して上回る性能向上をもたらし、文脈長が増すほどその利点が顕著になることを確認した。コードはhttps://github.com/OpenMOSS/rope_pp で公開されている。
English
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.