Learn AI Math

Rotary Positional Embedding (RoPE)

What is Rotary Positional Embedding (RoPE)?

In one sentence: RoPE is a popular way to tell a model about word positions by rotating its query and key numbers by an angle based on position.

Imagine each token's numbers as arrows. RoPE turns each arrow by an amount that depends on where the token is. When two tokens are compared, the difference in their angles tells the model how far apart they are. This works well and can be stretched to longer texts.

What does Rotary Positional Embedding (RoPE) look like?

With RoPE, the model naturally knows that words 5 and 7 are close, while words 5 and 500 are far apart.

Why does Rotary Positional Embedding (RoPE) matter?

RoPE is used in Llama, Qwen, Mistral and many other models, and it helps extend context length.

Last updated · Fact-checked by The AI Math

Linking to this page from a lesson or article?

Like this explanation? Get one every week.

The AI Math newsletter turns confusing AI news into plain English. No hype, no jargon walls.