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

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

16 Jun 2024arXiv:2406.10774archive 2025-07-28

Jiaming Tang, Yilong Zhao, Kan Zhu, Guangxuan Xiao, Baris Kasikci, Song Han

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 .

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2406.10774")

Code

Syntology Ran 7 of 12 code samples harvested from 1 repository linked to this paper; 5 have no recorded run. Of those that ran: 1 ran · honoured contract; 1 ran · violated contract; 2 ran · our draft was wrong; 3 ran with no contract checked.

By repository: official repository: 12 samples from 1 repository, 7 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

mit-han-lab/quest officialmentioned in papermentioned on GitHubpytorchMIT report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

12 samples harvested; 7 ran; 1 honoured the contract we drafted; 5 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · honoured contract
1ran · violated contract
2ran · our draft was wrong
3ran
5unverified

Licence: 0 of the 12 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from mit-han-lab/Quest. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

count_score mit-han-lab/Quest/evaluation/LongBench/metrics.py official repository ran · honoured contract fingerprinted MIT (permissive) · b349b79d9cc2934b · report
generate_prompt mit-han-lab/Quest/evaluation/passkey/passkey.py official repository ran MIT (permissive) · 82a59167e1c0360c · report
local_heavy_hitter_mask mit-han-lab/Quest/evaluation/quest_attention.py official repository ran MIT (permissive) · 2190cf0bf20bf72f · report
normalize_answer mit-han-lab/Quest/evaluation/LongBench/metrics.py official repository ran · our draft was wrong fingerprinted MIT (permissive) · e7e75981cb464788 · report
normalize_zh_answer mit-han-lab/Quest/evaluation/LongBench/metrics.py official repository ran · our draft was wrong fingerprinted MIT (permissive) · 8c5c581f9264c810 · report
parse_args mit-han-lab/Quest/evaluation/LongBench/pred.py official repository ran MIT (permissive) · c2ae4c2b89cd4aae · report
post_process mit-han-lab/Quest/evaluation/LongBench/pred.py official repository ran · violated contract fingerprinted MIT (permissive) · 4489113b536ca6eb · report
add_args mit-han-lab/Quest/evaluation/passkey/passkey.py official repository unverified MIT (permissive) · a16da1e7b565968b · report
build_chat mit-han-lab/Quest/evaluation/LongBench/pred.py official repository unverified MIT (permissive) · 324506640e971548 · report
forward mit-han-lab/Quest/evaluation/quest_attention.py official repository unverified MIT (permissive) · 1e15c8009d60ec39 · report
load mit-han-lab/Quest/evaluation/pg19/ppl_eval.py official repository unverified MIT (permissive) · 72836b3c90faaa5d · report
test_model mit-han-lab/Quest/evaluation/passkey/passkey.py official repository unverified MIT (permissive) · 3bccc0e6004c76a1 · report

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

SPEED

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections