只给部分维度加旋转位置编码,能省10倍内存且不损失模型性能。
Fractional Rotation, Full Potential? Investigating Performance and Convergence of Partial RoPE
- 仅对约10%的维度应用旋转位置编码,仍可实现与全量编码相当的收敛效果。
- 在不同模型规模、序列长度和数据集上,该方法均表现稳定,最高节省10倍缓存内存。
- 适合追求高效训练的开发者,尤其适用于长序列任务中的资源受限场景。
旋转位置编码(RoPE)是Transformer架构中编码相对位置信息的常用方法。尽管已有研究探讨过在特定层中省略RoPE的影响,但对部分隐藏维度应用旋转变换这一设计选择仍鲜有探索。该策略可带来显著的内存节省,尤其在长上下文场景下意义重大。我们发现,相比标准RoPE缓存,该方法最多可节省10倍内存,同时达到相近的最终损失。本文系统研究了部分RoPE对不同架构和数据集上训练动态与收敛性的影响。结果揭示几个重要规律:(1) 仅对约10%的维度应用RoPE即可实现与全量RoPE相当的收敛;(2) 这些趋势在不同模型规模、序列长度及数据质量的场景中保持一致,高质量数据虽降低整体损失,但性能表现相似;(3) 完全无位置编码(NoPE)模型呈现学习轨迹不稳定,可通过少量RoPE或QK-Norm缓解,后者虽收敛至更高损失。这些结果为模型设计者在效率与训练稳定性间权衡提供了实用指导,并突显了部分RoPE此前被忽视的重要性。
原文摘要 · Abstract (English)
Rotary Positional Embedding (RoPE) is a common choice in transformer architectures for encoding relative positional information. Although earlier work has examined omitting RoPE in specific layers, the effect of varying the fraction of hidden dimensions that receive rotary transformations remains largely unexplored. This design choice can yield substantial memory savings, which becomes especially significant at long context lengths. We find up to 10x memory savings over the standard RoPE cache, while achieving comparable final loss. In this work, we present a systematic study examining the impact of partial RoPE on training dynamics and convergence across architectures and datasets. Our findings uncover several notable patterns: (1) applying RoPE to only a small fraction of dimensions (around 10%) achieves convergence comparable to using full RoPE; (2) these trends hold consistently across model size, sequence lengths and datasets of varying quality and architectures, with higher-quality data resulting in lower overall loss and similar benchmark performance; and (3) some models trained with NoPE (No Positional Encoding) showcase unstable learning trajectories, which can be alleviated through minimal RoPE application or QK-Norm which converges to a higher loss. Together, these results offer practical guidance for model designers aiming to balance efficiency and training stability, while emphasizing the previously overlooked importance of partial RoPE.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。