Our new X account is live! Follow @wizwand_team for updates
WorkDL logo mark

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

About

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.

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

Related benchmarks

TaskDatasetResultRank
Language ModelingWikiText
PPL24.4
479
Question AnsweringOBQA
Accuracy29.2
276
Question AnsweringGPQA
Accuracy28.3
258
Question AnsweringARC-E
Accuracy48
242
Commonsense ReasoningSIQA
Accuracy41.2
96
Question AnsweringPIQA
Accuracy71.3
83
Commonsense ReasoningWino
Accuracy55.9
45
Long-context language modelingRULER
Accuracy (8K Context)38.6
34
Question AnsweringTQA
Accuracy37.1
34
Language Modeling and Question AnsweringShort-context task suite (WikiText, LAMBADA, TriviaQA, PIQA, HellaSwag, WinoGrande, ARC-Easy, GPQA, Social IQA, OpenBookQA, SciQ) (test)
WikiText PPL14.4
18
Showing 10 of 14 rows

Other info

GitHub

Follow for update