Manuscript Offprint
arXiv:2611.09825BitDecoding-FP4: Native FP4 KV Cache Decoding via Algorithm-System Co-Design
ABSTRACT
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.0× higher peak serving throughput than BF16 KV. The implementation is available at https://github.com/OpenBitSys/BitDecoding-FP4.
1 INTRODUCTION
Modern large language models (LLMs) have rapidly expanded their context windows, with recent frontier models supporting up to 1M tokens (Gemini Team et al., 2024; Yang et al., 2025), enabling complex applications such as long-document comprehension, repository-level coding, and test-time reasoning scaling (Wei et al., 2022; Guo et al., 2025). However, serving these models at long contexts and large batch sizes is severely bottlenecked by the key-value (KV) cache (Kwon et al., 2023; Du et al., 2026). Unlike static model weights, the KV cache grows linearly with both sequence length and concurrency, quickly dominating GPU memory capacity and bandwidth as it is repeatedly loaded during decoding (Xia et al., 2026; Zhou et al., 2026).
Quantizing the KV cache to low precision effectively compresses its memory footprint and reduces data movement (Liu et al., 2024; Hooper et al., 2024). Recently, 4-bit microscaling formats such as MXFP4 and NVFP4 (Rouhani et al., 2023; NVIDIA, 2025c) have improved low-bit numerical fidelity while enabling native 4-bit matrix multiplications directly on Tensor Cores, delivering 2× or higher throughput than FP8 on modern NVIDIA Blackwell and Rubin GPUs (NVIDIA, 2025a) and eliminating the runtime de-
quantization overhead of low-bit KV caches. Recent works further show that these formats achieve high accuracy and efficiency for weight and activation quantization in training and inference (Cook et al., 2025; Egiazarian et al., 2026), as well as for prefill and non-causal attention (Zhang et al., 2025b; Yu et al., 2026; Zhang et al., 2026).
However, for autoregressive KV cache decoding, a fundamental gap remains between algorithmic quantization and system-aware acceleration, as shown in Figure 1 (right). On the one hand, existing efficient NVFP4 KV cache systems such as TRT-LLM-NVFP4 (NVIDIA, 2025d) directly apply vanilla NVFP4 to the KV cache, causing severe accuracy drops in long-context inference; meanwhile, DeepInfer (DeepSeek-AI, 2026b;a) relies on post-training without considering the underlying quantization error. On the other hand, accuracy-oriented KV quantization algorithms such as TurboQuant (Zandieh et al., 2026) rely on vector codebooks whose online lookup and reconstruction overhead is inefficient on GPUs, severely degrading decoding throughput.
To further push decoding performance, executing attention natively on FP4 Tensor Cores while preserving accuracy poses coupled algorithmic and system challenges. First, at the algorithm level, whereas dequantization-based kernels

Figure 1. Overview of BitDecoding-FP4 (left), achieving higher accuracy and serving throughput when running Qwen3-4B (right). See Table 1 for the average accuracy and Figure 10(b) for the per-GPU serving throughput on B300 at 128K context.
keep queries and softmax probabilities in 16 or 8 bits, native FP4 attention requires all four operands in narrow 4-bit microscaling blocks. During long-context decoding, query rounding noise is broadcast across thousands of tokens, small probabilities severely underflow under 8-bit E4M3 block scales, and token-wise Tensor Core block layouts clash with steep channel-wise outliers in . Second, at the system level, simply invoking FP4 Tensor Cores on paged KV caches (Kwon et al., 2023; Du et al., 2026; Sun et al., 2026) does not automatically yield decoding speedups: as matrix multiplication accelerates, the bottleneck shifts to CUDA-core softmax reductions, and accuracy-preserving quantization steps (e.g., per-tile FP32 rescaling or extra query GEMMs (Zhang et al., 2025b)) stall the decoding pipeline if not co-designed with the kernel.
In this paper, we present BitDecoding-FP4, which addresses both challenges through an algorithm–system co-design for native FP4 KV cache decoding, as illustrated in Figure 1 (left). At the algorithm level, we identify and mitigate the three primary error sources in native FP4 attention: (i) Dual-Residual Query Quantization represents the query as the sum of two FP4 tensors to suppress logit error from query quantization; (ii) Underflow-Aware Probability Scaling prevents E4M3 block scales from rounding small long-context softmax probabilities to zero via exponent rescaling and adaptive scale-maximum selection; and (iii) Outlier-Aware Key Quantization combines static key smoothing, Hadamard rotation, and block-scale search to tame key channel outliers under token-wise quantization. At the kernel level, we remove the softmax bottleneck with a transposed softmax that parallelizes reductions across keys and fuses probability quantization into warp-level butterfly shuffles, while stacked query MMA folds the residual query into a single narrow FP4 MMA and integrates seamlessly with paged KV caches (Kwon et al., 2023) via a device-side control kernel to reduce metadata overhead.
This paper makes the following contributions:
-
Accuracy-preserving FP4 KV quantization algorithm. We propose a microscaling FP4 KV quantization recipe that stays within 0.5 points of BF16 KV in average accuracy with NVFP4 (within 1 point with MXFP4) across challenging long-context and reasoning benchmarks, outperforming FP8 KV and prior 4-bit methods, and generalizes across dense and MoE models up to 770B with GQA and MLA attention. In RL post-training rollouts, it closely tracks BF16 KV accuracy, avoiding the degradation of standard NVFP4.
-
Fast native FP4 decoding kernels. Our native FP4 attention kernels keep the accuracy-recipe overhead within 4% and achieve up to and speedups over BF16 KV at 128K context on B300 and RTX PRO 5000, outperforming TRT-LLM-NVFP4, FlashInfer-XQA-NVFP4, and BitDecoding.
-
High end-to-end serving efficiency. In end-to-end serving, BitDecoding-FP4 shrinks KV cache memory by up to , cuts decoding latency by up to , and delivers higher peak throughput than BF16 KV at 64K–128K contexts, matching or exceeding TRT-LLM-NVFP4.
where is the maximum absolute value in and rounds each element to its nearest value in , mapping the block's largest magnitude to 6 (the maximum representable E2M1 value). Collecting across all blocks yields the quantized tensor . Dequantization multiplies the scales back, , where broadcasts each block scale across the elements of , and we write for the quantize-dequantize round trip. NVFP4 uses block size with an 8-bit E4M3 scale , whereas MXFP4 uses with a power-of-two E8M0 scale, so is rounded to a power of two. Both formats natively carry fine-grained scales over 16 or 32 elements to reduce rounding error, and their E2M1 grid, which is densest near zero, fits bell-shaped tensor distributions better than the evenly spaced INT4 grid.

