BitDecoding-FP4:通过算法-系统协同设计的原生FP4 KV缓存解码

·

研究论文 · 2026/11/18

BitDecoding-FP4 是一种算法-系统协同设计,用于实现准确且高效的原生 FP4 KV 缓存解码。它通过双残差查询量化、下溢感知概率缩放和异常值感知键量化来减少量化误差,并在系统层面采用转置 softmax 与融合概率量化及堆叠查询 MMA 来消除 softmax 瓶颈。在密集和 MoE 模型(GQA 和 MLA)上,其精度与 BF16 KV 相差不超过 0.5 分(NVFP4)或 1 分(MXFP4),并在 NVIDIA B300 上实现 2.4-3.0 倍的峰值服务吞吐量提升。

该工作通过算法与系统协同设计,解决了 FP4 KV 缓存解码中精度与效率的权衡问题,在保持接近 BF16 精度的同时显著提升服务吞吐量,对长上下文 LLM 部署具有重要价值。

The key-value (KV) cache dominates memory capacity and bandwidth in long-context LLM serving. While 4-bit microscaling formats (NVFP4, MXFP4) shrink the cache and run attention on FP4 Tensor Cores, a fundamental gap remains between algorithmic quantization and system-aware acceleration: existing FP4 KV systems use vanilla quantization that causes severe accuracy drops, whereas accuracy-oriented 4-bit algorithms rely on vector codebooks whose lookup overhead degrades decoding throughput. We present BitDecoding-FP4, an algorithm--system co-design for accurate and efficient native FP4 KV decoding. We mitigate three error sources: Dual-Residual Query Quantization splits queries into two FP4 tensors, cutting query logit error from 60% to 1%; Underflow-Aware Probability Scaling prevents E4M3 scales from rounding long-context probabilities to zero; and Outlier-Aware Key Quantization combines static smoothing, Hadamard rotation, and scale search to suppress key outliers under token-wise scaling. At the system level, we remove the softmax bottleneck via transposed softmax with fused probability quantization and stacked query MMA on paged KV caches. Across dense and MoE models with GQA and MLA, BitDecoding-FP4 stays within 0.5 points of BF16 KV accuracy with NVFP4 (1 point with MXFP4), and tracks BF16 KV in RL training rollouts. In end-to-end serving on NVIDIA B300 with Qwen3-4B and Qwen3-30B-A3B, it delivers 2.4-3.0times higher peak serving throughput than BF16 KV. The implementation is available at https://github.com/OpenBitSys/BitDecoding-FP4.

阅读原文

参与讨论