Exploiting Sparsity for Long Context Inference: Million Token Contexts on Commodity GPUs
Not on the map. Why?
Abstract (arXiv)
There is growing demand for performing inference with hundreds of thousands of input tokens on trained transformer models. Inference at this extreme scale demands significant computational resources, hindering the application of transformers at long contexts on commodity (i.e not data center scale) hardware. To address the inference time costs associated with running self-attention based transformer language models on long contexts and enable their adoption on widely available hardware, we propose a tunable mechanism that reduces the cost of the forward pass by attending to only the most relevant tokens at every generation step using a top-k selection mechanism. We showcase the efficiency gains afforded by our method by performing inference on context windows up to 1M tokens using approximately 16GB of GPU RAM. Our experiments reveal that models are capable of handling the sparsity induced by the reduced number of keys and values. By attending to less than 2% of input tokens, we achieve over 95% of model performance on common benchmarks (RULER, AlpacaEval, and Open LLM Leaderboard).
Key facts. Cited by 5 papers in the map (data through 14 Oct 2026). Builds on 31 of its 38 references that are in the map. First posted on arXiv 10 Feb 2025.
Builds on
31 of 38 references.
References · 31
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 14,132
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 13,028
- 2023Judging LLM-as-a-Judge with MT-Bench and Chatbot Arenacited by 8,626
- 2020Measuring Massive Multitask Language Understandingcited by 7,963
- 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 5,944
- 2018Think you have Solved Question Answering? Try ARC, the AI2 Reasoning Challengecited by 4,886
- 2016SQuAD: 100,000+ Questions for Machine Comprehension of Textcited by 4,148
- 2019HellaSwag: Can a Machine Really Finish Your Sentence?cited by 4,100
- 2018HotpotQA: A Dataset for Diverse, Explainable Multi-hop Question Answeringcited by 3,754
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,673
- 2020Longformer: The Long-Document Transformercited by 3,413
19 more
- 2019PIQA: Reasoning about Physical Commonsense in Natural Languagecited by 2,883
- 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,598
- 2023Efficient Streaming Language Models with Attention Sinkscited by 2,186
- 2019BoolQ: Exploring the Surprising Difficulty of Natural Yes/No Questionscited by 2,183
- 2018Can a Suit of Armor Conduct Electricity? A New Dataset for Open Book Question Answeringcited by 2,164
- 2019Generating Long Sequences with Sparse Transformerscited by 1,546
- 2024RULER: What's the Real Context Size of Your Long-Context Language Models?cited by 1,346
- 2024Length-Controlled AlpacaEval: A Simple Way to Debias Automatic Evaluatorscited by 897
- 2016Efficient and robust approximate nearest neighbor search using Hierarchical Navigable Small World graphscited by 861
- 2023FlexGen: High-Throughput Generative Inference of Large Language Models with a Single GPUcited by 575
- 2022Efficiently Scaling Transformer Inferencecited by 539
- 2023Ring Attention with Blockwise Transformers for Near-Infinite Contextcited by 457
- 2024The Unreasonable Ineffectiveness of the Deeper Layerscited by 226
- 2024World Model on Million-Length Video And Language With Blockwise RingAttentioncited by 198
- 2024RetrievalAttention: Accelerating Long-Context LLM Inference via Vector Retrievalcited by 116
- 2024MagicPIG: LSH Sampling for Efficient LLM Generationcited by 111
- 2024PQCache: Product Quantization-based KVCache for Long Context LLM Inferencecited by 95
- 2024Loki: Low-rank Keys for Efficient Sparse Attentioncited by 89
- 2021Memory-efficient Transformers via Top-k Attentioncited by 60
Built on by
Citing papers per year: 2025: 2; 2026: 3.
5 papers.
- 2026End-to-End Context Compression at Scalecited by 4
- 2025A Preliminary Study on the Promises and Challenges of Native Top-k Sparse Attentioncited by 3
- 2026LiteTopK: Exploiting the Curse of Dimensionality for a Fused Indexer-TopK Kernel in Long-Context Sparse Attentioncited by 2
- 2026Slow-Fast Inference: Training-Free Inference Acceleration via Within-Sentence Support Stabilitycited by 1
- 2025A Faster Generalized Two-Stage Approximate Top-Kcited by 0
- 2026LiteTopK: Exploiting the Curse of Dimensionality for a Fused Indexer-TopK Kernel in Long-Context Sparse Attention13 Jul 2026
- 2026End-to-End Context Compression at Scale8 Jun 2026
- 2026Slow-Fast Inference: Training-Free Inference Acceleration via Within-Sentence Support Stability12 Mar 2026
- 2025A Preliminary Study on the Promises and Challenges of Native Top-k Sparse Attention3 Dec 2025
- 2025A Faster Generalized Two-Stage Approximate Top-K4 Jun 2025