Each token only attends to a fixed window of recent tokens, keeping cost and cache flat as context grows.
Introduced inApr 2020Longformer: The Long-Document Transformer
Rather than looking at the entire history, a sliding-window layer attends only to the last N tokens. Models like Gemma and gpt-oss interleave many sliding layers with occasional full-attention layers: the sliding layers handle local structure cheaply while the periodic full layers carry long-range information. This hybrid keeps the KV cache small without giving up long-context ability.
Share of new models that have included sliding-window attention over time.
Open any of these on hfviewer to find this block in the interactive architecture graph.
Browse all 366 models with this in the catalog →
hfviewer renders the full architecture of 3,500+ Hugging Face models as interactive graphs. Hover any block to see what it does, with this model’s real numbers.
Browse all model graphs →