Rotary Position Embedding (RoPE) typically uses uniform coverage across Transformer layers despite heterogeneous positional requirements. Phase-off interventions reveal non-uniform, model-specific rotary-phase dependence, while coverage interventions relate it to coverage-upgrade benefits. We propose profiling-guided layer-wise RoPE allocation, assigning high/low coverage under a fixed budget using early coverage-benefit profiles. The framework supports fixed-width query/key representations and physical rotary-dimension allocation in Multi-head Latent Attention (MLA). Normalized-depth mapping transfers profiles within model families, enabling small-model measurements to guide larger-model allocations before pretraining. A brief analysis relates selection and transfer to score calibration and inter-layer interactions. From-scratch experiments demonstrate validation-loss improvements over available budget-matched baselines, while analytical resource accounting identifies favorable quality--storage--compute trade-offs for physical MLA. These results connect positional demand to transferable, efficient architecture design.
Figures & tables
Figure 1: Layer-wise phase-off demand across normalized depth. Signed scores are scaled by each model’s positive peak for display.
Figure 2: Phase-off demand versus validation-loss gain from 50%→100% coverage. Six layers per model; signed axes use within-model peak normalization.
Appendix figures & tables3 assets
Supplementary material from the paper’s appendix.
Appendix
Setting
130M
350M
1B
Sequence length
4,096
4,096
4,096
GPUs per job
2
4
4 or 8
Micro-batch size per GPU
4
2
1
Global batch size
64
128
256
Tokens per step
262,144
524,288
1,048,576
Training steps
9,919
13,352
19,074
Appendix
Table 5: Pretraining hyperparameters by scale, including token budgets, batch sizes, and learning-rate schedules.
Model / allocation
Layers
130M Dense, Profile50
7,10–18
130M MLA, Profile50
0–2,12–18
130M MLA, Profile75
0–5,8,12–19
130M MLA, Reverse50
3–11,19
130M MLA, Last10
10–19
350M Dense, Transfer50
8,12–22
Appendix
Table 9: High-coverage layer sets for each allocation; indices are zero-based and ranges are inclusive.
Figure 3: Recovered validation-loss reduction across rotary coverage for LLaMA-2-7B layers 1 and 2 (one-based). Both curves use the same calibration texts.
Rotary positional embeddings (RoPE) encode token positions by rotating attention features, supporting relative-position reasoning in language and multimodal models.
Rotary Positional Embedding (RoPE) is widely used in transformers to encode relative positional information, yet the effect of applying RoPE to only a subset of hidden dimensions remains underexplored. This design choice can substantially reduce memory usage, especially at long context lengths. We show that partial RoPE achieves up to 10× memory savings over standard RoPE cache while maintaining comparable final loss. We systematically study its impact on training dynamics and convergence across architectures, model sizes, sequence lengths, and datasets. Our results reveal that: (1) applying RoPE to only a small fraction of dimensions (around 10%) matches the convergence of full RoPE; (2) these trends remain consistent across settings; and (3) NoPE (No Positional Encoding) can produce loss spikes, which are mitigated by minimal RoPE usage or QK-Norm application. Overall, our findings highlight partial RoPE as an effective trade-off between efficiency and stability.
Mohammad Aflah Khan, Krishna P. Gummadi, Manish Gupta +1
Max Planck Institute for Software Systems · Microsoft, Hyderabad
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.
Chen Minqi, Zhongqi Yue, Shihao Zhang +5
Huawei Technologies · Nanyang Technological University
Rotary Position Embedding (RoPE) is widely adopted in Transformers to encode positional information, yet standard implementations enforce a uniform frequency schedule and scaling across all attention heads. Using simplified retrieval tasks and length generalization scenarios, we show -- both empirically and theoretically -- that heads with different functional roles require distinct frequency ranges and attention scaling factors to operate effectively. Ignoring this structure leads to suboptimal utilization of embedding dimensions and degraded performance, particularly under long-context settings. To address these limitations, we propose AdaRoPE, which equips each attention head with learnable rotation frequencies and attention scaling factors. Pretrained LLMs with AdaRoPE consistently outperform existing RoPE variants, including partial RoPE and NoPE baselines. For context extension, we further show that uniform frequency and attention scaling, used in methods such as YaRN, are suboptimal. By applying head-specific scaling, AdaRoPE enables better context extension while better preserving short-context performance in both the extrapolation setting and the long-context continued pretraining setting. These results highlight the importance of optimizing rotary position embedding at the level of individual attention heads.
Shaowen Wang, Yuke Zheng, Tansheng Zhu +4
Tsinghua University · Hunyuan Team, Tencent · Xiongan AI Institute +1