What is Sliding Window Attention

NielsRogge · x · 2026-07-16

What is Sliding Window Attention

Sliding Window Attention (SWA) is a local attention mechanism that restricts each token's attention scope to a fixed-size neighborhood, rather than having the entire sequence attend to each other. This significantly reduces attention computation and KV cache memory overhead in long-context models.

It is typically paired with periodic global attention layers: the former efficiently handles local context, while the latter retains the ability to pass information over longer distances.

The post also includes related learning links and mentions that 208 papers have cited this mechanism, indicating it has become a very common foundational component in long-context modeling.

Original post →

More from Research

Research channel →