Deja Vu: Contextual Sparsity for Efficient LLMs at Inference Time
By Zichang Liu, Jue Wang, Tri Dao, Tianyi Zhou, Binhang Yuan, Zhao Song, Anshumali Shrivastava, Ce Zhang, Yuandong Tian, Christopher R'e and 1 more. International Conference on Machine Learning, 2023
356 citations recorded by the source corpus.
Large language models (LLMs) with hundreds of billions of parameters have sparked a new wave of exciting AI applications. However, they are computationally expensive at inference time. Sparsity is a natural approach to reduce this cost, but existing methods either require costly retraining, have to forgo LLM's in-context learning ability, or do not yield wall-clock time speedup on modern hardware. We hypothesize that contextual sparsity, which are small, input-dependent sets of attention heads and MLP parameters that yield approximately the same output as the dense model for a given input, can address these issues. We show that contextual sparsity exists, that it can be accurately predicted, and that we can exploit it to speed up LLM inference in wall-clock time without compromising LLM's quality or in-context learning ability. Based on these insights, we propose DejaVu, a system that uses a low-cost algorithm to predict contextual sparsity on the fly given inputs to each layer, along with an asynchronous and hardware-aware implementation that speeds up LLM inference. We validate that DejaVu can reduce the inference latency of OPT-175B by over 2X compared to the state-of-the-art FasterTransformer, and over 6X compared to the widely used Hugging Face implementation, without compromising model quality. The code is available at https://github.com/FMInference/DejaVu.
Subfields: Artificial Intelligence, Electrical and Electronic Engineering, Materials Chemistry
View Paper: https://www.semanticscholar.org/paper/95240dda409e28acccdc5cf619ad0c036cf4292d
How researchers see this paper
The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.
In Artificial Intelligence
In Electrical and Electronic Engineering
In Materials Chemistry
Citations in the corpus
- A Simple and Effective Pruning Approach for Large Language Models (2023, methodology): “Unstructured methods (Han et al., 2015; 2016; Paul et al., 2023; Hoang et al., 2023; Gadhikar et al., 2023; Liu et al., 2023a) like magnitude pruning operate at the individual weight level, maintaining performance even at higher sparsity levels.”
- Splitwise: Efficient Generative LLM Inference Using Phase Splitting (2023, methodology): “To further reduce our bandwidth utilization, we could also compress the KV-cache before transferring it across the network [55].”
- A Survey on In-context Learning (2022, background): “Subse-quently, VALLE-X (Zhang et al., 2023b) extend the idea to multi-lingual scenarios, demonstrating superior performance in zero-shot cross-lingual text-to-speech synthesis and zero-shot speech-to-speech translation tasks.”
- PowerInfer: Fast Large Language Model Serving with a Consumer-grade GPU (2023, unknown): “9 Related Work LLM Activation Sparsity: Recent advancements like De-jaVu [21], PIT [51], and brainstorm [8] are crucial to optimizing LLM inference, akin to PowerInfer.”
- Small Language Models are the Future of Agentic AI (2025, unknown): “On a closer look, however, much of the signals passing through these systems is sparse, engaging only a fraction of their parameters for any single input [65, 41].”
- AWQ: Activation-aware Weight Quantization for LLM Compression and Acceleration (2023, background): “The decoding stage dominates LLMs’ total runtime [17, 32], which is highly memory-bounded with a single batch size.”
- Model Tells You What to Discard: Adaptive KV Cache Compression for LLMs (2023, methodology): “Specifically, the fine-tuned variants are trained on LIMA 1 data (Zhou et al., 2023) and Open Assistant 2 (K ¨ opf et al., 2023) data.”