Why is RoPE applied to queries and keys rather than to the input embeddings?
Last updated
Rotating q and k gives
(R_m q)·(R_n k) = q·R_(n-m) k, so the attention score depends only on the relative offset.Rotating input embeddings would be scrambled by projections, LayerNorm and MLPs, and would only inform layer 1. Applying RoPE per layer refreshes position at each attention step.
Values are not rotated because position should affect where to attend, not the mixed content. This keeps the residual stream position-free and works with KV caching.