Vereenvoudigde Sparse Attention via Gist Tokens
Simplified Sparse Attention via Gist Tokens
June 26, 2026
Auteurs: Yuzhen Mao, Michael Y. Li, Emily B. Fox
cs.AI
Samenvatting
Sparse aandacht kan de kosten van inferentie met lange contexten verminderen, maar de meeste varianten introduceren nieuwe architectonische componenten. Wij introduceren Vereenvoudigde Sparse Aandacht (Simplified Sparse Attention, SSA), een eenvoudigere benadering van sparse aandacht die geen architectonische wijzigingen vereist. Concreet voeren we eerst een voortgezette voortraining uit op sequenties die zijn afgewisseld met gist-tokens. We optimaliseren zoals gebruikelijk het standaard next-token verlies, maar de gist-tokens gebruiken een aandachtsmasker om te beperken naar welke delen van de context het taalmodel kan kijken; dit leert het model om de belangrijke informatie van elk blok in de gist-tokens te verpakken. Tijdens inferentie scoort SSA blokken via aandacht tussen de huidige query en de kleine set gist-tokens, waarbij de top-k blokken selectief worden uitgevouwen door de bijbehorende ruwe tokens opnieuw in te voeren. Omdat de query alleen tegen de gist-tokens wordt gescoord, vermijden we de geheugenbandbreedtekosten die gepaard gaan met naïef scoren tegen de volledige KV-cache, zonder dat de hulp-KV-cache-aanpak nodig is die door sparse aandachtmethoden wordt gebruikt. Op LongBench presteert SSA consequent beter dan compressie- en inferentie-tijd sparse aandacht-baselines onder dezelfde compressieratio. Opvallender is dat bij retrieval-verbeterde generatie SSA na voortgezette voortraining zelfs meer dan 5,7 punten beter kan presteren dan volledige aandacht. Dit schrijven we toe aan het vermogen van SSA's selectieve uitvouwing, die de aandacht concentreert op de voor de query relevante blokken en effectief ruis wegfiltert. SSA breidt zich verder uit naar een hiërarchische gist-van-gist variant (H-SSA) die een log-lineaire decoderingcomplexiteit bereikt terwijl de nauwkeurigheid behouden blijft of verbetert bij hoge compressieratio's tot 32x. De code is beschikbaar op https://github.com/yuzhenmao/simplified-sparse-attention/.
English
Sparse attention can reduce the cost of long-context inference, but most variants introduce new architectural components. We introduce Simplified Sparse Attention (SSA), a simpler approach to sparse attention that requires no architectural changes. Concretely, we first perform continued pretraining on sequences interleaved with gist tokens. We optimize the standard next-token loss as usual, but the gist tokens use an attention mask to restrict what parts of the context the language model can attend to; this teaches the model to pack each chunk's important information into the gist tokens. At inference time, SSA scores chunks via attention between the current query and the small set of gist tokens, selectively unfolding the top-k chunks by reintroducing their corresponding raw tokens. Since the query is scored only against the gist tokens, we avoid the memory-bandwidth cost associated with naive scoring against the full KV cache, without requiring the auxiliary KV cache approach used by sparse attention methods. On LongBench, SSA consistently outperforms compression and inference-time sparse-attention baselines under the same compression ratio. More strikingly, in retrieval-augmented generation, SSA can even outperform full attention after continued pretraining by over 5.7 points. We attribute this to the ability of SSA's selective unfolding, which concentrates attention on the query-relevant chunks and effectively filters out noise. SSA further extends to a hierarchical gist-of-gist variant (H-SSA) that achieves log-linear decoding complexity while maintaining or improving accuracy at high compression ratios up to 32x. The code is available at https://github.com/yuzhenmao/simplified-sparse-attention/.