STEPQuant:在Delta规则循环状态量化中,错误何时何地重要

·

研究论文 · 2026/10/08

线性注意力用固定大小的循环状态替代不断增长的 KV 缓存,但在并发服务下这些持久状态可能成为显著的内存瓶颈。直接将循环状态量化到低精度往往导致严重的精度下降,因为量化误差会通过连续的状态更新传播。我们发现这些误差的影响取决于两个互补维度:在时间上,长寿命记忆中的误差会持续多个解码步骤;在空间上,不同键行的误差对模型输出的影响不同,而状态幅度在行和列上都有显著变化。基于这些观察,我们提出 STEPQuant,一种针对 Delta 规则循环状态的空间-时间训练后量化框架。STEPQuant 根据误差幅度和记忆寿命分配精度,并基于状态分布和键行对输出误差的影响联合拟合键行和值列缩放因子。在 Qwen3.8-27B 和 Kimi-Linear-48B-A3B-Instruct 上针对长生成和短生成基准的实验表明,STEPQuant 在标称 6 比特预算下接近 FP32 状态精度,并在其 4 比特配置下优于均匀 INT8。集成到 SGLang 并配合优化的 GPU 内核后,6 比特 STEPQuant 实现超过 5 倍的循环状态压缩,并将总服务内存降低最多 68.7%。我们的代码可在 https://github.com/Dreamer-Toby/STEPQuant 获取。

该工作针对线性注意力中循环状态的内存瓶颈,提出了细粒度的量化方法,在保持精度的同时显著压缩内存,对高效大模型服务有直接价值。

Linear attention replaces growing KV caches with fixed-size recurrent states, yet these persistent states can become a substantial memory bottleneck under concurrent serving. Directly quantizing recurrent states to low precision often leads to severe accuracy degradation, as quantization errors propagate through successive state updates. We discover that the impact of these errors depends on two complementary dimensions: temporally, errors in long-lived memory can persist across many decoding steps; spatially, errors in different key rows affect model outputs differently, while state magnitudes vary substantially along both rows and columns. Motivated by these observations, we propose STEPQuant, a spatial-temporal post-training quantization framework for Delta-rule recurrent states. STEPQuant allocates precision according to error magnitude and memory lifetime, and jointly fits key-row and value-column scales based on state distributions and key-row impact on output error. Experiments on Qwen3.8-27B and Kimi-Linear-48B-A3B-Instruct across both long- and short-generation benchmarks show that STEPQuant closely matches FP32-state accuracy under a nominal 6-bit budget and outperforms uniform INT8 in its 4-bit configuration. Integrated into SGLang with optimized GPU kernels, 6-bit STEPQuant achieves over 5x recurrent-state compression and reduces total serving memory by up to 68.7%. Our code is available at https://github.com/Dreamer-Toby/STEPQuant.

阅读原文

参与讨论