Learn AI Math

ALiBi

What is ALiBi?

In one sentence: ALiBi is a simple way of handling word position by adding a penalty to attention scores based on how far apart two words are.

ALiBi stands for Attention with Linear Biases. Instead of adding position info to the tokens, it lowers the attention score more for words that are farther away. This gently encourages the model to focus on nearby words and helps it handle texts longer than it trained on.

What does ALiBi look like?

Under ALiBi, a word 100 positions back gets a bigger attention penalty than a word 2 positions back.

Why does ALiBi matter?

ALiBi helps models work on longer texts than they were trained on.

Last updated · Fact-checked by The AI Math

Linking to this page from a lesson or article?

Like this explanation? Get one every week.

The AI Math newsletter turns confusing AI news into plain English. No hype, no jargon walls.