[Paper Review] QUOKA: Query-Oriented KV Selection For Efficient LLM Prefill
QuoKA is a training-free, hardware-agnostic sparse attention method for chunked LLM prefill that selects representative queries and KVs using cosine similarity, achieving substantial latency reductions with near-baseline accuracy.
We present QUOKA: Query-oriented KV selection for efficient attention, a training-free and hardware agnostic sparse attention algorithm for accelerating transformer inference under chunked prefill. While many queries focus on a smaller group of keys in the attention operator, we observe that queries with low cosine similarity with respect to the mean query interact more strongly with more keys and have the greatest contribution to final attention logits. By prioritizing these low cosine similarity queries, the behavior of full attention during the prefill stage can be closely approximated. QUOKA leverages this observation, accelerating attention by (1) first retaining a small set of representative queries and (2) then subselectin the keys most aligned with those queries. Through experiments on Needle-In-A-Haystack, LongBench, RULER, and Math500, we show that, while realizing a 3x reduction in time-to-first-token, 5x speedup in attention on Nvidia GPUs and up to nearly a 7x speedup on Intel Xeon CPUs, QUOKA achieves near-baseline accuracy, utilizing 88% fewer key-value pairs per attention evaluation.
Motivation & Objective
- Motivate reducing prefill latency in transformer inference under chunked prefill.
- Propose a lightweight, hardware-agnostic sparse-attention approach that operates on the KV cache.
- Show that selecting low-cosine-similarity queries and their most relevant KVs preserves accuracy while reducing computations.
- Demonstrate robustness and generalization across models and hardware (GPUs/CPUs).
- Provide empirical evidence on long-context and generation-oriented benchmarks.
Proposed method
- Retain a small set of representative queries based on cosine dissimilarity to the mean query.
- Compute a cosine-similarity proxy to score query–key relevance instead of using dot products.
- Aggregate scores across queries and KV groups to select a reduced KV subset.
- Feed the reduced KV set into a standard dense attention kernel (e.g., FlashAttention).
- Operate within chunked prefill to achieve sub-quadratic complexity in attention.
- Maintain portability by using standard linear-algebra operations without custom kernels.

Experimental results
Research questions
- RQ1How much can KV attention be reduced during chunked prefill without substantial accuracy loss?
- RQ2Do cosine-based scoring and geometry-aware query selection outperform generation-oriented or fixed-pattern sparsity in prefill?
- RQ3What is QuoKA’s accuracy and latency trade-off across long-context benchmarks and different model families?
- RQ4How well does QuoKA generalize across GPUs/CPUs and across decoder-only LLM architectures?
- RQ5Can QuoKA maintain performance when B_CP and B_SA budgets vary?
Key findings
- QuoKA achieves up to 5x attention speedup on Nvidia GPUs during prefill.
- QuoKA delivers about 3x improvements in time-to-first-token (TTFT) on long prompts.
- On Intel Xeon CPUs, QuoKA reaches up to nearly 7x speedup, and up to 5-6x on consumer GPUs.
- QuoKA uses 88% fewer key-value pairs per attention evaluation while preserving near-baseline accuracy.
- Across benchmarks Needle-In-A-Haystack, RULER, LongBench, and Math500, QuoKA outperforms competing sparse attention methods.
- Accuracy degrades gradually with sparsity, enabling tunable efficiency-accuracy trade-offs.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.