Transformer Architecture · 2021

Train Short Test Long: Attention with Linear Biases (ALiBi)

Ofir Press, Noah A. Smith, Mike Lewis

ALiBi replaces learned or sinusoidal position embeddings with a fixed linear penalty added to attention scores based on key-query distance, letting a model trained on short sequences run on much longer ones without retraining.

Editorial record

Plain-language summary

Instead of adding position vectors to token embeddings, ALiBi biases each attention score downward in proportion to how far apart the two tokens are, with a per-head slope. Because this bias is a simple distance function rather than a lookup limited to training lengths, a model trained on sequences of, say, 1024 tokens keeps working when evaluated on far longer inputs. This made length extrapolation cheap and removed the need to train at the target context length to get usable long-context behavior.

Knowledge graph

Relationships

Descendants

  • Makes efficientEvidence: Direct

    Attention Is All You Need

    ALiBi replaces positional encodings for length extrapolation

    P-005 paper

Source record

Provenance

Record ID
P-005
Record created
2026-07-13
Last reviewed
2026-07-14
Record version
2

Citation caveat: Citation metadata is approximate and marked unverified in the source dataset.