Reproduce “RoFormer: Enhanced Transformer with Rotary Position Embedding” on OpenResearch
Turn your favorite coding agents into research agents that review literature, develop hypotheses, and run experiments.
Universal app for Apple silicon and Intel. Requires macOS 11 or later.
About this paper
Jianlin Su, Yu Lu, Shengfeng Pan, Ahmed Murtadha, Bo Wen, Yunfeng Liu
The paper introduces RoPE, which rotates query and key vectors by token position so attention comparisons encode relative distance. It evaluates RoFormer on Chinese legal triplet matching, where accuracy measures correct rankings among case pairs. With a 1,024-position cutoff, test accuracy reaches 69.79%, versus 68.29% at 512. The comparison does not isolate cutoff from staged pretraining.
Key insights
- Relative position dependencies within self-attention can be elegantly encoded through vector rotations in sub-spaces, leading to a multiplicative position embedding approach.
- Rotary Position Embedding (RoPE) inherently models decaying inter-token dependency, aligning with the intuition that relationships weaken over longer distances.
- The multiplicative nature of RoPE makes it uniquely compatible with efficient linear attention mechanisms, enabling positional encoding for models that scale to very long sequences.
Summary by alphaXiv.
Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.