A transformer reads a sentence as an unordered bag of tokens. Without extra help it cannot tell "dog bites man" from "man bites dog" — the self-attention mechanism treats both identically. So before computing anything, every model must answer one question: where does each token sit?
Early models simply added a fixed sinusoidal signal to each token's vector (Vaswani et al., 2017). Later work learned separate position embeddings from scratch. Both approaches paste position information into the vector before attention runs — they modify the content to carry the address.
Rotary Position Embeddings (RoPE), introduced by Su et al. in 2021, take a cleaner path: instead of adding a position signal, they rotate the query and key vectors by an angle proportional to their position in the sequence. The geometry of the rotation is chosen so that the dot product — the raw attention score between token and token — depends only on the difference , not on or individually. Relative distance falls out automatically, for free.
This elegance is not academic. RoPE powers LLaMA, Mistral, Gemma, and most of the open-weight language models built after 2023. Understanding it means understanding the positional heartbeat of today's most capable AI systems.
Comments
Loading comments...