Abstract
As Large Language Models (LLMs) scale toward million-token context windows, the memory footprint of the Key-Value (KV) cache becomes a critical bottleneck for inference. We introduce SKVQ (Sliding-window KV cache Quantization), a novel compression framework that enables 2-bit key and 1.5-bit value quantization with near-lossless accuracy. SKVQ leverages channel reordering to group similar distributions, clipped dynamic quantization to manage outliers, and a sliding window to preserve high-precision for critical recent tokens. Our evaluation demonstrates that SKVQ allows a 7B parameter model to handle 1 million tokens on a single 80GB GPU, providing up to a 7x decoding speedup in memory-bound scenarios.
Introduction: The KV Cache Memory Wall
Modern LLMs are increasingly moving toward "infinite" context windows to support complex tasks like long-document summarization and massive code repository analysis. However, during inference, these models must store the Keys and Values of all previous tokens in memory—the KV cache—to avoid redundant computation. This cache grows linearly with sequence length, quickly exceeding the size of the model weights themselves.
This growth leads to two primary challenges: Memory Exhaustion, where VRAM limits are reached even on high-end hardware, and the Memory-Bound Bottleneck, where the time spent moving data from memory to the processor dwarfs actual computation time. While quantization (reducing precision) is a standard solution, previous methods typically fail to maintain model logic and accuracy when pushing below 4 bits.
Methodology
SKVQ addresses the limitations of low-bit quantization through a three-pronged architectural approach designed to minimize quantization error while maximizing compression.
1. Channel Reordering
The researchers identified a "Relative Outlier" problem: different channels in the KV cache exhibit wildly different statistical distributions. When these channels are grouped together for quantization, a single outlier channel can force the entire group into a low-resolution scale, destroying precision for the majority of the data. SKVQ uses offline K-Means clustering to identify and group channels with similar properties, ensuring that quantization scales are optimized for each specific group.
2. Clipped Dynamic Quantization
Even with reordering, some extreme outliers persist. SKVQ applies a clipping scale ($\alpha$) to the quantization range. By strategically "sacrificing" the extreme values of a few outliers, the method provides significantly higher resolution for the bulk of the distribution. This optimal clipping threshold is determined through an offline calibration phase.
3. Sliding Window and Attention Sinks
Recognizing that not all tokens contribute equally to model performance, SKVQ employs a sliding window ($w$) that maintains the most recent 128 tokens in full precision (FP16). This leverages "attention locality," where recent context is most critical for next-token prediction. Additionally, the method protects "attention sinks"—the initial tokens of a prompt—which are vital for maintaining the numerical stability of the attention mechanism.
Experimental Results
SKVQ was evaluated using the LongBench suite (including GovReport and 2WikiMultihopQA), Needle-in-a-Haystack tests, and Wikitext-2 for perplexity measurements.
Extreme Compression and Accuracy
SKVQ achieves unprecedented compression levels, maintaining high accuracy with 2-bit keys and 1.5-bit values. The resilience of the Value cache to noise allows it to be pushed even further than the Key cache. As shown in the performance benchmarks, SKVQ consistently outperforms state-of-the-art methods like KIVI and KVQuant, particularly as the bitwidth drops below 2 bits.
Throughput and Context Scaling
By reducing the memory footprint, SKVQ enables a 7B parameter model to process a 1-million-token context on a single A100 80GB GPU—a feat impossible with standard FP16 or even 4-bit quantization. Furthermore, in memory-bound decoding phases, the reduction in VRAM traffic results in a theoretical 7x speedup, drastically improving the user experience for long-form generation.
Conclusion and Future Work
SKVQ represents a significant step toward making long-context LLM inference practical and efficient. By combining statistical grouping with locality-aware precision, it breaks the 4-bit barrier that has long limited KV cache compression. Future work will focus on developing highly optimized CUDA kernels to fully realize these theoretical speedups in production environments and exploring more sophisticated filtering rules for token-level precision allocation.
Summary updated