RoFormer: Enhanced Transformer with Rotary Position Embedding
Problem: self-attention carries no position information by itself, and most existing absolute and relative encodings add a position vector to the token representation, so they cannot be used directly in architectures that rewrite attention in linear form; can an encoding carry absolute position while making relative position explicit inside the attention inner product.
Where the evidence sits: the method is in 3.2 (a 2D rotation generalised to the full form) and the long-term decay properties in 3.3 and 3.4.3; experiments are in Section 4, which states they all ran on two cloud servers with 4 V100 GPUs each — WMT14 English-German BLEU in Table 1 (Transformer-base 27.3, RoFormer 27.5), six GLUE tasks in Table 2, Performer-with-RoPE pre-training loss curves in Figure 3 (right), and Chinese long-text CAIL2019-SCM in Table 5; the limits have their own subsection, 4.5.5 Limitations of the work.
What the authors say about limits: 4.5.5 lists three — although relative position is formulated mathematically as rotations in 2D sub-spaces, there is no thorough explanation of why it converges faster than other position encoding strategies; the long-term decay property is proved and better long-text performance is observed, but the authors say they have not come up with a faithful explanation; and RoFormer is built on Transformer-based infrastructure, so pre-training requires hardware resources.
What it does not claim: the paper does not say RoPE beats BERT on every downstream task — in Table 2 RoFormer is lower on SST-2, QNLI and MNLI, and the text itself says three out of six datasets; the 1024 result in Table 5 is not evidence of train-at-512-then-extrapolate, because the staged pre-training in Table 4 raised the maximum sequence length to 1536; and compatibility with linear self-attention is supported in 4.4 only by Performer pre-training loss curves, with no downstream task scores.
Key specs
- 证据位置 / evidence
- §3.2–§3.4(方法与性质);表 1、表 2、表 5、Figure 3;§4.5.5 Limitations of the work
- GLUE 对比口径 / GLUE
- 正文写六项中的三项优于 BERT(表 2)
- 中文长文本 / long text
- CAIL2019-SCM 输入长度 1024 时较 WoBERT 绝对提升 1.5%(§4.5.4 原文口径)
- 局限位置 / limits
- §4.5.5 Limitations of the work(独立小节)
- 复现状态 / reproduction
- 未复现
What the source says
Specifically, the proposed RoPE encodes the absolute position with a rotation matrix and meanwhile incorporates the explicit relative position dependency in self-attention formulation.
As can be seen, RoFormer can significantly outperform BERT in three out of six datasets, and the improvements are considerable.
However, when increasing the maximum input text length to 1024, RoFormer outperforms WoBERT by an absolute improvement of 1.5%.
Despite the fact that we mathematically format the relative position relations as rotations under 2D sub-spaces, there lacks of thorough explanations on why it converges faster than baseline models that incorporates other position encoding strategies.
Source and licence
- Source checked
- 2026-11-07
- Licence / kind
- arxiv-preprint
- Licence evidence
- https://arxiv.org/abs/2104.09864
- Category
- Architecture
How to read the numbers
Before citing a score, separate what it measures, how it is scored, what it compares against and whether contamination is controlled. If unsure, go back to the experiment setup in the paper. See benchmark cards · See dataset cards