실재를 넘어서: 장문맥 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.