Quest: Query-Aware Sparsity for Efficient Long-Context LLM Inference

Jiaming Tang, Yilong Zhao, Kan Zhu, Guangxuan Xiao, Baris Kasikci +1 more
6/16/2024
cs.CLcs.LG

No official code found. Best implementation: mit-han-lab/Quest (400 stars, MIT, last commit 2025-07-10).

Abstract

As the demand for long-context large language models (LLMs) increases, models with context windows of up to 128K or 1M tokens are becoming increasingly prevalent. However, long-context LLM inference is challenging since the inference speed decreases significantly as the sequence length grows. This slowdown is primarily caused by loading a large KV cache during self-attention. Previous works have shown that a small portion of critical tokens will dominate the attention outcomes. However, we observe the criticality of a token highly depends on the query. To this end, we propose Quest, a query-aware KV cache selection algorithm. Quest keeps track of the minimal and maximal Key values in KV cache pages and estimates the criticality of a given page using Query vectors. By only loading the Top-K critical KV cache pages for attention, Quest significantly speeds up self-attention without sacrificing accuracy. We show that Quest can achieve up to 2.23x self-attention speedup, which reduces inference latency by 7.03x while performing well on tasks with long dependencies with negligible accuracy loss. Code is available at http://github.com/mit-han-lab/Quest .

View on arXivView PDF

Code Implementations(1)

mit-han-lab/QuestCommunity100%
MIT

[ICML 2024] Quest: Query-Aware Sparsity for Efficient Long-Context LLM Inference

40048C, C++Jun 15, 20241 years agoMIT

Similar Papers

Cite this paper

@article{tang2024quest,
  title  = {Quest: Query-Aware Sparsity for Efficient Long-Context LLM Inference},
  author = {Jiaming Tang and Yilong Zhao and Kan Zhu and Guangxuan Xiao and Baris Kasikci and Song Han},
  year   = {2024},
  eprint = {2406.10774},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2406.10774v2},
  journal = {ICML 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2406.10774.svg)](https://codeofpaper.com/paper/2406.10774)

Discussion