Attention with Linear Biases (ALiBi)

A position-aware trick that adds a small penalty to attention scores based on how far apart two tokens are, helping the model handle text longer than it trained on.

Technically: Attention with Linear Biases (Press et al., 2022) adds a fixed, non-learned bias of -(slope * |i - j|) to attention logits before softmax, with a different slope per head. It uses no position-embedding vectors and extrapolates smoothly to sequences longer than the training window, since the bias penalizes distant tokens predictably. ALiBi limits perplexity loss on long sequences, though RoPE with scaling has largely supplanted it in newer architectures.

Category: Attention Mechanisms

Related ideas