RoPE Math Derivation
PremiumFrom complex rotations to higher-dimensional generalization, understand the core math of rotary position embeddings
Get code accessStart From the Requirement
In the previous chapter we stated a core requirement: we want the dot product of and to depend only on content and relative position :
Here is the position-encoding function we design; it takes a token content vector and position index and outputs a position-aware vector.
The key insight of RoPE is: encode position by rotation. We start with the simplest 2D case.
Log in to continue reading
This is premium content. Please log in to access the full article.
CookLLM Docs