PatternKV: Flattening KV Representation Expands Quantization Headroom
Abstract
Lay Summary
Large language models can answer long questions and solve complex problems by remembering information from earlier words. This memory, called the key-value cache, helps avoid repeated computation, but it can become very large when the input is long or when the model reasons for many steps. A common way to save memory is to store this cache with fewer bits, but doing so can noticeably hurt accuracy because the stored numbers are uneven and difficult to compress. We propose PatternKV, a method that makes this memory easier to compress. Instead of compressing each cache vector directly, PatternKV first finds common patterns among cache vectors, matches each vector to a nearby pattern, and then compresses only the remaining difference. This makes the numbers being compressed smaller and more regular. As a result, PatternKV preserves model quality better under very low-bit compression, especially for long-context and long-reasoning tasks. This can help serve large language models with less memory and higher throughput.