Rotary Position Embedding
Also called RoPE, rotary embeddings, rotary positional encoding, RoFormer.
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.
Sources
- Su et al. (2021). RoFormer: Enhanced Transformer with Rotary Position Embedding.
Cite this entry
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/
BibTeX
@misc{protologue_rotary_position_embedding,
title = {Rotary Position Embedding},
author = {{Protologue}},
year = {2026},
howpublished = {Protologue: A Taxonomy of Prompting and LLM Techniques, v1.7.0},
note = {Entry PTL-0251},
url = {https://protologue.com/t/rotary-position-embedding/}
}New terms, as they're coined
One email a week with the newest techniques, each defined and sourced like this entry.
Delivered through Beehiiv. Unsubscribe from any issue.