Skip to main content

Exercises — RoPE

Questions, exercises, and worked answers

← Back to the lesson: RoPE

Check your understanding

Consider an attention head using standard RoPE.

  1. Which components are rotated: Q, K, or V?
  2. Why does the dot product between a query and a key depend on the relative offset of their positions?
  3. What does — and does not — follow from the score being invariant when the same shift is added to every position?
Show the reasoning

Standard RoPE rotates queries Q and keys K after projection, not values V. For one coordinate pair, the rotations make the dot product depend on the difference between the two angles, hence on the relative offset. Common-shift invariance holds for fixed, unrotated Q/K; it does not guarantee that adding a real prefix leaves hidden states and Q/K projections unchanged. Nor does it prove reliable extrapolation to arbitrary lengths.

Language: Français · English