User Tools

Site Tools


papers:chen-2025

MagicPIG: LSH Sampling for Efficient LLM Generation

Abstract: Large language models (LLMs) with long context windows have gained significant attention. However, the KV cache, stored to avoid re-computation, becomes a bottleneck. Various dynamic sparse or TopK-based attention approximation methods have been proposed to leverage the common insight that attention is sparse. In this paper, we first show that TopK attention itself suffers from quality degradation in certain downstream tasks because attention is not always as sparse as expected. Rather than selecting the keys and values with the highest attention scores, sampling with theoretical guarantees can provide a better estimation for attention output. To make the sampling-based approximation practical in LLM generation, we propose MAGICPIG, a heterogeneous system based on Locality Sensitive Hashing (LSH). MAGICPIG significantly reduces the workload of attention computation while preserving high accuracy for diverse tasks. MAGICPIG stores the LSH hash tables and runs the attention computation on the CPU, which allows it to serve longer contexts and larger batch sizes with high approximation accuracy. MAGICPIG can improve decoding throughput by up to 5× across various GPU hardware and achieve 54ms decoding latency on a single RTX 4090 for Llama-3.1-8B-Instruct model with a context of 96k tokens.

Zhuoming Chen, Ranajoy Sadhukhan, Zihao Ye, Yang Zhou, Jianyu Zhang, Niklas Nolte, Yuandong Tian, Matthijs Douze, Léon Bottou, Zhihao Jia and Beidi Chen: MagicPIG: LSH Sampling for Efficient LLM Generation, The Thirteenth International Conference on Learning Representations, 2025.

iclr-magicpig-2025.djvu iclr-magicpig-2025.pdf iclr-magicpig-2025.ps.gz

@inproceedings{chen-2025,
  title = {Magic{PIG}: {LSH} Sampling for Efficient {LLM} Generation},
  author = {Chen, Zhuoming and Sadhukhan, Ranajoy and Ye, Zihao and Zhou, Yang and Zhang, Jianyu and Nolte, Niklas and Tian, Yuandong and Douze, Matthijs and Bottou, L\'{e}on and Jia, Zhihao and Chen, Beidi},
  booktitle = {The Thirteenth International Conference on Learning Representations},
  year = {2025},
  url = {http://leon.bottou.org/papers/chen-2025},
}
papers/chen-2025.txt · Last modified: 2026/03/17 19:23 by leonb

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki