Sliding Window Attention
An approach where the attention mechanism looks not at the entire context, but only at a fixed window of the last N tokens.
Why
- Linear memory dependence on context length instead of quadratic;
- Faster inference;
- Ability to process long sequences.
Trade-offs
The model 'does not see' tokens outside the window. For tasks with long-range dependencies, this can reduce quality.
Example
Mistral uses sliding window attention in its models.