Running Huge Context Windows On Tiny GPUs
Abstract
There is growing demand for large language models that can process hundreds of thousands or even millions of input tokens. Inference at this extreme scale demands significant computational resources and costs. To address the inference time costs associated with running self-attention based transformer language models on long contexts, 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 1% of input tokens, we achieve over 95% of model performance on common long context benchmarks (LM-Eval, AlpacaEval, and RULER).
BibTeX
@misc{hoover2025running,
author = {Monte Hoover and Ryan Synk and Neel Jain and John Kirchenbauer and Alex Stein and Manli Shu and Ramani Duraiswami and Tom Goldstein},
title = {{Running Huge Context Windows On Tiny GPUs}},
year = {2025},
url = {https://openreview.net/forum?id=pG820nmDvy},
howpublished = {OpenReview},
note = {Submitted to ICLR 2025},
}Ask Althea to put this paper to the test.