ResKV: Residual-based Channel-wise Unstructured Pruning for KV Cache Compression
Abstract
In modern LLM applications, the demand for extended context lengths continues to surge, making KV cache a major performance bottleneck in long-context inference. Channel-wise pruning has emerged as a prevalent KV cache compression paradigm; however, existing solutions overlook inherent similarities among KV vectors, resulting in limited pruning ratios and noticeable performance degradation. To tackle this issue, we present ResKV, a novel residual-driven channel-wise pruning framework that fully exploits KV vector similarity for effective compression. ResKV first clusters highly similar KV vectors via cosine similarity metrics, then calculates residual vectors by subtracting each cluster’s centroid from the original features. Subsequent channel-wise unstructured pruning and per-token quantization are exclusively applied to these residual components. During inference, preserved residuals are combined with their corresponding centroids to accurately recover dense KV representations. Benefiting from the low magnitude and sparse, near-zero properties of centroid residuals, both pruning and quantization incur only negligible approximation errors. Experimental results show that, at 75% sparsity, ResKV achieves 4.27× the inference throughput of the dense baseline while sustaining competitive model performance. Under the same sparsity setting, ResKV improves the average LongBench score by up to 2.26 points over state-of-the-art channel-wise KV pruning methods and achieves 2.63× the end-to-end throughput of a competing pruning baseline. Our code is publicly available at https://github.com/coralabo/ResKV.