Positional Encoding (PosEnc)

Information added to a Transformer's inputs to tell it the order of words, since attention by itself treats all positions as equal.

Technically: Transformers are permutation-equivariant by default; positional encodings break this symmetry by injecting position information before or within attention. Early approaches added sinusoidal functions of position to embeddings; modern models use learned absolute embeddings, relative bias terms (ALiBi), or rotation-based schemes (RoPE). The choice directly shapes a model's ability to generalize to longer contexts than seen in training — a critical design decision for long-context models.

Category: Attention Mechanisms

Related ideas