(a) Qwen3-4B
(b) Qwen3-30B-A3B
Figure 2. Dequantization overhead of FlashInfer-XQA (Ye et al., 2025) kernel with NVFP4 KV Cache.
Accuracy drops in FP4 KV cache decoding. With adaptive scale selection and rotation, microscaling FP4 now quantizes weights and activations accurately (Cook et al., 2025; Egiazarian et al., 2026), but the KV cache remains a gap. TensorRT-LLM (NVIDIA, 2025d) and DeepSeek-V4.1-Flash (DeepSeek-AI, 2026b) store the KV cache in NVFP4 with the standard quantizer of Eq. 1. In our evaluation, TRT-LLM-NVFP4 loses 8.5 average points against BF16 KV on Qwen3-4B (Table 1). Native FP4 attention methods such as SageAttention3 (Zhang et al., 2025b) and Attn-QAT (Zhang et al., 2026) do not close this gap either: they target prefill and diffusion workloads, which quantize BF16 queries, keys, and values on the fly within each call, rather than decoding from a low-precision KV cache.
Pushing performance limits via native FP4 execution. Most low-bit KV cache kernels dequantize the cache to BF16 (Lin et al., 2025; Ye et al., 2025; Du et al., 2026) or FP8 (NVIDIA, 2025d) on CUDA cores before each attention matrix multiplication, leaving Tensor Cores underutilized: for an NVFP4 cache, dequantization takes 7–21% of FlashInfer-XQA's decode kernel time at 128K context (Figure 2). NVIDIA Blackwell GPUs (e.g., B300, RTX PRO 5000, and RTX 5090) remove this step with fifth-generation Tensor Cores that natively multiply block-scaled NVFP4 and MXFP4 operands (NVIDIA, 2025c) at 2–3× the throughput of FP8, consuming the E2M1 elements and block scales directly as FP4MM(, , , ). For attention execution, given a query and cached (with token rows ), decoding computes attention scores (logits) with per-token logit (), probabilities via online softmax (Milakov & Gimelshein, 2018; Dao et al., 2022), and output ; native FP4 attention (Zhang et al., 2025b) quantizes all four operands into microscaling FP4 to execute both products via FP4MM.
In this work, we build upon the Tensor Core-aware KV layout and mixed-precision buffer of BitDecoding (Du et al., 2026), and focus on an accurate microscaling FP4 KV quantization algorithm (Section 3) and native FP4 Tensor Core kernels tailored to Blackwell GPUs (Section 4).
Algorithm 1 Overview of the BitDecoding-FP4 algorithm.
Input: Query , , block size .
Require: Hadamard matrix , key mean , constants , and .
Output: Attention output .
▷ Outlier-Aware Key Quantization (§3.3)
1: Preprocessing: ;
2: , ;
3: , ;
▷ Dual-Residual Query Quantization (§3.1)
4: ;
5: Divide , and their scales into blocks , ;
6: for in do
7: ;
8: ;
9: ;
▷ Underflow-Aware Probability Scaling (§3.2)
10: ;
11: ;
12: ;
13: ;
14: , ;
15: ;
16: end for
17: return
3 FP4 KV QUANTIZATION ALGORITHM
In this section, we present the BitDecoding-FP4 decoding algorithm in Algorithm 1, where both attention matrix multiplications run natively on FP4 Tensor Cores and our algorithmic modifications over standard FlashAttention (Dao et al., 2022) are highlighted. In the following subsections, we analyze the quantization error of each operand under microscaling FP4 and detail our corresponding techniques.
3.1 Dual-Residual Query Quantization
Logit error from query quantization. Native FP4 Attention requires the quantization of both query and keys. Writing for a quantized tensor and for its error, the resulting logit error , up to the constant factor , decomposes into two terms:
The attention output is highly sensitive to the logit error, as the softmax turns a small logit perturbation into a shift of the attention distribution (Hooper et al., 2024; Li et al., 2025). While the large quantization error brought by key outliers has been widely reported (Liu et al., 2024; Zhou et al., 2026), we observe that query quantization also presents

(a) NVFP4 keys
(b) MXFP4 keys
Figure 3. Mean squared logit error for each query format, split into key and query terms. Dual-Residual Query Quantization reduces the query quantization error to 1% of the total.
a challenge to attention accuracy. Figure 3 confirms this by splitting the logit error into its key and query terms for different query formats, showing that quantizing the query is not a second-order effect. With NVFP4 keys, the NVFP4 query contributes 60% of the logit error, more than the keys themselves.
Dual-residual quantization. To reduce this accuracy loss, we propose Dual-Residual Query Quantization, which represents the query as the sum of two FP4 tensors. The first term is the ordinary quantized query; the second term quantizes what the first term left behind:
where and are two separate sets of block scales (Eq. 1), computed from the query q and from the residual , respectively. The query error in Eq. 2 shrinks from to the residual's own rounding error . Section 4.2 explains how the kernel computes the logits from the two terms.
Empirical results. We find that microscaling FP4 represents the residual query well: with NVFP4 keys, the dual-residual query shrinks the query term from 60% to only 1% of the logit error (Figure 3). It also outperforms smoothing Q (Zhang et al., 2025a;b), which still leaves 20% of the error to the query with a mean over the GQA heads and 42% with a mean over earlier tokens (Appendix D). With MXFP4 keys, the dual-residual query likewise leaves 1%, whereas an MXFP8 query, which current Tensor Cores natively accept against MXFP4 keys, still leaves 5%.
3.2 Underflow-Aware Probability Scaling
Scaling underflow for . We analyzed and observed that NVFP4 quantization of the softmax probabilities causes

(a) E4M3 scale ladder
(b) Quantization error
Figure 4. (a) E4M3 scaling underflow on probability blocks in long-context decoding over the empirical block distribution. (b) Relative block quantization error (RMSE) across .
a large accuracy loss due to scaling underflow, especially in long-context decoding. Since online softmax computes from each token's logit and the running maximum logit , almost every microscaling block along the sequence has a tiny maximum, . The scales of these blocks, , when below , fall off the bottom of the E4M3 scaling range. On long reasoning traces, we observe that nearly 90% of blocks have and get (Figure 4(a)), which means that those tokens are never considered because their blocks are always zero, especially hurting the retrieval nature of long contexts.
Underflow-aware scaling. To address this, we propose Underflow-Aware Probability Scaling, which lifts block scales away from the E4M3 floor with two techniques. First, following SageAttention3 (Zhang et al., 2025b), we rescale by a constant factor before quantization, so that small blocks receive representable E4M3 scales. Instead of re-multiplying every probability by an FP32 factor, we fold into the exponent of online softmax, , so the rescaling is free and cancels in the softmax normalization. Second, we scale some blocks to the scale maximum 2 instead of the largest E2M1 value 6. In this case, we can triple and further lift it away from the zero and subnormal floor of E4M3, while also making the error distribution more even (Cook et al., 2025). The scaling maximum selection follows:
The threshold is calibrated offline on a small dataset to switch to max/6 once its subnormal E4M3 rounding spikes fall below the max/2 error (Figure 4(b)); calibration details are in Appendix C. Each block is then quan-tized as . With both techniques, we maintain low relative quantization error across the subnormal range and push the underflow floor down to , lower than under the standard rule (Figure 4(a)). Section 4.1 explains how this rule is fused into online softmax.
3.3 Outlier-Aware Key Quantization
Channel outliers under token-wise key scaling. Key tensors exhibit persistent, large-magnitude outliers concentrated in a few fixed channels across tokens (Liu et al., 2024; Hooper et al., 2024). Grouping keys channel-wise along the sequence dimension can effectively isolate these outliers into their own scales. However, native FP4 Tensor Cores compute each logit as a dot product across the channels of a single token , and apply one shared scale to every 16-channel (NVFP4) or 32-channel (MXFP4) slice of that dot product. Consequently, each key must be quantized token-wise along the channel dimension rather than channel-wise across tokens. Under token-wise scaling, a single outlier channel dominates and inflates the block scale , crushing the remaining channels in the block and leading to severe quantization error.
Static key smoothing and Hadamard rotation. To suppress channel outliers under token-wise scaling, we first apply key smoothing, which removes the static channel bias without extra computation due to the shift-invariant nature of softmax (Zhang et al., 2025a). Unlike prefill attention kernels that compute the channel mean dynamically over each sequence, we calibrate a static per-head mean offline from eight prompts across the full context window and subtract it from each key before caching; calibration details are in Appendix B. Second, while smoothing removes the static channel bias, dynamic token-dependent spikes remain. We further apply a normalized Walsh–Hadamard rotation () to both the query and the smoothed key (Zhou et al., 2026):
which disperses residual channel spikes evenly across all coordinates while preserving the inner product .
Adaptive block-scale search. Finally, we select each block scale of the transformed key from a two-candidate set to minimize the block reconstruction error:
For NVFP4, we follow Four Over Six (Cook et al., 2025) and search over the E4M3 scales for scale maxima 6 and 4. For MXFP4, where scales are powers of two, we search between the standard OCP scale (Rouhani et al., 2023) and the next power of two (Appendix E).
4 SYSTEM DESIGN AND IMPLEMENTATION
Pairing an FP4 KV cache with native FP4 Tensor Cores substantially reduces the memory footprint and bandwidth traffic of decoding, but turning those savings into wall-clock speedup is non-trivial. In Section 4.1, we identify softmax and on-the-fly probability quantization as the primary execution bottleneck of native FP4 decoding, and propose a transposed softmax with fused quantization to remove it. In Section 4.2, we show how Dual-Residual Query Quantization stacks its second query term into the zero padding of the first, so both terms share one narrow FP4 MMA per key tile. Finally, in Section 4.3, we describe how BF16 attention-sink and recent tokens join the FP4 pages in the same decode launch, and how BitDecoding-FP4 integrates into vLLM for online serving.
4.1 Transposed Softmax with Fused P Quantization
Compute bottleneck from softmax. In FlashAttention-style kernels (Dao et al., 2022; Zadouri et al., 2026), the attention score (logit) tile of height is partitioned across softmax threads along the row dimension. For a tile of keys and the query heads that share a KV head, the conventional layout computes , so each thread is assigned to a query-head row (Figure 5(b)). During decoding, is usually much smaller than the MMA tile height , so most threads sit idle on padded rows, while the few active threads must scan across the keys of their rows in three serial passes: finding the row maximum, computing and the row sum, and scanning the row again to find each block's maximum and dynamically quantize to FP4. This per-thread serial work becomes the primary bottleneck of decode attention as the KV cache precision drops: fewer bytes per token raise the arithmetic intensity (Figure 5(a)), but the softmax, rather than the Tensor Cores, sets the ceiling, leaving the FP4 Tensor Cores largely idle.
Parallelizing softmax across keys. To eliminate the idle threads and break the per-row serial chain, we swap the two matrix-multiplication operands and compute the transposed score tile and column-wise probability tile across the keys:
By choosing the key tile , the keys fill all rows of the MMA tile regardless of the group size : every thread now holds the scores of valid keys in registers (Figure 5(c)). The softmax reductions over keys become parallel warp-level butterfly reductions (shfl.sync.bfly) rather than a -step loop per thread, followed by a single cross-warp reduction in shared memory. Each thread's serial work thus shrinks from steps to a few butterfly steps, with minimal communication overhead.

