Sliding-Window Attention

Sliding-window attention restricts each token to attend only to a nearby window of tokens.
Also known as
local attention

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.

Need this inside a product?

The studio builds the systems these terms describe. Tell us what you are working on.