ComRoPE: Scalable and Robust Rotary Position Embedding Parameterized by Trainable Commuting Angle Matrices

Hao Yu, Tangyu Jiang, Shuning Jia, Shannan Yan, Shunning Liu +5 more
2/10/2026

No official code found. Best implementation: Longin-Yu/ComRoPE (11 stars, last commit 2025-06-11).

Abstract

The Transformer architecture has revolutionized various fields since it was proposed, where positional encoding plays an essential role in effectively capturing sequential order and context. Therefore, Rotary Positional Encoding (RoPE) was proposed to alleviate these issues, which integrates positional information by rotating the embeddings in the attention mechanism. However, RoPE utilizes manually defined rotation matrices, a design choice that favors computational efficiency but limits the model’s flexibility and adaptability. In this work, we propose ComRoPE, which generalizes RoPE by defining it in terms of trainable commuting angle matrices. Specifically, we demonstrate that pairwise commutativity of these matrices is essential for RoPE to achieve scalability and positional robustness. We formally define the RoPE Equation, which is an essential condition that ensures consistent performance with position offsets. Based on the theoretical analysis, we present two types of trainable commuting angle matrices as sufficient solutions to the RoPE equation, which significantly improve performance, surpassing the current state-of-the-art method by 1.6% at training resolution and 2.9% at higher resolution on the ImageNet-1K dataset. Furthermore, our framework shows versatility in generalizing to existing RoPE formulations and offering new insights for future positional encoding research. To ensure reproducibility, the source code and instructions are available at https://github.com/Longin-Yu/ComRoPE.

View on arXivView PDF

Code Implementations(1)

Longin-Yu/ComRoPECommunity100%
110PythonNov 14, 20241 years ago

Similar Papers

Cite this paper

@article{yu2026comrope,
  title  = {ComRoPE: Scalable and Robust Rotary Position Embedding Parameterized by Trainable Commuting Angle Matrices},
  author = {Hao Yu and Tangyu Jiang and Shuning Jia and Shannan Yan and Shunning Liu and Haolong Qian and Guanghao Li and Shuting Dong and Huaisong Zhang and Chun Yuan},
  year   = {2026},
  eprint = {2506.03737},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2506.03737},
  journal = {CVPR 2025 2025}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2506.03737.svg)](https://codeofpaper.com/paper/2506.03737)

Discussion