(a) Roofline of decode attention

(b) Conventional softmax

(c) Transposed softmax with fused P quantization
Figure 5. (a) Roofline of decode attention on B300 (TC: Tensor Core): the conventional softmax caps every KV precision. (b) Conventional softmax: threads are assigned to head rows, so most sit idle. (c) Ours: threads are assigned to keys, so all threads do useful work, reductions run in parallel via butterfly shuffles, and the FP4 block scales come for free from the butterfly.

Figure 6. Stacked Query MMA with In-Softmax Joining. (1) Before the KV loop, is stacked into the zero padding of the tile. (2) Each KV block issues one FP4 MMA for both terms. (3) The softmax joins the two halves of in FP32.
Fusing P quantization. The microscaling block scale comes directly out of the butterfly execution: each block of ( keys for NVFP4, for MXFP4) covers consecutive keys (Figure 5(c)), so the row-maximum reduction already yields each block's maximum logit as an intermediate result, and since is monotonic, requires no extra pass over . Furthermore, the Underflow-Aware Probability Scaling rule (Eq. 4) fuses in with little overhead: choosing is a single predicate on , and is folded into the argument (lines 10 and 13 of Algorithm 1). Each thread finally scales and rounds its own probability to E2M1 in registers, producing for the block-scaled FP4 MMA.
4.2 Stacked Query MMA with In-Softmax Joining
Cost of a second query term. Dual-Residual Query Quantization (Section 3.1) represents the query as two FP4 terms whose block scales differ widely, since is computed from the small residual . The two terms therefore cannot be merged into one FP4 operand: the kernel must
form two block-scaled products and add them in FP32,
The direct implementation issues two MMAs per key tile that accumulate into the same FP32 scores. In the transposed layout (Eq. 7), the query heads form the column dimension of each MMA; when is smaller than the MMA's minimum column width, the query operand is zero-padded, and the second MMA largely repeats work on this padding.
Stacking in MMA and joining in softmax. Microscaling MMAs attach block scales to the rows of each operand, so different rows of one operand can carry unrelated scales. We use this to place in the zero padding of (Figure 6). Once TMA lands both query tiles, one load warp copies the live rows of and their block scales into rows to of the tile and its scale tile, fences shared memory, and signals the MMA warp through an mbarrier; since the query is fixed across the KV loop, this runs once per tile. Each key tile then issues one FP4 MMA with 2G columns, which writes the two products of Eq. 8 into adjacent columns of . Their FP32 addition moves into the softmax: each softmax thread, which holds valid key scores (Section 4.1), loads 2G scores and adds column to column in registers. Because this sum is formed before masking and the row maximum, the online softmax operates on the full scores , so its running maximum, rescaling, and normalization are unchanged.
4.3 Mixed-Precision Online Serving Integration
Mixed-precision decoding. Following BitDecoding (Du et al., 2026), we keep the most recent tokens, which do not yet fill a 128-token page, in BF16 and process them in the same Tensor Core pipeline as the FP4 pages, while the first 16 tokens are kept as a permanent BF16 attention sink (Xiao et al., 2024). For long-context decoding, we split the FP4 pages of each request across CTAs as in Flash-Decoding (Dao et al., 2023). Rather than attaching the BF16

