RoPE: two pairs, two planes

Separate two 2D planes to compare rotation frequencies. Q and K rotate pair by pair; the vector stays 4D and V stays unchanged.

d = 4 → 4
Blue Q · teal K · dashed unrotated direction

3D only arranges the planes. It adds no vector coordinates.

Current raw Q′·K′n−m = −1

V does not enter RoPE [1,0,1,0] → [1,0,1,0]

Before division by √d, causal masking, or Softmax.

Q
K

Formula, scope, and sources

3D only arranges the planes. It adds no vector coordinates. Before division by √d, causal masking, or Softmax.

Q = K = [1,0,1,0] · V does not enter RoPE [1,0,1,0]

ωᵢ = theta^(−2i/d), theta=10000. Each pair (a,b) → (a cosα−b sinα, a sinα+b cosα).

The common-shift property assumes fixed Q/K content. Different position differences can produce the same dot product. Arrows show final direction; numeric angles retain the full rotation in radians.

The saved 2D example is verified before build. Its [1,0] content is repeated for the article’s 4D preset. Interactive values follow the course RoPE formula; V is a fixed unrotated comparison.

l13.json · tiny_lm/rope.py · ModelConfig · Static lesson figure