VQKV: High-Fidelity and High-Ratio Cache Compression via Vector-Quantization

Yixuan Wang, Qingyu Shi, Jiayu Zhou, Dianbo Liu, Ziwei He, Zhouhan Lin · DOI

Abstract

The growing context length of Large Language Models (LLMs) enlarges the Key-Value (KV) cache, limiting deployment in resource-limited environments. Prior training-free approaches for KV cache compression typically rely on low-rank approximation or scalar quantization, which fail to simultaneously achieve high compression ratios and high reconstruction fidelity. We propose VQKV, a novel, training-free method introducing vector quantization (VQ) to obtain highly compressed KV representations while preserving high model fidelity, allowing for the representation of thousands of floating-point values with just a few integer indices. As a result, VQKV achieves an 82.8% compression ratio on LLaMA3.1-8B while retaining 98.6% of the baseline performance on LongBench and enabling 4.3x longer generation length on the same memory footprint.

Introduction

As Large Language Models (LLMs) move toward processing "infinite" context windows, the Key-Value (KV) cache has become a critical physical bottleneck. For every token processed, the model must store high-dimensional "Key" and "Value" vectors for future attention mechanisms. As sequence lengths increase, this cache consumes massive amounts of GPU VRAM, often exceeding the capacity of standard hardware and limiting long-document processing or multi-turn conversations.

Existing compression strategies generally fall into three categories: token eviction (dropping "unimportant" tokens), scalar quantization (reducing individual numerical precision), and architectural changes (e.g., Multi-Query Attention). However, these methods often trade off accuracy for compression or require expensive model retraining. VQKV addresses these challenges by providing a training-free, high-fidelity solution that achieves significant compression ratios.

Methodology: Vector Quantization for KV Caches

The core innovation of VQKV is the application of Vector Quantization (VQ)—specifically Residual Simple Vector Quantization (RSimVQ)—to the KV cache. Unlike scalar quantization, which processes numbers individually, VQ treats groups of numbers as single units, capturing intrinsic correlations between dimensions.

Overview of the VQKV architecture, illustrating the prefilling (quantization) and decoding (retrieval) stages within the hybrid cache structure.

Technical Components

  • Residual Design: RSimVQ employs multiple codebooks where each successive book quantizes the residual error from the previous one, allowing for progressively finer reconstruction.
  • RoPE Robustness: The residual structure effectively handles the complex frequency variations introduced by Rotary Positional Embeddings (RoPE).
  • Hybrid Storage: VQKV utilizes a hybrid approach, maintaining the initial and most recent (local) tokens in full precision while compressing the massive intermediate cache.
  • Custom FlashAttention Kernel: To mitigate decompression overhead, a customized Triton kernel integrates decompression directly into the attention computation.

Experimental Setup

The authors evaluated VQKV on LLaMA3.1-8B and LLaMA3.2-3B. Codebooks were trained once using a 0.1% sample of the OpenWebText corpus, requiring no fine-tuning of the LLM itself. Performance was measured across several benchmarks:

  • LongBench: For long-context understanding.
  • Needle-In-A-Haystack (NIAH): For specific fact retrieval within massive contexts.
  • RULER: To probe effective context length across retrieval and aggregation tasks.

Key Results and Performance

VQKV demonstrates superior performance compared to existing training-free compression methods.

Compression and Fidelity

On LLaMA3.1-8B, VQKV achieved an 82.8% compression ratio while retaining 98.6% of the baseline performance on LongBench. Notably, the method maintained a perfect 100% score on the NIAH test up to 32K context, significantly outperforming competitors like ASVD and Palu.

Comparison of Needle-In-A-Haystack (NIAH) performance across various compression methods. VQKV (f) maintains perfect fidelity compared to the baseline (a).

Memory and Efficiency

Using a single NVIDIA RTX 4090, VQKV extended the maximum generation length from approximately 190k tokens to over 824k tokens, representing a 4.3x increase in memory efficiency.

Discussion and Conclusion

VQKV proves that joint quantization of entire vectors is more effective than scalar approaches because it preserves the "meaning" of representations by capturing inter-dimensional correlations. Interestingly, the quantization process may even act as a form of denoising, occasionally leading to performance that exceeds the uncompressed baseline.

While VQKV offers substantial gains, future work will focus on further optimizing the computational overhead of VQ lookups in the decoding stage and exploring the limits of the method on models exceeding 70B parameters.

Summary updated

Abstract

The growing context length of Large Language Models (LLMs) enlarges the Key-Value (KV) cache, limiting deployment in resource-limited environments. Prior training-free approaches for KV cache compression typically rely on low-rank approximation or scalar quantization, which fail to simultaneously achieve high compression ratios and high reconstruction fidelity. We propose VQKV, a novel, training-free method introducing vector quantization (VQ) to obtain highly compressed KV representations while preserving high model fidelity, allowing for the representation of thousands of floating-point values with just a few integer indices. As a result, VQKV achieves an 82.8\% compression ratio on LLaMA3.1-8B while retaining 98.6\% of the baseline performance on LongBench and enabling 4.3x longer generation length on the same memory footprint.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
LongBench · LLaMA3.1-8B KV-cache compressionVQKVdiscarding ratio82.8%params=8B · backbone=LLaMA3.1-8B
Source quote
L16: Extensive evaluations on LLaMA3.1-8B \citep{llama3.1-8b} across the LongBench \citep{longbench} benchmarks demonstrate that our VQKV achieves an 82.8% discarding ratio while retaining 98.6% of the baseline performance. Remarkably, on some tasks, VQKV even surpasses the performance of the uncompressed full-cache baseline. Under identical hardware settings, this memory efficiency translates into up to 4.3× longer generation lengths than the original model.
LongBenchVQKVAvg. score33.1params=8B · backbone=LLaMA3.1-8B · discarding-ratio=80.0%
Source quote
L281: VQKV │ 14.3 │ 19.8 │ 29.8 │ 11.9 │ 13.8 │ 8.3 │ 26.3 │ 23.9 │ 0.9 │ 73.5 │ 90.5 │ 45.7 │ 0.8 │ 28.7 │ 71.7 │ 69.5 │ 33.1
Reported baseline / comparator measurements (1)
BenchmarkMethodMetricScoreProtocol / Evidence
LongBenchLLaMA3.1-8B full-cache baseline baselineAvg. score33.5params=8B · backbone=LLaMA3.1-8B · discarding-ratio=0%
Source quote
L265: 0 │ LLaMA3.1-8B │ \gray{13.0} │ \gray{20.4} │ \gray{32.1} │ \gray{12.0} │ \gray{14.0} │ \gray{8.7} │ \gray{29.7} │ \gray{25.2} │ \gray{1.0} │ \gray{73.5} │ \gray{91.0} │ \gray{47.2} │ \gray{0.8} │ \gray{26.8} │ \gray{72.0} │ \gray{69.2} │ \gray{33.5}
BibTeX
@misc{wang2026vqkv,
  author = {Yixuan Wang and Qingyu Shi and Jiayu Zhou and Dianbo Liu and Ziwei He and Zhouhan Lin},
  title = {{VQKV: High-Fidelity and High-Ratio Cache Compression via Vector-Quantization}},
  year = {2026},
  eprint = {2603.16435},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2603.16435},
}
Figure