# ALiBi

- **Canonical URL:** https://getaimath.com/dictionary/alibi/
- **Topics:** [Transformer Architecture](https://getaimath.com/dictionary/category/transformer-architecture/)
- **Last updated:** 2026-11-25

## 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.

![Transformers & Attention: The Smart Highlighter — Simple cartoon diagram showing how a Transformer reads a whole sentence at once and shines a bright highlighter beam from the word "IT" back to "trophy" so it knows what "IT" means.](https://getaimath.com/diagrams/transformer-architecture.png)
*Napkin Diagram (Transformer Architecture): Older AI read word-by-word and often lost track of earlier words; a Transformer highlights which words connect to which.*

## What is an example of ALiBi?

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.

## Related Concepts

- [Rotary Positional Embedding (RoPE)](https://getaimath.com/dictionary/rotary-positional-embedding-rope/): RoPE is a popular way to tell a model about word positions by rotating its query and key numbers by an angle based on position.
- [Feed-Forward Network (FFN)](https://getaimath.com/dictionary/feed-forward-network-ffn/): A feed-forward network is the part of each Transformer block that processes each token on its own after attention.
- [Positional Encoding](https://getaimath.com/dictionary/positional-encoding/): Positional encoding adds information about word order, so the model knows which word came first, second, and so on.
- [Multi-Layer Perceptron (MLP)](https://getaimath.com/dictionary/multi-layer-perceptron-mlp/): A multi-layer perceptron is a basic neural network made of layers of neurons where every neuron connects to every neuron in the next layer.
- [Attention Mask](https://getaimath.com/dictionary/attention-mask/): An attention mask is a pattern that tells the model which positions it may or may not attend to.
- [Activation Function](https://getaimath.com/dictionary/activation-function/): An activation function decides how strongly a neuron "fires" by transforming its total input into its output.

---
Source: The AI Math Dictionary (https://getaimath.com/dictionary/alibi/)
