KVzap: Fast, Adaptive, and Faithful KV Cache Pruning
Simon Jegou, Maximilian Jeblick
TL;DR
KVzap addresses the KV cache memory bottleneck in long-context transformer inference by introducing a fast, input-adaptive pruning approach that uses lightweight per-layer surrogates to predict KV importance from hidden states and applies threshold-based pruning with a sliding window. By combining a normalization-inspired scoring (KVzip+) with efficient surrogates (KVzap-Linear and KVzap-MLP), it enables $2\times$ to $4\times$ KV cache compression while maintaining accuracy across prefilling and decoding tasks and achieving state-of-the-art results on KVpress benchmarks. The method is trained on a large, diverse dataset to learn per-layer mappings from hidden states to KV importance and includes thorough ablations and overhead analyses showing negligible compute and memory penalties. KVzap demonstrates strong generalization across models (Qwen3-8B, Qwen3-32B, Llama-3.1-8B-Instruct) and tasks (RULER, LongBench, AIME25), offering a practical path toward production deployment in inference engines with fast, adaptive, and faithful KV cache pruning.
Abstract
Growing context lengths in transformer-based language models have made the key-value (KV) cache a critical inference bottleneck. While many KV cache pruning methods have been proposed, they have not yet been adopted in major inference engines due to speed--accuracy trade-offs. We introduce KVzap, a fast, input-adaptive approximation of KVzip that works in both prefilling and decoding. On Qwen3-8B, Llama-3.1-8B-Instruct, and Qwen3-32B across long-context and reasoning tasks, KVzap achieves $2$--$4\times$ KV cache compression with negligible accuracy loss and achieves state-of-the-art performance on the KVpress leaderboard. Code and models are available at https://github.com/NVIDIA/kvpress.