Figure 7. BitDecoding-FP4 in vLLM (: batch row, : BF16 slot). (1) The control kernel assigns each row a slot and splits its sequence. (2) The decode kernel reads the FP4 pages and the BF16 slot. (3) A full recent page is promoted into its FP4 block.
sink and recent tokens to one of these splits, making it the straggler, we merge them in an extra CTA alongside the FP4 splits to occupy otherwise idle SMs, and a log-sum-exp (LSE) weighted combine joins all partial outputs.
Metadata management for paged KV caches. Serving engines such as vLLM (Kwon et al., 2023) allocate the KV cache in fixed-size blocks on demand, and a per-request block table maps its pages to blocks. We store each FP4 page and its block scales in one cache block (Figure 7). The BF16 sink and recent tokens live outside the paged cache, in a buffer with one slot per running request. The engine is unaware of these slots and passes no request identity to the attention kernel, so a lightweight control kernel manages them on the device at every step. (1) The kernel identifies the request in each batch row by the cache block holding its first page, which stays fixed for the request's lifetime, and matches it against a slot table that records the owner and last-seen step of each slot. In Figure 7, row finds its slot , while the new request in row takes , the least recently seen slot that no row claims; stays with its request, which is not batched in this step. From the sequence lengths, the kernel then splits each row into its FP4 and recent tokens, 384 and 128 for , plus the 16 sink tokens, whose FP4 copy in the first page is masked. (2) The decode kernel reads the FP4 pages through the block table and the BF16 tokens through the slot of each row. (3) Once the recent tokens fill a page, as for , the page is quantized into the cache block already reserved for it, after the last layer has written the token that filled it. Since this metadata never leaves the device, decoding requires no host synchronization and remains compatible with CUDA graphs.
5 EVALUATIONS
Our evaluation highlights the following key results:
-
Accuracy: within 0.5 average points of BF16 KV with NVFP4 (within 1 point with MXFP4), ahead of FP8 KV and prior 4-bit methods (Section 5.2).
-
Efficiency: up to faster kernels and higher peak serving throughput than BF16 KV (Section 5.3).
-
Ablation: the contribution of each algorithm and system technique (Section 5.4).
5.1 Experiment Setup
Models and Benchmarks. We evaluate BitDecoding-FP4 on four models: Qwen3-4B-Thinking-2507, Qwen3-30B-A3B-Thinking-2507 (Yang et al., 2025), GLM-4.7-FP8 (GLM-4.5 Team, 2025), and Hy4-preview (Tencent Hy Team, 2026), covering dense and MoE models with GQA and MLA attention. We evaluate long-context tasks with LongBench Pro (Chen et al., 2026), MRCR (Vodrahalli et al., 2024; OpenAI, 2025), and RULER-NIAH (Hsieh et al., 2024), and long reasoning with AIME 2024/2025 (Mathematical Association of America, 2025), LiveCodeBench v6 (Jain et al., 2025), and GPQA-Diamond (Rein et al., 2024).
Hardware. Experiments run on NVIDIA B300 (SM103, 288GB) and RTX PRO 5000 (SM120, 72GB) GPUs. Accuracy and system-level evaluations use one B300 (TP=2 for 128K serving), and kernel benchmarks use both.
Implementation. We implement BitDecoding-FP4 in CuTe-DSL (NVIDIA, 2025b), built upon FlashAttention-4 (Zadouri et al., 2026), and integrate it into vLLM (Kwon et al., 2023) as a custom PagedAttention backend.
Baselines. We compare against two higher-precision references and three 4-bit KV cache methods. BF16 KV is the unquantized upper bound, and FP8 KV is vLLM's FP8 (E4M3) KV cache. For 4-bit, TRT-LLM-NVFP4 (NVIDIA, 2025d) is the native NVFP4 KV cache in vLLM, served by FlashInfer's TRT-LLM kernels; TurboQuant-4bit-nc (Zandieh et al., 2026) uses the official vLLM implementation, where for fairness we disable its mixed-precision setup and quantize all layers; and SAW-INT4 (Jia et al., 2026) runs on SGLang.
RL Training. To evaluate KV quantization during RL post-training, we follow DAPO (Yu et al., 2025) and run training with BF16 weights, using different KV cache methods for rollout generation and evaluating mean@4 accuracy on problems from DAPO, MATH-500, and AIME 2024.
Table 1. Accuracy (%) and end-to-end decoding latency of KV cache quantization methods; BitDecoding-NVFP4 stays within 0.5 average points of BF16 KV (BitDecoding-MXFP4 within 1 point) and outperforms FP8 and prior 4-bit methods in both average accuracy and decoding speed. LB-Pro denotes LongBench Pro, TPOT is the per-request time per output token (ms) at 256K context, and Speedup is relative to BF16 KV.
| Model | Method | Long context | Math | Code | Knowl. | Avg. | Latency @256K | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| LB-Pro | MRCR | RULER | AIME24 | AIME25 | LCB v6 | GPQA | TPOT | Speedup | |||
| Qwen3-4B-Thinking-2507 | BF16 KV | 53.27 | 38.82 | 96.28 | 83.44 | 81.15 | 53.86 | 66.98 | 67.69 | 7.74 | 1.00× |
| FP8 KV | 52.60 | 37.67 | 94.42 | 82.29 | 78.75 | 50.86 | 66.86 | 66.21 | 5.43 | 1.43× | |
| TurboQuant-4bit-nc | 49.78 | 32.91 | 93.15 | 77.40 | 72.29 | 47.43 | 64.96 | 62.56 | 94.46 | 0.08× | |
| SAW-INT4 | 49.92 | 31.57 | 91.19 | 79.69 | 75.63 | 52.86 | 64.02 | 63.55 | -* | - | |
| TRT-LLM-NVFP4 | 44.89 | 28.84 | 80.04 | 76.56 | 72.29 | 48.71 | 63.01 | 59.19 | 4.63 | 1.67× | |
| BitDecoding-MXFP4 | 52.96 | 35.61 | 94.46 | 81.56 | 80.42 | 55.14 | 66.73 | 66.70 | 4.34 | 1.78× | |
| BitDecoding-NVFP4 | 52.34 | 36.68 | 95.68 | 82.50 | 80.62 | 56.14 | 66.92 | 67.27 | 4.28 | 1.81× | |
| Qwen3-30B-A3B | BF16 KV | 60.83 | 43.41 | 98.39 | 90.62 | 83.54 | 64.00 | 71.28 | 73.15 | 6.66 | 1.00× |
| FP8 KV | 58.45 | 40.60 | 98.03 | 91.56 | 82.81 | 60.86 | 70.58 | 71.84 | 5.15 | 1.29× | |
| TurboQuant-4bit-nc | 59.56 | 42.22 | 98.02 | 88.65 | 83.85 | 56.57 | 70.64 | 71.36 | 126.55 | 0.05× | |
| SAW-INT4 | 57.27 | 36.31 | 97.58 | 88.85 | 83.75 | 57.71 | 70.39 | 70.27 | -* | - | |
| TRT-LLM-NVFP4 | 50.72 | 28.41 | 89.42 | 88.54 | 81.77 | 61.00 | 70.90 | 67.25 | 4.60 | 1.45× | |
| BitDecoding-MXFP4 | 58.53 | 42.71 | 98.33 | 91.04 | 84.58 | 62.29 | 70.71 | 72.60 | 4.59 | 1.45× | |
| BitDecoding-NVFP4 | 58.86 | 42.22 | 98.58 | 90.83 | 85.31 | 62.57 | 70.83 | 72.74 | 4.34 | 1.53× | |
*We omit the latency of SAW-INT4 because it runs on a different inference engine (SGLang) from all other methods (vLLM).
Table 2. Accuracy (%) and KV cache memory footprint on large FP8-weight models with GQA and sparse MLA attention; BitDecoding-NVFP4 stays within 0.4 average points of BF16 KV while shrinking the KV cache by up to 3.5×.
| Method | LB-Pro | MRCR | AIME25 | KV (GiB) |
|---|---|---|---|---|
| GLM-4.7 (355B, GQA), KV at 200K | ||||
| BF16 KV | 67.40 | 61.85 | 93.23 | 71.88 |
| FP8 KV | 65.87 | 61.27 | 92.40 | 35.94 |
| TRT-LLM-NVFP4 | 62.28 | 56.29 | 91.88 | 20.21 |
| BitDecoding-NVFP4 | 66.74 | 60.83 | 93.75 | 20.27 |
| Hy4-preview (770B, MLA), KV at 1M | ||||
| BF16 KV | 60.29 | 67.96 | 98.65 | 90.46 |
| FP8 KV | 59.71 | 67.83 | 98.96 | 52.68 |
| BitDecoding-NVFP4 | 60.32 | 67.84 | 98.75 | 34.41 |
5.2 Accuracy Results
Near-lossless accuracy across tasks. As shown in Table 1, BitDecoding-NVFP4 stays within 0.5 average points of BF16 KV on both Qwen3 models (67.27 vs. 67.69 and 72.74 vs. 73.15), and BitDecoding-MXFP4 stays within 1 point (66.70 and 72.60); notably, both 4-bit variants surpass FP8 KV in average accuracy despite using half the bits. In contrast, existing 4-bit methods degrade substantially: native TRT-LLM-NVFP4 loses up to 8.5 average points with sharp drops on long-context retrieval (RULER and MRCR), while SAW-INT4 and TurboQuant-4bit-nc also fall behind. On the 355B FP8-weight GLM-4.7 model (Table 2), BitDecoding-NVFP4 stays within 0.4 average points

(a) Qwen3-4B
(b) Qwen3-30B-A3B
Figure 8. DAPO-Math RL validation accuracy with quantized rollout KV caches; BitDecoding-NVFP4 closely tracks BF16 KV.
of BF16 KV and shrinks the 200K-token KV cache by 3.5× (71.88 to 20.27 GiB), whereas TRT-LLM-NVFP4 loses over 5 points on retrieval.
Generalization to MLA. BitDecoding-NVFP4 also generalizes to MLA (implementation details in Appendix G). On the 770B FP8-weight Hy4-preview model (Table 2), it stays within 0.12 points of BF16 KV across all three tasks while cutting the 1M-token KV cache from 90.46 to 34.41 GiB (2.6× smaller than BF16 KV and 1.5× smaller than FP8 KV). Latency speedup is omitted because Hy4-preview uses sparse MLA with a fixed 2,048-token active window per decoding step, where attention compute is minimal and low-bit KV quantization primarily alleviates the 1M-token memory capacity bottleneck.

(a) B300 (SM103)
(b) RTX PRO 5000 (SM120)
Figure 9. Decode attention kernel speedup over BF16 KV at 128K context across batch sizes (BitDecoding denotes the NVFP4 integration of (Du et al., 2026)); BitDecoding-NVFP4 consistently outperforms all baselines on both GPUs.

(a) 64K in / 2K out, TP=1
(b) 128K in / 2K out, TP=2
Figure 10. End-to-end serving throughput on Qwen3-4B and Qwen3-30B-A3B across 1, 8, 16, 32, and 64 concurrent requests (up and to the right is better). When concurrent requests exceed KV cache capacity, excess requests are queued or preempted. BitDecoding-NVFP4 achieves the best latency–throughput trade-off across both workloads.
Stable RL with FP4 KV rollouts. Recent models such as DeepSeek-V4.1-Flash (DeepSeek-AI, 2026b) adopt vanilla NVFP4 KV caches during post-training without addressing FP4 error sources, even retaining FP8 for local sliding-window attention. As Figure 8 shows, standard TRT-LLM-NVFP4 severely degrades RL training on long reasoning traces, whereas BitDecoding-NVFP4 closely tracks BF16 KV throughout training on both models.
5.3 Efficiency Results
Faster decoding kernels. Figure 9 compares decode kernel speedups over BF16 KV at 128K context across batch sizes 1 to 64. On B300 (SM103), BitDecoding-NVFP4 achieves up to speedup on Qwen3-4B and on Qwen3-30B-A3B, outperforming TRT-LLM-NVFP4 across all batch sizes despite running our full accuracy recipe. On RTX PRO 5000 (SM120), it reaches up to and speedups, surpassing FlashInfer-XQA-NVFP4 and dequantization-based BitDecoding (Du et al., 2026) by running both GEMMs natively on FP4 Tensor Cores.
End-to-end serving gains. At 256K context (Table 1), BitDecoding-NVFP4 cuts per-request decoding latency (TPOT) by on Qwen3-4B and on Qwen3-30B-A3B over BF16 KV, outperforming FP8 KV and TRT-LLM-NVFP4, whereas TurboQuant-4bit-nc is over slower due to vector-quantization overhead. Across 1 to 64 concurrent requests at 64K (TP=1) and 128K (TP=2) contexts (Figure 10), BF16 and FP8 KV quickly exhaust KV capacity and suffer from preemption, whereas BitDecoding-NVFP4 fits all 64 requests in memory and delivers higher peak per-GPU throughput than BF16 KV, matching or exceeding TRT-LLM-NVFP4.
5.4 Ablation Study
Improvement breakdown for accuracy. Figure 11 ablates our techniques (Section 3) on Qwen3-4B. Dual-Residual Query Quantization and Outlier-Aware Key Quantization drive MXFP4 gains. For NVFP4, Dual-Residual Query Quantization recovers most of the gap, Underflow-Aware Probability Scaling restores RULER retrieval by preventing E4M3 underflow, and Outlier-Aware Key Quantization closes the rest (component ablations in Appendix F).

