Transformers and LLMs

Sliding-Window Attention, explained

Sliding-window attention restricts each token to attend only to a nearby window of tokens.
Back to Glossary

Part of the Semantic Notion technical glossary.

Short Definition

Sliding-window attention restricts each token to attend only to a nearby window of tokens.

Intuition

Most local language structure is nearby, so a model can save compute by not attending globally in every layer.

Technical Definition

Sliding-window attention masks attention to a fixed local neighborhood, reducing attention cost relative to full sequence attention.

Example

A long-context model may use local attention in most layers and global attention in selected layers.

Common Misunderstandings

Sliding-window attention can miss distant dependencies unless combined with other mechanisms.
It is an efficiency tradeoff, not a universal replacement for global attention.

Start here

Need the broader concept map?

Return to the glossary index to move from this definition into adjacent AI, ML, mathematics, and computer science terms.