Positional embeddings give transformer models information about token order, with learned, sinusoidal and rotary approaches offering different trade-offs for context length and relative distance.
Transformer attention compares token vectors with dot products, but without positional information it can treat a sentence as an unordered collection of words. That makes sentences such as “The dog hunted the fox” and “The fox hunted the dog” difficult to distinguish.
Learned absolute positional embeddings, used in models such as GPT-2, assign a vector to each position and add it to the token representation. GPT-2 has 1,024 learned position vectors; the article says position weights account for about 0.3% of the model at that length, compared with more than 22% at roughly 100,000 tokens.
Sinusoidal encoding avoids learned position parameters by generating position vectors from sine and cosine waves. Rotary Position Embeddings, or RoPE, instead rotate query and key vectors inside every attention layer. This lets attention represent relative distance: positions 5 and 2, or 105 and 102, have the same gap and produce the same illustrative score, while moving the key from position 2 to position 3 changes the score from 13 to 19.92.
RoPE remains widely used in modern large language models, including LLaMA and Qwen, while other designs combine it with layers that omit positional encoding or use learned relative biases. The article also notes that RoPE rotates queries and keys, not value vectors, and that pairing conventions can differ between model implementations.