cd /news/artificial-intelligence/exploiting-sparsity-for-long-context… · home topics artificial-intelligence article
[ARTICLE · art-53996] src=arxiv.org ↗ pub= topic=artificial-intelligence verified=true sentiment=↑ positive

Exploiting Sparsity for Long Context Inference: Million Token on Commodity GPUs

Researchers propose a tunable top-k selection mechanism that reduces the cost of the forward pass in transformer language models by attending to only the most relevant tokens, enabling inference on context windows up to 1 million tokens using approximately 16GB of GPU RAM. The method achieves over 95% of model performance on common benchmarks while attending to less than 2% of input tokens, making long-context inference feasible on commodity hardware.

read2 min views1 publishedJul 10, 2026
Exploiting Sparsity for Long Context Inference: Million Token on Commodity GPUs
Image: source
[Submitted on 10 Feb 2025 (

[v1](https://arxiv.org/abs/2502.06766v1)), last revised 12 Feb 2025 (this version, v2)]# Title:Exploiting Sparsity for Long Context Inference: Million Token Contexts on Commodity GPUs

[View PDF](/pdf/2502.06766)

[HTML (experimental)](https://arxiv.org/html/2502.06766v2)

Abstract: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).

Submission history #

From: Monte Hoover [[view email](/show-email/4c7fec4d/2502.06766)]

**Mon, 10 Feb 2025 18:47:04 UTC (7,688 KB)**

[[v1]](/abs/2502.06766v1)**[v2]** Wed, 12 Feb 2025 15:55:37 UTC (7,689 KB)

References & Citations

...

Bibliographic Explorer

(What is the Explorer?) Connected Papers

(What is Connected Papers?) Litmaps

(What is Litmaps?) scite Smart Citations

(What are Smart Citations?)# Code, Data and Media Associated with this Article alphaXiv

(What is alphaXiv?) CatalyzeX Code Finder for Papers

(What is CatalyzeX?) DagsHub

(What is DagsHub?) Gotit.pub

(What is GotitPub?) Hugging Face

(What is Huggingface?) ScienceCast

(What is ScienceCast?)# Demos Influence Flower

(What are Influence Flowers?) CORE Recommender

(What is CORE?)# arXivLabs: experimental projects with community collaborators arXivLabs is a framework that allows collaborators to develop and share new arXiv features directly on our website.

Both individuals and organizations that work with arXivLabs have embraced and accepted our values of openness, community, excellence, and user data privacy. arXiv is committed to these values and only works with partners that adhere to them.

Have an idea for a project that will add value for arXiv's community? Learn more about arXivLabs.

── more in #artificial-intelligence 4 stories · sorted by recency
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/exploiting-sparsity-…] indexed:0 read:2min 2026-07-10 ·