Rethinking RoPE: A Mathematical Blueprint for N-dimensional Positional Embedding

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Liu, Haiping, Lin, Lijing, Sun, Jingyuan, Shangguan, Zhegong, Alvarez, Mauricio A., Zhou, Hongpeng
Format: Preprint
Publié: 2025
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866908449300807680
author Liu, Haiping
Lin, Lijing
Sun, Jingyuan
Shangguan, Zhegong
Alvarez, Mauricio A.
Zhou, Hongpeng
author_facet Liu, Haiping
Lin, Lijing
Sun, Jingyuan
Shangguan, Zhegong
Alvarez, Mauricio A.
Zhou, Hongpeng
contents Rotary Position Embedding (RoPE) is widely adopted in large language models (LLMs) due to its efficient encoding of relative positions with strong extrapolation capabilities. However, while its application in higher-dimensional input domains, such as 2D images, have been explored in several attempts, a unified theoretical framework is still lacking. To address this, we propose a systematic mathematical framework for RoPE grounded in Lie group and Lie algebra theory. We derive the necessary and sufficient conditions for any valid $N$-dimensional RoPE based on two core properties of RoPE - relativity and reversibility. We demonstrate that RoPE can be characterized as a basis of a maximal abelian subalgebra (MASA) in the special orthogonal Lie algebra, and that the commonly used axis-aligned block-diagonal RoPE, where each input axis is encoded by an independent 2x2 rotation block, corresponds to the maximal toral subalgebra. Furthermore, we reduce spatial inter-dimensional interactions to a change of basis, resolved by learning an orthogonal transformation. Our experiment results suggest that inter-dimensional interactions should be balanced with local structure preservation. Overall, our framework unifies and explains existing RoPE designs while enabling principled extensions to higher-dimensional modalities and tasks.
format Preprint
id arxiv_https___arxiv_org_abs_2504_06308
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Rethinking RoPE: A Mathematical Blueprint for N-dimensional Positional Embedding
Liu, Haiping
Lin, Lijing
Sun, Jingyuan
Shangguan, Zhegong
Alvarez, Mauricio A.
Zhou, Hongpeng
Machine Learning
Artificial Intelligence
Rotary Position Embedding (RoPE) is widely adopted in large language models (LLMs) due to its efficient encoding of relative positions with strong extrapolation capabilities. However, while its application in higher-dimensional input domains, such as 2D images, have been explored in several attempts, a unified theoretical framework is still lacking. To address this, we propose a systematic mathematical framework for RoPE grounded in Lie group and Lie algebra theory. We derive the necessary and sufficient conditions for any valid $N$-dimensional RoPE based on two core properties of RoPE - relativity and reversibility. We demonstrate that RoPE can be characterized as a basis of a maximal abelian subalgebra (MASA) in the special orthogonal Lie algebra, and that the commonly used axis-aligned block-diagonal RoPE, where each input axis is encoded by an independent 2x2 rotation block, corresponds to the maximal toral subalgebra. Furthermore, we reduce spatial inter-dimensional interactions to a change of basis, resolved by learning an orthogonal transformation. Our experiment results suggest that inter-dimensional interactions should be balanced with local structure preservation. Overall, our framework unifies and explains existing RoPE designs while enabling principled extensions to higher-dimensional modalities and tasks.
title Rethinking RoPE: A Mathematical Blueprint for N-dimensional Positional Embedding
topic Machine Learning
Artificial Intelligence
url https://arxiv.org/abs/2504.06308