LGCVApr 10

Efficient Matrix Implementation for Rotary Position Embedding

arXiv:2604.0974285.7h-index: 16Has Code
Predicted impact top 11% in LG · last 90 daysOriginality Synthesis-oriented
AI Analysis

For practitioners using RoPE in Transformers, this provides a drop-in optimization that improves hardware utilization without changing outputs.

RoPE's vector-level split/merge operations cause computational overhead, especially in multi-dimensional settings. RoME replaces them with unified matrix transformations, achieving substantial acceleration on NPUs.

Rotary Position Embedding (RoPE) has become a core component of modern Transformer architectures across language, vision, and 3D domains. However, existing implementations rely on vector-level split and merge operations that introduce non-negligible computational overhead, often overlooked in attention optimization. The problem is further amplified in multi-dimensional settings (e.g., 2D and 3D RoPE), where additional vector operations and uneven feature partitions degrade hardware utilization. To overcome these limitations, we propose RoME (Rotary Matrix position Embedding), a mathematically equivalent yet computationally efficient reformulation of RoPE that replaces vector operations with unified matrix transformations. RoME eliminates dimension-specific operations, simplifies implementation, and enables fused parallel execution across Cube and Vector units on modern NPUs. Experiments show that RoME delivers substantial acceleration at both the operator and full-model levels. The implementation is available at https://gitcode.com/cann/ops-transformer/blob/master/experimental/posembedding/rope_matrix/README.md.

Foundations

The foundational work for this paper's niche, ranked by how specifically the neighbourhood builds on it — not by global fame.

Your Notes