RoPE, spell out the acronym and name exactly which vectors it rotates
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
RoPE = Rotary Position Embedding. It rotates Q and K vectors (not V) by position-dependent angles before the attention dot product, making the score depend on (m - n).
Picture two compasses, one pointing in the direction of a query token and another pointing in the direction of a key token. RoPE spins each compass needle by an amount that depends on where the token sits in the sentence: token at position 5 gets spun by 5 units, token at position 10 by 10 units. When the two needles are compared (dot product), what matters is the angle BETWEEN them, which is just (10 - 5 = 5 units). So the comparison ends up depending only on how far apart the tokens are, not on their absolute positions. That is the whole RoPE trick.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
Expand the acronym, identify Q and K as the rotated tensors (V untouched), explain the position-dependent rotation per dimension pair, show how the dot product becomes a function of (m - n), name 2026 LLMs that use it.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Saying RoPE rotates the embeddings or applies to V. RoPE rotates only Q and K, after their projections, before the attention dot product.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.