Attention treats the input as a set, so without position information "dog bites man" and "man bites dog" look the same.
The original transformer added fixed sinusoidal vectors; many models learn positional embeddings instead.
Rotary position embedding (RoPE) rotates the query and key vectors by an angle that depends on position, so attention scores depend on relative distance; it extends better to longer contexts. ALiBi instead adds a distance-based bias to the scores.
Loading…