论文

研究探索 KV 缓存 4-bit 量化的键敏感度来源与修复方法

Local Affine Quantization for KV Caches: From Shared Ranges to Prediction Error

精选理由

做本地部署、想给 KV 缓存压到 4-bit 甚至 2-bit 的人该看看这篇。它解释了为什么同一套量化方法在 Qwen2.5 上没问题、在别的模型上崩掉,还给出了减掉旋转位置偏置再恢复的具体修复手段,工程上可以直接抄。

一项覆盖八个模型的研究显示,KV 缓存的 4-bit 量化在部分模型上几乎无损,但在另一些模型上严重退化:value 端损失普遍较小,key 端敏感度差异巨大。研究定位到原因之一是消耗共享 key 量化范围的持久性通道偏移,这类偏移在精确 softmax 注意力中会抵消,但经过舍入后会变成随位置变化的误差,改变相对 logits。

正文

论文发现原生 key 中少见的舍入码变化贡献了大量时间误差能量;在两个有偏置的架构中,旋转位置编码的 key-projection 偏置几乎贡献了第一层全部 key 能量,量化前减去、量化后恢复即可修复严重的 4-bit 退化。StableLM 则需要追踪其位置轨迹而不只是移除固定均值。归因实验表明在 Qwen2.5 上,替换移位坐标的输出即可覆盖几乎全部 4-bit 恢复;到 2-bit 时邻近 block 输出开始起作用。

研究还建立了工程层面的结论:居中处理能修复保留 channel-grouped 布局的模型,而 token 分组在 2-bit key 上给出更低损失。这为需要低成本部署长上下文模型的团队提供了可操作的量化修复路径。

原文 · arXiv cs.LG

Local Affine Quantization for KV Caches: From Shared Ranges to Prediction Error

Local four-bit KV-cache quantization preserves language-model quality on some models and fails severely on others. Across eight models, we find small value penalties but widely varying key sensitivity. We investigate a source of this variation: persistent channel offsets that consume a shared key range. A fixed offset cancels in exact softmax attention, yet rounding can turn it into position-varying error that changes relative logits. Native-key measurements show that rare rounding-code changes account for substantial temporal-error energy. In two biased architectures, the rotated key-projection bias accounts for nearly all measured first-layer key energy. Subtracting it before quantization and restoring it afterward repairs severe four-bit degradation; StableLM also benefits from tracking its positional trajectory rather than removing only its fixed mean. To locate the prediction effects, we fit complete baseline and centred grids before substituting reconstructed outputs on shifted coordinates or their block neighbours. Shifted-coordinate outputs suffice for almost all four-bit recovery in Qwen2.5. At two bits, neighbouring outputs become consequential, with the attribution depending on the selected coordinates. Local reconstruction error and attention divergence can improve while prediction loss worsens. Whole-model comparisons establish a practical limit: centring repairs a retained channel-grouped layout, while token grouping gives lower loss at two-bit keys across the tested panel. The study connects shared ranges to prediction error and separates fixed-offset removal from reconstruction of a positional component.

产业坐标与信源核验

本条情报归属 AITOP「论文」核心追踪栏目。在跨区域产业观察坐标中,该动态直接关联「AI 开发者工具链、Coding Agent 与工程化实践」研究主线,反映出当前技术演进与商业落地的最新风向。涉及核心实体与技术议题包括:KV缓存量化、Qwen2.5、StableLM、量化,读者可通过下方标签进入对应专题页查阅历史脉络与关联对比。

信源核验说明:本文原始线索采编自「arXiv cs.LG」(@Shrey Shah, Rohith Kukkala),经 AITOP 多维评分管线结构化提炼。

发现摘要或翻译有误? 告诉我们