Contrast absolute and relative positional encoding by what the score depends on
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Absolute PE makes the attention score depend on positions m and n separately; relative PE makes it depend only on the offset (m - n). The latter gives translation invariance and better length extrapolation.
Picture two people standing on a number line. Absolute thinking says 'one is at 7 and the other is at 12, the score depends on those numbers'. Relative thinking says 'they are 5 apart, that is all that matters'. If you slide both of them three steps to the right (now at 10 and 15), absolute thinking sees new numbers and recomputes; relative thinking shrugs because the gap is still 5. Modern long-context models all want the relative behavior because real language patterns care about how far apart tokens are, not where they sit in the absolute timeline.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
Define the absolute vs relative split by what the score is a function of, map each PE family (sinusoidal, learned, T5, RoPE, ALiBi), explain translation-equivariance and length extrapolation, name 2026 production examples.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Confusing where each scheme is APPLIED (input vs logits) with what each scheme is a FUNCTION OF (absolute positions vs offset). Those are independent axes.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.