arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2504.06308cs.LGcs.AI
收藏

重新思考RoPE:N维位置编码的数学蓝图

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

University of Manchester(曼彻斯特大学)

Haiping Liu, Lijing Lin, Jingyuan Sun, Zhegong Shangguan, Mauricio A. Alvarez, Hongpeng Zhou

AI总结:

本文基于李群和李代数理论提出了N维旋转位置编码(RoPE)的统一数学框架,推导了其充分必要条件并证明现有设计对应极大环面子代数,通过学习正交变换解决维度间交互,为高维模态扩展提供了理论基础。

摘要:

旋转位置编码(Rotary Position Embedding, RoPE)因其能高效编码相对位置并具有强大的外推能力,被广泛应用于大型语言模型(LLMs)中。然而,尽管其在更高维输入域(如2D图像)中的应用已在若干尝试中被探索,但仍缺乏统一的理论框架。为了解决这一问题,我们提出了一个基于李群和李代数理论的RoPE系统数学框架。我们基于RoPE的两个核心特性——相对性和可逆性,推导了任意有效N维RoPE的充分必要条件。我们证明,RoPE可以被表征为特殊正交李代数中极大阿贝尔子代数(MASA)的一组基;而常用的轴对齐块对角RoPE(即每个输入轴由独立的2x2旋转块编码)对应于极大环面子代数。此外,我们将空间维度间交互简化为基变换,并通过学习正交变换来解决。实验结果表明,维度间交互应与局部结构保持相平衡。总体而言,我们的框架统一并解释了现有的RoPE设计,同时支持向更高维模态和任务的有原则的扩展。

英文摘要:

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.

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

↑