Stochastic Sparse Attention for Memory-Bound Inference
Abstract
Lay Summary
Large language models are increasingly asked to work with long documents and conversations. When generating each new word, they often repeatedly read a large memory of previous words; at long lengths, this data movement can become a speed and energy bottleneck. Our paper focuses on attention, the part of the model that looks back at earlier words to decide what information matters now. We introduce SANTA, a way to make this step cheaper by sampling a small number of stored entries instead of reading and multiplying through all of them. The key idea is like estimating an average from a carefully chosen sample: with enough samples, the model gets nearly the same answer while moving much less data. We design sampling strategies and GPU kernels that make this practical for long-context language model decoding. On Llama-3.1-8B-Instruct, SANTA matches standard attention accuracy on long-context tasks while speeding up the attention step by up to 1.5× and full batched generation by up to 1.25×. Because it changes how the model reads existing memory rather than permanently deleting context, it can work alongside compression and cache-management methods. This points toward faster and more energy-efficient language model inference for long-context applications.