MixKVQ: Query-Aware Mixed-Precision KV Cache Quantization for Long-Context Reasoning

Tao Zhang, Ziqian Zeng, Hao Peng, Huiping Zhuang, Cen Chen

TL;DR

MixKVQ is a novel, plug-and-play quantization method that slashes the memory footprint of Large Language Model (LLM) KV caches while preserving their complex reasoning capabilities. By using a "query-aware" heuristic to identify and protect critical data channels in high precision (BF16) while aggressively compressing others to 2 or 4 bits, it achieves near-lossless performance and up to a 2.8x boost in inference throughput.

What Problem Does This Paper Address?

As LLMs move toward "long-context reasoning"—generating massive Chain-of-Thought (CoT) sequences to solve hard problems—they hit a massive wall: the Key-Value (KV) cache. To generate tokens one by one, the model must store the "keys" and "values" of every previous token in memory. This cache grows linearly with the sequence length. For a 32B parameter model handling 32,000 tokens, the KV cache can balloon to over 500GB—nearly nine times the size of the model weights themselves.

While quantization (converting high-precision numbers to low-bit integers) can shrink this cache, existing methods fail at extreme compression (like 2-bit). They either treat all data as equally important or only look at the "outliers" in the cache itself. The authors argue these methods miss a crucial piece of the puzzle: the query. A specific channel in the key cache might have large values (outliers), but if the model’s current query doesn't attend to that channel, high-precision storage is a waste of memory.

Methods

The authors introduce MixKVQ, a mixed-precision strategy that dynamically allocates bit-widths based on a "Salience Score" ($A_d$). This score is the product of two factors:

  1. Importance Score ($I_d$): The average magnitude of the current query activations. This tells the model which channels the "question" is actually looking at.
  2. Sensitivity Score ($S_d$): The dynamic range of the key cache channels. This identifies which channels are inherently difficult to quantize without losing information.

Based on this score, MixKVQ uses a three-tiered approach for the Key Cache:

  • High-Precision (BF16): The most "salient" channels are kept in full 16-bit precision.
  • Medium-Precision (UINT4): Moderately important channels are compressed to 4-bit.
  • Low-Precision (UINT2): Non-critical channels are aggressively compressed to 2-bit.

The Value Cache is kept simple with uniform 2-bit quantization, as the authors found it less sensitive to precision loss than the Key cache. To keep the system efficient, they use Amortized Scheduling (Lazy Updates), where quantization parameters are only recalculated every $R$ tokens (e.g., every 128 tokens) rather than at every single step.

Datasets

The researchers evaluated MixKVQ across several demanding reasoning and long-context benchmarks:

  • Reasoning: AIME 2024-2025 (math competitions), MATH 500, GPQA-Diamond (graduate-level science), and LiveCodeBench (coding).
  • Long Context: LongBench (including tasks like Qasper, MultiFieldQA, and HotpotQA).
  • Calibration: GSM8K was used to fine-tune the importance thresholds.
  • Models: Tested on the DeepSeek-R1-Distill series (Llama-8B, Qwen-14B, Qwen-32B) and Mistral-7B.

Key Insights and Ideas

  • The Query is the Filter: Traditional quantization is "query-blind." MixKVQ proves that incorporating query information is the "secret sauce" for maintaining reasoning accuracy at low bit-widths. If the query doesn't care about a channel, the quantization error in that channel doesn't matter.
  • Key > Value: The Key cache is significantly more sensitive to quantization than the Value cache. Protecting just a few critical channels in the Key cache (the "sparse outliers") is enough to stabilize the entire attention mechanism.
  • Reasoning is Fragile: Standard benchmarks (like WikiText) often hide the failures of quantization. The authors show that 2-bit quantization that looks "fine" on language modeling can completely break a model's ability to follow a logical math chain.

Key Results

  • Near-Lossless Reasoning: On the Qwen-32B model, MixKVQ achieved an average reasoning score of 66.04%, remarkably close to the full-precision (BF16) baseline of 67.84%. In contrast, the popular 2-bit KIVI method dropped to 58.89%.
  • Extreme Compression: MixKVQ pushed the effective bit-width down to ~2.7 bits on LongBench with negligible performance degradation.
  • Throughput Gains: In real-world serving simulations (using a Llama2-13B setup), MixKVQ enabled a 2.25x larger batch size and increased throughput by 2.6x to 2.8x compared to 16-bit baselines, effectively breaking the memory-bandwidth bottleneck.

Limitations and Future Work

  • Computational Overhead: While MixKVQ saves massive amounts of memory, the process of identifying salient channels and transforming tensors adds some computational cost. The authors suggest deeper integration with kernels (like vLLM) could mitigate this.
  • Attention Architectures: The current study does not cover Multi-Head Latent Attention (MLA), a specialized architecture used in some newer models like DeepSeek-V3.
  • Prompt Processing: The analysis focused on the "generation" phase (where memory is the bottleneck). The "prefill" or prompt processing phase, which is more compute-bound, remains an area for further optimization.

Summary updated

BibTeX
@inproceedings{zhang2026mixkvq,
  author = {Tao Zhang and Ziqian Zeng and Hao Peng and Huiping Zhuang and Cen Chen},
  title = {{MixKVQ: Query-Aware Mixed-Precision KV Cache Quantization for Long-Context Reasoning}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2026},
  doi = {10.18653/v1/2026.acl-long.326},
}
Figure