Why do relative positional methods extrapolate better to unseen sequence lengths than absolute positional encodings?

Last updated 22 November 2026

  • Absolute schemes feed unseen position codes at longer lengths (undefined or out of distribution), and the errors compound across layers.

  • Relative methods are translation invariant: offsets in a long sequence (especially short, local ones) were already seen in training. T5 buckets and ALiBi also handle large offsets gracefully.

  • Relative is necessary but not sufficient. RoPE still extrapolates poorly because low-frequency dimensions hit unseen angles, hence fixes like position interpolation, NTK scaling and YaRN.

  • https://medium.com/@shridharpawar77/understanding-absolute-and-relative-positional-embeddings-in-transformers-570995c291b2
  • https://apxml.com/courses/foundations-transformers-architecture/chapter-6-advanced-architectural-variants-analysis/relative-positional-encodings
  • https://emergent.sh/glossary/relative-positional-encoding
All Transformers interview questions