Skip to content

Sliding-window beats linear attention

Aug 2026 · 0 citations · 67 references
Computer Science

TL;DR

This work shows that Sliding Window Attention (SWA) with sinks performs as well or better than post-trained Linear Attention models, and recommends switching to SWA instead of post-training linear models.

Abstract

Due to the nature of quadratic attention, Large Language Models (LLMs) consume a lot of memory and energy: every new token costs more than the previous one, and its keys and values must be stored in memory indefinitely, which is unsustainable. Two main lines of work address this: compressing the KV cache, e.g., by evicting or quantizing keys and values, and retrofitting LLMs to use Linear Attention, which replaces the KV cache with a fixed-size state. Retrofitting has attracted a lot of attention, given its promise to solve the quadratic scaling problem with state-of-the-art performance at low cost. However, it has not been properly compared to the simplest form of KV-cache eviction: Sliding Window Attention (SWA) with attention sinks. In this work, we show that SWA with sinks performs as well or better than most retrofitted Linear Attention models across multiple LLMs and downstream tasks, with the largest gains on long-context and generative tasks. On long-context reasoning tasks (Needle-in-a-Haystack and BABILong), SWA achieves massively higher performance (2 to 10 times higher than linear attention). SWA requires no additional training, is extremely fast, and requires little memory, making it an extremely cheap and reliable solution. When the training budget is limited, switching to SWA is a much more effective way to reduce inference memory cost than retrofitting linear attention. Linear attention models have shown promise, but they require training from scratch or extensive retrofitting to reap their architectural benefits and come close to SWA.

View source

Similar papers

#artificial intelligence Preprint Sep 2026

Switching Linear Attention

Designing expressive sequence layers with efficient inference remains a central challenge in modern machine learning. Standard softmax attention achieves excellent sequence modeling performance through rich nonlinear token interactions, but it requires a key-value cache that grows linearly with sequence length, limitin...

Hyun Dong Lee, X. Gonzalez, Nicolas Zucchet et al. · 0 citations
#small language model Preprint Aug 2026

Daedalus-150M: A Convolution-Attention Hybrid Designed for CPU Inference

A conventional all-attention model of the same size on the same data and a conventional all-attention hybrid that beats GPT-2 124M, Pythia-160M, OPT-125M and GPT-neo-125M, and exceeds MobileLLM-125M's published score despite that model seeing a trillion tokens.

Christos Koutsiaris · 0 citations
#machine learning Preprint Sep 2026

Latest Exact Match Attention

It is proved that LEMA transformers with chain of thought can simulate word-RAMs, as was recently shown for the less restrictive rightmost hard attention, and dictionary-based inference is implemented for LEMA transformers with dictionaries residing in main memory rather than VRAM.

M. Brösamle · 0 citations
#machine learning Preprint Sep 2026

Broken Symmetry in BF16 Attention: Why FlashAttention Gradients Blow Up Late in Training

GProj (gauge projection), which restores the zero sum after the cast with two rank-one corrections per row, and cuts the remaining median query/key gradient errors from 219%/13% to 0.34%/0.37%, on par with FP32 attention, for 4.7% more time per training step.

Jun-Lin Chen, Daize Dong, Huan-Wei Di et al. · 0 citations
#machine learning Preprint Sep 2026

When Can Attention Heads Be Statically Defined?

Some attention heads learn similar patterns across inputs. Reusing these patterns could reduce training cost by avoiding repeated query-key score computation and softmax. Through controlled pretraining comparisons, we identify Selective Attention Freezing (SAF), which selects heads with low attention-pattern variance a...

Weixian Waylon Li, Yin-Tao Tai, Marcio Fonseca et al. · 0 citations

Related blog posts

MIT News · Artificial Intelligence Aug 27, 2026

Looking beyond natural sequences

A new machine-learning framework aims to improve the success rate of computational protein design while moving away from results that reproduce sequences found in nature.

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.