{
  "id": "rotary-position-embedding",
  "code": "PTL-0251",
  "term": "Rotary Position Embedding",
  "aliases": [
    "RoPE",
    "rotary embeddings",
    "rotary positional encoding",
    "RoFormer"
  ],
  "category": "foundations",
  "definition": "Rotary position embedding (RoPE) is a way of encoding token positions in a transformer by rotating the query and key vectors by angles proportional to each token's position, so that attention scores depend on the relative distance between tokens.",
  "description": "Su et al. proposed it with the RoFormer model in 2021. It encodes absolute position with a rotation matrix while building relative position into self-attention, works with variable sequence lengths, and makes the dependency between tokens decay as their distance grows. It became a common position encoding in later large language models, and the length of context a model handles well is closely tied to how its rotary embeddings were trained.",
  "example": null,
  "broader": [],
  "narrower": [],
  "related": [
    "context-window",
    "large-language-model",
    "token"
  ],
  "introduced": 2021,
  "added": "2026-11-15",
  "sources": [
    {
      "title": "RoFormer: Enhanced Transformer with Rotary Position Embedding",
      "authors": "Su et al.",
      "year": 2021,
      "url": "https://arxiv.org/abs/2104.09864"
    }
  ],
  "url": "https://protologue.com/t/rotary-position-embedding/",
  "citation": "Protologue. (2026). Rotary Position Embedding. In Protologue: A Taxonomy of Prompting and LLM Techniques (v1.7.0, PTL-0251). https://protologue.com/t/rotary-position-embedding/"
}