Rotary Position Embeddings (RoPE)

hard
Unit 27 · Quantization0/0 to milestone

Llama, Mistral, Qwen and most modern LLMs encode token position with RoPE: instead of adding a position vector, they rotate each query and key vector by an angle that grows with position.

Pro problem

Unlock this and every premium problem across all tracks — plus hidden-test grading, advanced AI engineering modules and new content every week.

Start 7-day free trial
How LLMs Work· 9 of 19
solution.py · Python 3.13
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Rotary Position Embeddings (RoPE) · TechGradify