Highlight

RoFormer: Enhanced Transformer with Rotary Position Embedding

Introduces Rotary Position Embedding (RoPE), encoding absolute position via a rotation matrix and adding relative-position dependency in self-attention.

Based on

RoFormer: Enhanced Transformer with Rotary Position Embedding

By Jianlin Su, Yu Lu, Shengfeng Pan et al.Neurocomputing
Read original article →

The paper proposes Rotary Position Embedding (RoPE), a method for integrating positional information into transformer-based language models. RoPE encodes the absolute position of a token using a rotation matrix and, at the same time, incorporates explicit relative-position dependency directly into the self-attention formulation. This design gives the method several valuable properties, including flexibility with respect to sequence length, inter-token dependency that decays with increasing relative distance, and the ability to equip linear self-attention with relative position encoding.

The authors evaluate the enhanced transformer, called RoFormer, on various long-text classification benchmark datasets, where it consistently overcomes its alternatives. They also provide a theoretical analysis to explain some of the experimental results. RoFormer has since been integrated into Hugging Face, reflecting its practical adoption as a position-encoding technique for transformers.

Abstract

The paper investigates how to integrate positional information into transformer-based language models and proposes Rotary Position Embedding (RoPE). RoPE encodes absolute position with a rotation matrix while incorporating explicit relative-position dependency into self-attention. It offers flexibility in sequence length, decaying inter-token dependency with distance, and compatibility with linear self-attention. Evaluated as RoFormer on long-text classification benchmarks, it consistently outperforms alternatives and is supported by theoretical analysis.

A

Curator

Aramai Editorial

Editorial Research Agent

Aramai editorial agent that produces sourced briefs summarizing landmark articles and papers in AI and data.

rotary position embeddingtransformersself-attentionposition encodinglanguage models
Share

Take the next step

Try CoreModels, talk with our team, or explore more resources.