PatternKV: 通过扁平化KV表示扩展量化余量
PatternKV: Flattening KV Representation Expands Quantization Headroom
AI总结:
PatternKV通过扁平化KV表示提升低比特量化精度,实现2比特增益,提高测试时扩展精度10%并提升吞吐量1.5倍。
摘要:
在自回归大语言模型中,KV缓存消除了冗余的重新计算,但在推理过程中已成为主要的内存和带宽瓶颈,尤其是在长上下文和测试时扩展的情况下。KV量化是减少缓存成本的关键手段,但随着原生KV分布缺乏平坦性,因此保持了宽广的量化范围。先前的工作集中在隔离异常值,这虽然限制了其误差,但未能使整体分布平坦化,导致在低比特设置下性能脆弱。在本文中,我们表明K缓存保持稳定且随上下文演变的结构,而V缓存承载着潜在的语义规律性,两者共同促进了向量共享模式的组织。基于这些见解,我们提出了PatternKV,一种基于模式的残差量化方案。它在线挖掘代表性模式向量,将每个KV向量对齐到最近的模式,并仅对残差进行量化。这种对KV分布的重塑使量化目标更加平坦,并缩小了其范围,从而提高了低比特KV量化的保真度。在多个模型架构上,在长上下文和测试时扩展设置中,PatternKV实现了一致的2比特增益,相对于FP16,平均4比特下降为0.08%,在测试时扩展精度上平均提高10%,并提高了1.5倍的吞吐量,同时支持1.25倍更大的批次。
英文摘要:
KV cache in autoregressive LLMs eliminates redundant recomputation but has emerged as the dominant memory and bandwidth bottleneck during inference, notably with long contexts and test-time scaling. KV quantization is a key lever for reducing cache cost, but accuracy drops sharply as the native KV distribution lacks flatness and thus maintains a wide quantization range. Prior work focuses on isolating outliers, which caps their error but fails to flatten the overall distribution, leaving performance fragile under low-bit settings. In this work, we show that the K cache maintains a stable, context-evolving structure, while the V cache carries latent semantic regularities, with both contributing to the organization of vectors into shared patterns. Building on these insights, we propose PatternKV, a pattern-aligned residual quantization scheme. It mines representative pattern vectors online, aligns each KV vector to its nearest pattern, and quantizes only the residual. This reshaping of the KV distribution flattens the quantization target and narrows its range, thereby improving the fidelity of low-bit KV quantization. Across long-context and test-time scaling settings on multiple backbones, PatternKV delivers consistent 2-bit gains, with a 0.08% average 4-bit drop relative to FP16, improves test-time scaling accuracy by 10% on average, and raises throughput by 1.5x while supporting 1.25x larger batches.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。