Figure 11. Accuracy ablation on Qwen3-4B (MXFP4 omits P scaling since E8M0 scales do not underflow).

Figure 12. Decode kernel latency ablation at batch 64 and 128K context on B300.

Figure 13. Quantization and metadata overhead of VLLM on Qwen3-4B. Both Kitty and BitDecoding-NVFP4 manage BF16 sink tokens.
Improvement breakdown for kernel speedup. Figure 12 breaks down decode kernel latency at batch 64 and 128K context. With conventional row softmax, softmax and quantization bottleneck execution ( slower than TRT-LLM-NVFP4 on Qwen3-30B-A3B). Transposed softmax (Section 4.1) nearly halves pure kernel latency (), exposing the 10.3% overhead of a separate residual-query MMA, and Stacked Query MMA (Section 4.2) folds both query terms into one narrow MMA, keeping recipe overhead within 4% and outperforming TRT-LLM-NVFP4.
Overhead of metadata management. At batch 1 and 4K context on Qwen3-4B (Figure 13), Kitty adds 1.5 ms per decode step for BF16 sink tokens, whereas our control kernel (Section 4.3) keeps decode overhead to 95 s ( below Kitty and below TRT-LLM-NVFP4 and SAW-INT4), with prefill overhead (1.46 ms) matching SAW-INT4 and below TRT-LLM-NVFP4.
6 RELATED WORKS
Microscaling FP4 for LLMs Microscaling FP4 formats (Rouhani et al., 2023; NVIDIA, 2025c) have been widely adopted for LLMs in post-training quantization (Cook et al., 2025; Egiazarian et al., 2026), quantization-aware training (Xin et al., 2026), and FP4 training (Castro et al., 2025; Panferov et al., 2026; NVIDIA et al., 2025), though these works quantize only linear layers. For FP4 attention, Attn-QAT (Zhang et al., 2026) relies on quantization-aware training, and MXAttention (Yu et al., 2026) quantizes unnormalized exponentials to preserve softmax normalization under MXFP4. The most closely related post-training work, SageAttention3 (Zhang et al., 2025b), runs both attention matrix multiplications on FP4 Tensor Cores via query/key smoothing (Zhang et al., 2025c;a) and two-level scaling (see algorithmic comparison in Appendix D). However, these methods target prefill, non-causal, or training workloads (e.g., diffusion models) rather than LLM decoding.
Low-bit KV Caches for Decoding Recent algorithmic efforts explore 4-bit, 2-bit, and even 1-bit KV cache quantization (Liu et al., 2024; Hooper et al., 2024; Xia et al., 2026; Zandieh et al., 2025): for instance, SpinQuant (Liu et al., 2025) learns rotation matrices to suppress outliers, OSCaR (Su et al., 2026) combines canalized rotation with omni-token scaling to address token norm imbalance, and TurboQuant (Zandieh et al., 2026) pairs random rotation with near-optimal vector quantizers. However, pushing to such extreme bit-widths still incurs non-negligible accuracy degradation on challenging long-context and reasoning tasks. On the systems side, frameworks such as QServe (Lin et al., 2025), SAW-INT4 (Jia et al., 2026), Kitty (Xia et al., 2026), and BitDecoding (Du et al., 2026) accelerate low-bit KV cache decoding. While the original BitDecoding focuses on dequantization optimization, we co-design an accurate microscaling FP4 quantization algorithm with native FP4 Tensor Core kernels that avoid dequantization.
7 CONCLUSION
We presented BitDecoding-FP4, an algorithm–system co-design that bridges the gap between accuracy-preserving quantization and hardware-native acceleration for microscaling FP4 KV cache decoding. By mitigating the quantization errors of queries, attention probabilities, and keys while eliminating softmax and quantization bottlenecks on FP4 Tensor Cores with paged KV caches, BitDecoding-FP4 stays within 0.5 average points of BF16 KV with NVFP4 (1 point with MXFP4) across models up to 770B, closely tracks BF16 KV in RL rollouts, and achieves up to kernel speedup and higher peak serving throughput.
ACKNOWLEDGEMENTS
We sincerely thank the University of Edinburgh for providing funding to rent the NVIDIA B300 GPU resources on Vast.ai that supported this research.
REFERENCES
Castro, R. L., Panferov, A., Tabesh, S., Sieberling, O., Chen, J., Nikdan, M., Ashkboos, S., and Alistarh, D. Quartet: Native FP4 training can be optimal for large language models. In Advances in Neural Information Processing Systems (NeurIPS), 2025.
Chen, Z., Wu, X., Jia, J., Gao, C., Fu, Q., Zhang, D., and Hu, S. Longbench pro: A more realistic and comprehensive bilingual long-context evaluation benchmark. arXiv preprint arXiv:2601.02872, 2026.
Cook, J., Guo, J., Xiao, G., Lin, Y., Wyss, K., Nazemi, M., Mishra, A., del Mundo, C., Blankevoort, T., and Han, S. Four over six: More accurate NVFP4 quantization with adaptive block scaling, 2025.
Dao, T., Fu, D. Y., Ermon, S., Rudra, A., and Ré, C. FlashAttention: Fast and memory-efficient exact attention with IO-awareness. In Advances in Neural Information Processing Systems (NeurIPS), 2022.
Dao, T., Haziza, D., Massa, F., and Sizov, G. Flash-decoding for long-context inference. PyTorch Blog, https://pytorch.org/blog/flash-decoding/, 2023.
DeepSeek-AI. DeepInfer: High-performance, large-scale inference framework for DeepSeek models. https://github.com/deepseek-ai/DeepInfer, 2026a.
DeepSeek-AI. DeepSeek-V4.1-Flash: Pushing the limits of KV cache compression. arXiv preprint arXiv:2609.19969, 2026b.
Du, D., Cao, S., Cheng, J., Mai, L., Cao, T., and Yang, M. Bitdecoding: Unlocking tensor cores for long-context llms with low-bit kv cache. In 2026 IEEE International Symposium on High Performance Computer Architecture (HPCA), pp. 1–13. IEEE, 2026.
Egiazarian, V., Castro, R. L., Kuznedelev, D., Panferov, A., Kurtic, E., Pandit, S., Marques, A. N., Kurtz, M., Ashkboos, S., Hoefler, T., and Alistarh, D. Bridging the gap between promise and performance for microscaling FP4 quantization. In International Conference on Learning Representations (ICLR), 2026.
Gemini Team, Georgiev, P., Lei, V. I., Burnell, R., Bai, L., Gulati, A., Tanzer, G., Vincent, D., Pan, Z., Wang, S., et al. Gemini 1.5: Unlocking multimodal understanding across millions of tokens of context. arXiv preprint arXiv:2403.05530, 2024.
GLM-4.5 Team. GLM-4.5: Agentic, reasoning, and coding (ARC) foundation models. arXiv preprint arXiv:2508.06471, 2025.
Guo, D., Yang, D., Zhang, H., Song, J., Zhang, R., Xu, R., Zhu, Q., Ma, S., Wang, P., Bi, X., et al. DeepSeek-R1: Incentivizing reasoning capability in LLMs via reinforcement learning. arXiv preprint arXiv:2501.12948, 2025.
Hooper, C., Kim, S., Mohammadzadeh, H., Mahoney, M. W., Shao, Y. S., Keutzer, K., and Gholami, A. KVQuant: Towards 10 million context length LLM inference with KV cache quantization. In Advances in Neural Information Processing Systems (NeurIPS), 2024.
Hsieh, C.-P., Sun, S., Kriman, S., Acharya, S., Rekesh, D., Jia, F., Zhang, Y., and Ginsburg, B. RULER: What's the real context size of your long-context language models? In Conference on Language Modeling (COLM), 2024.
Jain, N., Han, K., Gu, A., Li, W.-D., Yan, F., Zhang, T., Wang, S., Solar-Lezama, A., Sen, K., and Stoica, I. Live-CodeBench: Holistic and contamination free evaluation of large language models for code. In International Conference on Learning Representations (ICLR), 2025.
Jia, J., Li, J., Zhou, Z., Heo, J. H., Wang, J., Dao, T., Song, S. L., Athiwaratkun, B., Xu, C., Zhang, T., and Wu, X. SAW-INT4: System-aware 4-bit KV-cache quantization for real-world LLM serving. arXiv preprint arXiv:2604.19157, 2026.
Kwon, W., Li, Z., Zhuang, S., Sheng, Y., Zheng, L., Yu, C. H., Gonzalez, J., Zhang, H., and Stoica, I. Efficient memory management for large language model serving with pagedattention. In Proceedings of the 29th Symposium on Operating Systems Principles, SOSP 2023, Koblenz, Germany, October 23-26, 2023, pp. 611–626, 2023.
Li, X., Xing, Z., Li, Y., Qu, L., Zhen, H.-L., Liu, W., Yao, Y., Pan, S. J., and Yuan, M. KVTuner: Sensitivity-aware layer-wise mixed-precision KV cache quantization for efficient and nearly lossless LLM inference. In International Conference on Machine Learning (ICML), 2025.
Lin, Y., Tang, H., Yang, S., Zhang, Z., Xiao, G., Gan, C., and Han, S. Qserve: W4a8kv4 quantization and system co-design for efficient llm serving. Proceedings of Machine Learning and Systems, 7, 2025.
Liu, Z., Yuan, J., Jin, H., Zhong, S., Xu, Z., Braverman, V., Chen, B., and Hu, X. KIVI: A tuning-free asymmetric 2bit quantization for KV cache. In International Conference on Machine Learning (ICML), pp. 32332–32344, 2024.
Liu, Z., Zhao, C., Fedorov, I., Soran, B., Choudhary, D., Krishnamoorthi, R., Chandra, V., Tian, Y., and Blankevoort, T. Spinquant: Llm quantization with learned rotations. In International Conference on Learning Representations, volume 2025, pp. 92009–92032, 2025.
Mathematical Association of America. American invitational mathematics examination (AIME). https://maa.org/maa-invitational-competitions/, 2025.
Milakov, M. and Gimelshein, N. Online normalizer calculation for softmax. arXiv preprint arXiv:1805.02867, 2018.
NVIDIA. Inside NVIDIA Blackwell Ultra: The chip powering the AI factory era. https://developer.nvidia.com/blog/inside-nvidia-blackwell-ultra-the-chip-powering-the-ai-factory-era/, 2025a.
NVIDIA. NVIDIA CUTLASS documentation: CuTe DSL. https://docs.nvidia.com/cutlass/latest/media/docs/pythonDSL/cute_dsl_general/dsl_introduction.html, 2025b.
NVIDIA. Parallel thread execution ISA: Tensor-Core 5th generation family instructions. https://docs.nvidia.com/cuda/parallel-thread-execution/, 2025c.
NVIDIA. TensorRT-LLM. https://github.com/NVIDIA/TensorRT-LLM, 2025d.
NVIDIA, Abecassis, F., Agrusa, A., Ahn, D., Alben, J., Alborghetti, S., Andersch, M., Arayandi, S., Bjorlin, A., Blakeman, A., et al. Pretraining large language models with NVFP4. arXiv preprint arXiv:2509.25149, 2025.
OpenAI. OpenAI-MRCR: Long context multiple needle in a haystack benchmark. https://huggingface.co/datasets/openai/mrcr, 2025.
Panferov, A., Schultheis, E., Tabesh, S., and Alistarh, D. Quartet II: Accurate LLM pre-training in NVFP4 by improved unbiased gradient estimation. In International Conference on Machine Learning (ICML), 2026.
Rein, D., Hou, B. L., Stickland, A. C., Petty, J., Pang, R. Y., Dirani, J., Michael, J., and Bowman, S. R. GPQA: A graduate-level Google-proof Q&A benchmark. In Conference on Language Modeling (COLM), 2024.
Rouhani, B. D., Zhao, R., More, A., Hall, M., Khodamoradi, A., Deng, S., Choudhary, D., Cornea, M., Dellinger, E., Denolf, K., et al. Microscaling data formats for deep learning. arXiv preprint arXiv:2310.10537, 2023.
Su, Z., Yang, R., Zhang, C., Liu, Y., Zhang, Y., Wu, W., Xiong, J., Du, D., Zhuang, X., Qian, Y., Tan, J., Xie, Y., Wu, Y.-C., Yang, H., and Wong, N. OScar: The Occam's razor for extreme KV cache quantization in LLMs and beyond. arXiv preprint arXiv:2605.19660, 2026.
Sun, C., Xia, Y., Wang, H., Yang, D., Zhou, X., and Cheng, D. JanusQuant: Accurate and efficient 2-bit KV cache quantization for long-context inference. In Proceedings of the 31st ACM SIGPLAN Annual Symposium on Principles and Practice of Parallel Programming (PPoPP), pp. 301–314, 2026.
Tencent Hy Team. Hy4-preview. https://huggingface.co/tencent/Hy4-preview, 2026.
Vodrahalli, K., Ontanon, S., Tripuraneni, N., Xu, K., Jain, S., Shivanna, R., Hui, J., Dikkala, N., Kazemi, M., Fatemi, B., Anil, R., Dyer, E., Shakeri, S., Vij, R., Mehta, H., Ramasesh, V. V., Le, Q., Chi, E. H., Lu, Y., Firat, O., Lazaridou, A., Lespiau, J., Attaluri, N., and Olszewska, K. Michelangelo: Long context evaluations beyond haystacks via latent structure queries. arXiv preprint arXiv:2409.12640, 2024.
Wei, J., Wang, X., Schuurmans, D., Bosma, M., Ichter, B., Xia, F., Chi, E., Le, Q. V., and Zhou, D. Chain-of-thought prompting elicits reasoning in large language models. In Advances in Neural Information Processing Systems (NeurIPS), 2022.
Xia, H., Wu, X., Li, J., Wu, R., Wang, J., Wang, J., Li, C., Singhal, A., Shah, A. D., Ariyak, A., Zhuang, D., Zhou, Z., Athiwaratkun, B., Zheng, Z., and Song, S. L. Kitty: Accurate and efficient 2-bit KV cache quantization with dynamic channel-wise precision boost. In Proceedings of Machine Learning and Systems (MLSys), 2026.
Xiao, G., Tian, Y., Chen, B., Han, S., and Lewis, M. Efficient streaming language models with attention sinks. In International Conference on Learning Representations, volume 2024, pp. 21875–21895, 2024.
Xin, M., Priyadarshi, S., Xin, J., Kartal, B., Vavre, A., Thekkumpate, A. K., Chen, Z., Mahabaleshwarkar, A. S., Shahaf, I., Bercovich, A., Patel, K., Velury, S. V., Luo, C., Cheng, Z., Chen, J., Yu, C., Ping, W., Rybakov, O., Tajbakhsh, N., Olabiyi, O., Stosic, D., Wu, D., Han, S., Chung, E., Sreenivas, S. T., Catanzaro, B., Suhara, Y., Blankevoort, T., and Mao, H. Quantization-aware distillation for NVFP4 inference accuracy recovery. arXiv preprint arXiv:2601.20088, 2026.
Yang, A., Li, A., Yang, B., Zhang, B., Hui, B., Zheng, B., Yu, B., Gao, C., Huang, C., Lv, C., et al. Qwen3 technical report. arXiv preprint arXiv:2505.09388, 2025.
Ye, Z., Chen, L., Lai, R., Lin, W., Zhang, Y., Wang, S., Chen, T., Kasikci, B., Grover, V., Krishnamurthy, A., and Ceze, L. Flashinfer: Efficient and customizable attention engine for llm inference serving. Proceedings of Machine Learning and Systems, 7, 2025.
Yu, J., Lin, J., Kong, L., Chen, A., Sun, W., Zeng, C., Lan, W., Li, J., Zheng, Z., Yue, Z., Ke, D., Yi, F., Hu, T., Ding, Y., Yao, Y., and Wang, J. MXAttention: Data-free optimal scaling and pre-normalization quantization for MXFP4 attention. arXiv preprint arXiv:2607.24377, 2026.
Yu, Q., Zhang, Z., Zhu, R., Yuan, Y., Zuo, X., Yue, Y., Dai, W., Fan, T., Liu, G., Liu, J., Liu, L., Liu, X., Lin, H., Lin, Z., Ma, B., Sheng, G., Tong, Y., Zhang, C., Zhang, M., Zhang, R., Zhang, W., Zhu, H., Zhu, J., Chen, J., Chen, J., Wang, C., Yu, H., Song, Y., Wei, X., Zhou, H., Liu, J., Ma, W., Zhang, Y., Yan, L., Wu, Y., and Wang, M. DAPO: An open-source LLM reinforcement learning system at scale. arXiv preprint arXiv:2503.14476, 2025.
Zadouri, T., Hoehnerbach, M., Shah, J., Thakkar, V., and Dao, T. FlashAttention-4: Algorithm and kernel pipelining co-design for asymmetric hardware scaling. In Proceedings of Machine Learning and Systems (MLSys), 2026.
Zandieh, A., Daliri, M., and Han, I. QJL: 1-bit quantized JL transform for KV cache quantization with zero overhead. In Proceedings of the AAAI Conference on Artificial Intelligence, 2025.
Zandieh, A., Daliri, M., Hadian, M., and Mirrokni, V. TurboQuant: Online vector quantization with near-optimal distortion rate. In International Conference on Learning Representations (ICLR), 2026. arXiv:2504.19874.
Zhang, J., Huang, H., Zhang, P., Wei, J., Zhu, J., and Chen, J. SageAttention2: Efficient attention with thorough outlier smoothing and per-thread INT4 quantization. In International Conference on Machine Learning (ICML), 2025a.
Zhang, J., Wei, J., Wang, H., Zhang, P., Xu, X., Huang, H., Jiang, K., Chen, J., and Zhu, J. SageAttention3: Microscaling FP4 attention for inference and an exploration of 8-bit training. In Advances in Neural Information Processing Systems (NeurIPS), 2025b.
Zhang, J., Wei, J., Zhang, P., Zhu, J., and Chen, J. Sageattention: Accurate 8-bit attention for plug-and-play inference acceleration. In International Conference on Learning Representations, volume 2025, pp. 71566–71585, 2025c.
Zhang, P., Noto, M., Tan, W., Jiang, C., Lin, W., Zhou, W., and Zhang, H. Attn-qat: 4-bit attention with quantization-aware training. In International Conference on Machine Learning (ICML), 2026.
Zhou, Z., Zhuang, D., Li, J., Chen, Z., Song, S. L., Athiwaratkun, B., and Wu, X. OSCAR: Offline spectral covariance-aware rotation for 2-bit KV cache quantization. arXiv preprint arXiv:2605.17757, 2026.
A TEACHER-FORCED KL AS A FAST ACCURACY PROXY
End-to-end benchmarks are slow to run and too noisy to separate configurations that are close to BF16 KV. Once a quantized model samples a different token, its continuation departs from BF16 KV's, so most of the per-sample score difference comes from sampling rather than from quantization. During development, we therefore measure each design choice by how much it changes the model's next-token distribution along a fixed trajectory shared by all configurations.
Measurement. The measurement takes two passes. First, BF16 KV generates a reference trajectory for each prompt with the evaluation sampler, and records its next-token distribution at every step. Second, each FP4 configuration decodes the same prompts but is teacher-forced along : at step it computes its own distribution from its quantized KV cache, and then emits instead of sampling. A vLLM logits processor forces the token, so the configuration runs its unmodified serving path, including cache writes and the FP4 decode kernel. The per-token divergence is
where holds BF16 KV's 128 most likely tokens at step , which carry 99.996% of its probability mass on average. We average over the steps of each trajectory and then over trajectories. Because all configurations see exactly the same prefixes, two of them can be compared trajectory by trajectory: we report the paired statistic of their per-trajectory differences, which cancels the large spread in difficulty across prompts.
Relation to end-to-end accuracy. Table 3 places the KL of four configurations next to their MRCR accuracy. KL, top-1 mismatch and accuracy rank the four configurations in the same order, and large reductions in KL translate into large accuracy gains: BitDecoding-NVFP4 cuts the KL of TRT-LLM-NVFP4 by and recovers 7.8 of its 10.0-point MRCR gap to BF16 KV.
B KL ABLATION OF KEY SMOOTHING CALIBRATION
Key smoothing subtracts a static per-head key mean before caching (Section 3.3). We calibrate once per checkpoint and context window from only eight short prompts.
Calibration with eight prompts within one minute. The eight seed prompts are one-sentence requests on everyday
Table 3. Teacher-forced KL tracks end-to-end accuracy on Qwen3-4B: the lower a configuration's KL and top-1 mismatch on the MRCR trajectories, the higher its MRCR accuracy. KL is in units of nats; top-1 mismatch is the fraction of steps where the FP4 argmax token differs from BF16 KV's, and the BF16 KV row reruns BF16 KV against its own reference.
| Configuration | KL ↓ | Top-1 mis. (%) ↓ | MRCR ↑ |
|---|---|---|---|
| BF16 KV | 0.29 | 0.32 | 38.82 |
| BitDecoding-NVFP4 | 3.83 | 1.00 | 36.68 |
| BitDecoding-MXFP4 | 10.27 | 1.56 | 35.61 |
| TRT-LLM-NVFP4 | 39.62 | 3.59 | 28.84 |
Table 4. Key smoothing calibration on Qwen3-4B. Time is the seconds on one B300 GPU to produce the calibration text and measure with the serving engine. MRCR and AIME24 are the teacher-forced KL from BF16 KV (, Appendix A), with the change relative to our calibration in parentheses.
| Calibration | Tokens | Time | MRCR | AIME24 |
|---|---|---|---|---|
| No smoothing | – | – | 11.79 (+215%) | 8.11 (+76%) |
| 8 seeds (ours) | 133K | 13 | 3.74 | 4.62 |
| 8 other seeds | 131K | 12 | 3.73 (–0.3%) | 4.70 (+1.7%) |
| 10 retrieval | 1.3M | 43 | 4.52 (+21%) | 5.27 (+14%) |
| 40 mixed | 5.2M | 173 | 4.35 (+16%) | 4.88 (+5.5%) |
topics, such as explaining hash tables or photosynthesis, or writing a short story. The served model greedily continues each prompt for 256 tokens, so calibration generates only 2K tokens in total. We join the eight prompts and continuations, tile them into one prompt that fills the whole context window (131,071 tokens for a 128K window), prefill it once, and accumulate the post-RoPE keys of every layer and KV head; their mean is . The text is the model's own output, so it matches what the model generates when serving, and tiling lets a single prefill cover every position of the window, which matters because RoPE makes the key mean depend on position. Generating only 2K tokens and running one prefill keep calibration fast: it takes 13 seconds on one B300.
Comparison with other calibration sets. Table 4 compares our with means calibrated on other text, measured with the teacher-forced KL of Appendix A while the rest of the recipe stays fixed. More calibration text does not help: ten retrieval prompts (1.3M tokens) and forty prompts mixing synthetic retrieval, code, math and generated text (5.2M tokens) raise KL by 14–21% and 5.5–16%. Eight different seed prompts give the same KL on MRCR and 1.7% higher on AIME.
Table 5. Threshold code selected by each calibration source on Qwen3-4B-Thinking-2507; code 10 is the production . The last four columns give the percentage of 1,000 random subsets of samples that select code 10.
| Calibration source | Code | Subsets at code 10 (%) | |||
|---|---|---|---|---|---|
| 8 | 16 | 32 | |||
| UUID key retrieval | 10 | 100 | 100 | 100 | 100 |
| Marker retrieval | 10 | 100 | 100 | 100 | 100 |
| Code and math filler | 10 | 100 | 100 | 100 | 100 |
| Key smoothing (ours) | 10 | 100 | 100 | 100 | 100 |
| Reasoning traces | 10 | 97.9 | 84.8 | 70.2 | 100 |
| All five sources | 10 | 99.7 | 97.1 | 97.5 | 100 |
C PROBABILITY SCALE THRESHOLD CALIBRATION
We calibrate offline: replaying online softmax on the BF16 logits of decode queries, we select the threshold that minimizes the total squared quantization error of over all probability blocks. Candidates lie on the E4M3 grid of , and the production is code 10, between the E4M3 values 20/1024 (code 10) and 22/1024 (code 11).
The threshold is consistent across calibration data. On Qwen3-4B-Thinking-2507, we build five calibration sources of 50 samples each, with contexts of 8K to 128K tokens: three synthetic long-context families, the key smoothing text of Appendix B, and the model's own reasoning traces. Every source selects code 10, and so does their union (Table 5). Random subsets select code 10 down to a single sample on every source except the reasoning traces, which need 32 traces for every subset to select code 10.
One-time calibration with key smoothing. We therefore select on the key smoothing text, in the same one-time calibration as (Appendix B): prefill keys of the text give , and decode queries that continue it give . The two do not interact, since subtracting shifts all logits of a query by the same and leaves unchanged. This text selects code 10 on Qwen3-4B-Thinking-2507, and also on Qwen3-8B and Qwen3-30B-A3B-Thinking-2507 up to 32K tokens.
D COMPARISON WITH SAGEATTENTION3
In this section, we compare smoothing Q (Zhang et al., 2025a) and two-level scaling of from SageAttention3 (Zhang et al., 2025b) against our Dual-Residual Query Quantization and Underflow-Aware Probability Scaling.
Comparison with smoothing Q. Smoothing Q subtracts a mean from the query, quantizes the smaller remainder,
Table 6. Mean squared logit error () of each query format against NVFP4 keys on Qwen3-4B. Dual-residual query quantization achieves the lowest error.
| Query format | Total | Query term | Share |
|---|---|---|---|
| BF16 | 19.32 | 0.00 | – |
| NVFP4 | 46.17 | 27.50 | 60% |
| + smoothing Q (token mean) | 33.03 | 13.95 | 42% |
| + smoothing Q (GQA mean) | 24.57 | 4.89 | 20% |
| + dual residual (ours) | 19.55 | 0.23 | 1.2% |
Table 7. Comparison of probability scaling rules on Qwen3-4B. Underflow-aware scaling matches the accuracy of two-level scaling without per-tile rescaling overhead.
| scaling | KL | Top-1 | MRCR | RULER | LB-Pro |
|---|---|---|---|---|---|
| BF16 KV | – | – | 36.08 | 90.25 | 55.79 |
| Standard max /6 | 9.31 | 98.50 | 35.53 | 82.00 | 54.99 |
| Two-level | 6.06 | 98.75 | 35.51 | 88.00 | 55.12 |
| Ours (Eq. 4) | 6.47 | 98.73 | 35.51 | 88.75 | 55.02 |
and adds back to every logit in high precision using the dequantized keys. Decode has a single query token per head, so we evaluate two choices of : the per-head mean of earlier query tokens (token mean), and the mean over the query heads that share a KV head (GQA mean).
Higher accuracy. As shown in Table 6, Dual-Residual Query Quantization achieves the lowest logit error, reducing the query term to just 1.2% of the total, compared to 42% for smoothing Q with the token mean and 20% with the stronger GQA mean (the variant shown in Figure 3). Subtracting a mean shrinks only the component shared across tokens or heads and still rounds the remainder to FP4 once, whereas our second FP4 term directly quantizes that rounding error itself.
Higher efficiency. Smoothing Q requires extra CUDA-core work and instructions to compute the high-precision correction for each key, or extra memory overhead to store precomputed projections per key. In contrast, our second query term stays on the Tensor Cores: stacked into the zero padding of the first (Section 4.2), it only widens the query MMA from to columns, often within padding the MMA computes anyway, and is far more efficient.
Comparison with two-level scaling. SageAttention3 quantizes with two levels of scales: an FP32 scale per query row and key tile first maps the tile maximum of to , and E4M3 block scales then quantize the result with the standard max /6 rule.
Similar accuracy. As shown in Table 7, our Underflow-Aware Probability Scaling achieves comparable KL divergence, top-1 agreement, and downstream benchmark accu-racy to two-level scaling, while both substantially outperform the standard max /6 rule.
Higher efficiency. Our constant folds directly into the argument (line 10 of Algorithm 1) and cancels in the softmax normalization, adding no extra instructions or output correction. In contrast, two-level scaling changes its FP32 scale at every tile, requiring exact per-tile maximum reductions and per-tile output rescaling on CUDA cores. In our decode implementation of two-level scaling, keeping the FP32 running output in registers for per-tile rescaling also causes severe register spilling, making the kernel 3.0–26.7× slower than ours across 8K–128K contexts and batches 1–16, and a serving decode step 5.0× slower (89.7 vs. 17.8 ms).
E MXFP4 ADJACENT-EXPONENT BLOCK-SCALE SEARCH
In MXFP4 (Rouhani et al., 2023), each block of 32 elements shares one unsigned 8-bit power-of-two E8M0 scale (). Because the largest representable E2M1 magnitude is , the standard OCP exponent rule sets
Since , dividing by maps into . Whenever , the standard OCP scale clips the block maximum down to . Conversely, selecting the next power of two, , maps into and avoids clipping, at the cost of doubling the quantization step size for the rest of the block.
To balance clipping error on the largest elements against rounding error on the interior elements, we evaluate both adjacent exponents for each block,
and select the scale that minimizes the squared reconstruction error in Eq. 6 (breaking ties in favor of ). Because the round-up exponent is always either or , this two-candidate search is guaranteed to achieve no higher block MSE than either fixed rule.
F KL ABLATION OF OUTLIER-AWARE KEY QUANTIZATION
Once the recipe is close to BF16 KV accuracy, end-to-end benchmarks cannot resolve the individual parts of Outlier-Aware Key Quantization (Figure 11). We therefore compare them with the teacher-forced KL of Appendix A, on MRCR and AIME 2024 trajectories. Each row of Table 8 changes one setting: it subtracts no key mean, applies no rotation to Q and K, or keeps the single standard scale for K (amax/6 for NVFP4, the OCP exponent for MXFP4).
Table 8. Leave-one-out KL ablation of Outlier-Aware Key Quantization on Qwen3-4B-Thinking-2507. Each row removes one part from the full recipe; values are the teacher-forced KL from BF16 KV (, Appendix A). Since KL tracks end-to-end accuracy (Table 3), every part contributes to accuracy.
| Configuration | MRCR | AIME24 |
|---|---|---|
| NVFP4 full recipe | 3.83 | 4.70 |
| – key smoothing | 11.79 (+208%) | 8.11 (+72%) |
| – Hadamard rotation | 6.68 (+74%) | 6.84 (+45%) |
| – block-scale search | 4.70 (+23%) | 5.58 (+19%) |
| MXFP4 full recipe | 10.27 | 11.75 |
| – key smoothing | 50.73 (+394%) | 37.76 (+221%) |
| – Hadamard rotation | 30.23 (+194%) | 35.93 (+206%) |
| – block-scale search | 12.97 (+26%) | 17.19 (+46%) |
| BF16 KV (rerun) | 0.29 | 0.45 |
Every part matters in both formats. Removing key smoothing has the largest effect for both formats on both benchmarks, tripling MRCR KL for NVFP4 and raising it almost fivefold for MXFP4. Removing the Hadamard rotation raises KL by 45–74% for NVFP4 and roughly triples it for MXFP4, and dropping block-scale search adds 19–46%. All twelve increases are significant: the paired is at least 10.2 over the 400 MRCR conversations and at least 14.6 over the 30 AIME problem means, and every AIME problem is worse in every removal. For scale, the full NVFP4 recipe sits above the BF16 KV floor on MRCR and on AIME 2024.
G FP4 MULTI-HEAD LATENT ATTENTION
Algorithm 2 extends our FP4 decoding method to Multi-Head Latent Attention (MLA). We present the formulation for a single query token and a single attention head, with the latent cache shared across heads. Let and denote the cached latent and decoupled positional (RoPE) vectors over tokens. In MLA, the per-head content keys and values are given by and , where and are the per-head up-projection matrices, and the attention scale is . During decoding, is absorbed into the content query as , allowing content scores to be computed directly against , while is applied once to the aggregated latent output rather than to every cached token.
Because the latent cache dominates the KV footprint, we apply Outlier-Aware Key Quantization (Section 3.3) directly to with latent mean and Hadamard matrix , and apply Dual-Residual Query Quantization (Section 3.1) to the rotated absorbed query . The smaller positional query and positional cache remain in BF16.
Algorithm 2 FP4 MLA decoding with a shared latent cache.
Input: Content query , positional query , latent cache , positional cache , block size .
Require: Projections , Hadamard matrix , latent mean , and .
Output: Attention output .
1: Preprocessing: , ;
2: , , ;
3: ;
4: Divide , its scales, and into blocks and ;
5: for in do
6: ;
7: ;
8: ;
9: ;
10: ;
11: ;
12: ;
13: ;
14: end for
15: ;
16: return
Unlike standard GQA where keys and values are quantized separately along their respective reduction axes, MLA reuses the single latent cache for both the score and context products. Because the microscaling groups of are aligned along the channel dimension for the FP4 score GEMM, executing the context reduction on FP4 Tensor Cores would require re-quantizing along the token dimension at runtime. Instead, we dequantize the current latent block on the fly and accumulate the weighted latent in FP16, omitting the probability quantization of Section 3.2. Finally, because is used in the value path as well, we invert the Hadamard rotation and restore the latent mean before applying the value up-projection (in practice, can be folded offline into and ).