arXiv:2506.03737cs.CVcs.AI2025-06CVPR被引 15

提出可训练的旋转位置编码,提升模型对位置信息的适应能力。

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

  • 用可学习的交换角度矩阵替代固定旋转矩阵,增强灵活性。
  • 在ImageNet-1K上,高分辨率下性能超越当前最优方法2.9%。
  • 理论证明矩阵交换性是实现稳定位置编码的关键,适合研究位置编码者。

Transformer架构自提出以来已深刻影响多个领域,其效果很大程度上依赖于位置信息的编码能力。传统位置编码方法因缺乏鲁棒性和灵活性而受限。为此,旋转位置编码(RoPE)通过在注意力机制中旋转嵌入来整合位置信息,但其依赖手动定义的旋转矩阵,变换空间有限,制约了模型能力。本文提出ComRoPE,将RoPE推广为由可训练交换角度矩阵参数化的形式。我们证明,这些矩阵的两两交换性是实现可扩展性和位置鲁棒性的关键。我们正式定义了满足一致性性能与位置偏移不变性的RoPE方程,并基于此提出两类可训练交换角度矩阵作为充分解。实验表明,该方法在ImageNet-1K数据集上,训练分辨率下性能优于现有最佳方法1.6%,更高分辨率下提升达2.9%。此外,该框架具备良好泛化能力,可兼容已有RoPE形式,并为未来位置编码研究提供新视角。代码与说明已公开于https://github.com/Longin-Yu/ComRoPE。

原文摘要 · Abstract (English)

The Transformer architecture has revolutionized various regions since it was proposed, and its effectiveness largely depends on the ability to encode positional information. Traditional position encoding methods exhibit significant limitations due to lack of robustness and flexibility of position. 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 requires manually defined rotation matrices with limited transformation space, constraining the model's capacity. 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

位置编码Transformer可学习嵌入

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。