Transformers and LLMs

Relative Attention, explained

Relative attention adds information about the distance or relationship between tokens directly into attention.
Back to Glossary

Part of the Semantic Notion technical glossary.

Short Definition

Relative attention adds information about the distance or relationship between tokens directly into attention.

Intuition

Many language patterns depend more on how far two tokens are from each other than on their absolute position in a document.

Technical Definition

Relative attention modifies attention scores or representations using learned or computed features of pairwise token positions.

Example

A model can treat nearby modifiers differently from distant context by using relative position signals.

Common Misunderstandings

Relative attention is not simply another name for RoPE.
Relative position methods can be implemented in several different ways.

Start here

Need the broader concept map?

Return to the glossary index to move from this definition into adjacent AI, ML, mathematics, and computer science terms.