In this article
ALiBi modifies attention scores through a distance-dependent bias; its extrapolation results belong to the trained architecture and evaluated tasks.
Sequence order can enter a model through the attention score rather than through an added position vector. ALiBi follows this direction by applying a distance-based bias. The mechanism becomes clear when content similarity and positional preference are written as separate score contributions.
The bias changes the comparison before normalization
Attention first constructs content-dependent scores for eligible query-key pairs. ALiBi adds a position-related contribution before softmax. The contribution depends on distance and a slope associated with the head. It therefore changes relative preference across key positions without changing their vocabulary identities. This is a score-level operation, unlike a method that directly adds a learned position vector to the input. Both supply order information, but they do so at different locations in the attention computation.
Head slopes provide different distance preferences
Different heads can receive different slopes, allowing their positional biases to operate at different distance scales. The content score still matters: a distance penalty is not an instruction to ignore every distant key. A useful explanation considers the sum of content evidence and positional bias before normalization. Treating a head’s slope as a hard attention window would misdescribe the mechanism. A hard mask removes eligibility, while a finite bias adjusts preference among positions that remain available to the query.
Compare equally matched keys at different distances
As a thought experiment, give two eligible keys equal content scores but different distances from a query. Their positional contributions can differ, so the resulting normalized weights need not be equal. Next increase the distant key’s content score and examine how the balance changes. These controlled comparisons explain the bias without claiming that a particular natural-language token always wins. Real learned vectors supply varying content scores, and the rest of the network further transforms the aggregate information.
Keep mechanism and extrapolation evidence connected
The original study investigates training on shorter sequences and evaluating longer ones. Its evidence motivates the method but does not establish unlimited context quality for arbitrary checkpoints. Sliding-window sparsity, position interpolation and score biases answer different architectural questions. When reading a model implementation, identify whether ALiBi is actually used, how slopes and distances are calculated, and what masks apply. Then evaluate the task and length range of interest. A precise mechanism description helps interpret such a test rather than replace it with a general extrapolation promise.
Primary research and implementation references
Related engineering context
Reproducible inference stacks: preserving a GPU pilot’s result; A GPU inference benchmark you can trust.
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.