Glossary · Position and context
RoPE (rotary position embedding)
Also: RoPErotary embeddingsrope_thetaYaRN
Read it at the depth you need: one sentence · a paragraph · the math · in the models here
1In one sentence
Position encoded by rotating pairs of query and key dimensions by an angle proportional to the token's position, so their dot product depends on relative distance.
2In a paragraph
Attention by itself does not know word order. RoPE tells it by rotating each query and key: the dimensions are paired up, and each pair is turned by an angle that grows with the token's position, fast for some pairs and slow for others. When a query and a key are compared, only the difference of their angles survives, so the score depends on how far apart the tokens are. It has no parameters, and the rope_theta in the config sets how slowly the slowest pairs turn, which bounds how far apart positions can still be told apart.
3The math, shapes and parameters
For pair i of a head of size h, at position m:
θi = base−2i/h [x2i, x2i+1] ← [x2i cos mθi − x2i+1 sin mθi, x2i sin mθi + x2i+1 cos mθi]
Because rotations compose, qm·kn depends only on m − n. The base was 10,000 in the original; long-context models raise it (Llama 3: 500,000; Qwen: 1,000,000) so the slowest pair does not wrap around within the context. To stretch a trained model further, rope_scaling rescales the angles: linear, NTK, YaRN, or Llama 3's scheme, which leaves fast pairs alone and slows the slow ones.
Variants: some models rotate only part of each head (partial_rotary_factor); DeepSeek's MLA keeps a separate small RoPE key; Llama 4 skips RoPE on every fourth layer.
Term by term on Notation Decoder, the sister site: RoPE, decoded
4In the 96 models on this site
The base and the long-context scaling, one model per series:
| Model | rope_theta | Scaling | Max context |
|---|---|---|---|
| SmolLM3 3B | 5,000,000 | – | 64K |
| Llama 2 7B | 10,000 (default) | – | 4K |
| Granite 3.3 8B | 10,000,000 | – | 128K |
| Falcon3 10B | 1,000,042 | – | 32K |
| Gemma 3 27B | 1,000,000 | linear | 128K |
| Gemma 2 27B | 10,000 | – | 8K |
| Gemma 4 31B | 10,000 (default) | – | 256K |
| OLMo 3 32B | 500,000 | yarn | 64K |
| OLMo 2 32B | 500,000 | – | 4K |
| Seed-OSS 36B | 10,000,000 | default | 512K |
| Phi-3.5 MoE | 10,000 | longrope | 128K |
| DeepSeek-R1-Distill-Llama-70B | 500,000 | llama3 | 128K |
| Qwen2.5 72B | 1,000,000 | – | 128K |
| Qwen3-Next 80B-A3B | 10,000,000 | – | 256K |
| gpt-oss-120b | 150,000 | yarn | 128K |
| Mixtral 8x22B | 1,000,000 | – | 64K |
| MiniMax M2 | 5,000,000 | – | 192K |
| Qwen3 235B-A22B | 1,000,000 | – | 40K |
| GLM-4.5 | 1,000,000 | – | 128K |
| Qwen3.5 397B-A17B | 10,000,000 | – | 256K |
| Llama 4 Maverick (17B-128E) | 500,000 | – | 256K |
| Llama 3.1 405B | 500,000 | llama3 | 128K |
| Nemotron 3 Ultra 550B-A55B | 10,000 | – | 256K |
| DeepSeek-V3.2 | 10,000 | yarn | 160K |
| GLM-5.2 | 8,000,000 | – | 1024K |
| Inkling | 10,000 (default) | – | 1024K |
| Ling-1T | 600,000 | – | 32K |
| Kimi K2 | 50,000 | yarn | 128K |
Introduced in Su et al., “RoFormer: Enhanced Transformer with Rotary Position Embedding” (2021).
Related
Self-attention · Sliding-window attention · KV cache · every term