Rotate, don't add
One pair, one rotation
[q′₀, q′₁] = [q₀ cos mθ − q₁ sin mθ, q₀ sin mθ + q₁ cos mθ]
Every pair has its own speed
θi = base−2i/d with base = 10000 in the original paper
The trick: only the gap survives
Shift both, the score stays put
⟨R(m)q, R(n)k⟩ = ⟨q, R(n − m)k⟩
Where RoPE sits in attention
The rotation as a matrix
Far-apart tokens get a weaker pull
Beyond the training length
Position interpolation
Learned vs sinusoidal vs RoPE
Exceptions and sharp edges
V is never rotated
if outputs drift with absolute position, check you did not rotate v.Which dims form a pair?
match the convention, or permute the q/k weights.Rotated keys in the cache
pass the cache length as the position offset.Partial rotary
read the config's rotary fraction before porting.Precision of the angles
precompute cos and sin tables in fp32.