# The Intuition behind Rotary Positional Embedding (RoPE)

RoPE is a position embedding method proposed by Jianlin Su et al. in 2021 (paper).

I aim to make the subject matter accessible to a broader audience. You won’t find any math-heavy equations or theoretical proofs here.

Let me try to explain RoPE in a way that a non-technical person can understand.

Imagine you have a bunch of toys on the floor, and you want to remember where each one is. RoPE is like a special way to keep track of where each toy is.

Normally, you might just number the toys 1, 2, 3, and so on. But RoPE does something a little different. It uses a special kind of math called “rotation” to keep track of where each toy is.

Imagine you have a wheel that you can spin around. Each toy gets its own special spin or “rotation”. The toy in the first spot gets no spin, the toy in the second spot gets a little spin, the third toy gets a bit more spin, and so on.

This special spin or “rotation” helps the model (the thing that’s trying to remember where the toys are) understand not just the number of the toy, but also how far apart the toys are from each other. It’s like giving each toy its own special dance move!

By using this rotation, the model can better remember where each toy is and how they are positioned relative to each other. It’s a clever way to keep track of all the toys without just using boring old numbers. ^{1}^{2}

If you’re interested, there’s a minimal RoPE implementation (algorithm and code).