{"slug": "nvfp4-vs-mxfp4-decode-benchmark", "title": "NVFP4 vs MXFP4 Decode Benchmark", "summary": "A benchmark run on an NVIDIA B200 GPU with vLLM v0.31 serving the dense Qwen3-32B model found NVFP4 delivers up to roughly 8% faster decode throughput than MXFP4 at small batch sizes, with gains of 7.1%, 7.6% and 4.2% at batch 1, 8 and 32 respectively, according to results published in the decodebench repository by Cezar and Stas Bekman. The authors attribute the gap mainly to kernel implementation rather than MXFP4's smaller 4.25 versus 4.5 bits per element, noting decode ran at only about 40–50% of theoretical HBM bandwidth and that the difference disappears at batch sizes of 64 and above. The benchmark recommends preferring NVFP4 on B200 hardware for low-batch decode while cautioning that teams should benchmark their own production configurations.", "body_md": "# NVFP4 vs MXFP4 Decode Benchmark\n\nIf you've been following the latest [FP4 formats](https://github.com/stas00/ml-engineering/blob/master/training/dtype.md#fp4-formats), you've probably read a bunch of articles [comparing NVFP4 and MXFP4](https://lnkd.in/p/gsGMsEfu):\nblock sizes, scale formats, yada yada.\n\nWhat I personally haven't seen much of is actual results on actual production inference workloads. *Does it matter?!*\n\nSo, Stas did [measure](https://github.com/stas00/ml-engineering/tree/master/compute/accelerator#maximum-achievable-and-sustainable-matmul-flops-comparison-table)\nthat on a B200, NVFP4 gets ~9% more TFLOPS than MXFP4 on large GEMMs (read: matrix multiplys, GEneral Matrix Multiply). Well, that's a pretty big difference!\n\nBut it's still an isolated GEMM benchmark. Does the perf difference actually translate to production workloads?\n\nAlso, what about other non-GEMM-bound workloads, like [decode](https://www.ai21.com/glossary/foundational-llm/what-are-prefill-and-decode/)? Also ... why?!\n\nWell, we can test it! Perhaps we can sus it out. *(which is the whole point of this post, and probably why you're still reading)*\n\nOk. I tried to keep it simple by picking a realistic-ish dense LLM (Qwen3-32B), served with vLLM, on a B200 (via Modal). Both formats were quantized from scratch from the same BF16 weights, in this way we try to keep the confounders to a minimum.\n\nMy hypothesis was that MXFP4 should be faster as we saturate HBM throughput due to MXFP4's slightly smaller bits (4.25 vs 4.5). aka: this is the classic bandwidth-bound workload so why not?\n\n## TL;DR\n\nThe [benchmark Claude mostly built & I ran](https://github.com/cezarc1/decodebench) suggests that if you're using a B200 GPU, *you should probably always prefer NVFP4 over MXFP4*, by a meaningful margin (up to ~8% faster decode at small batches)!\n\nThis holds for low-batch decode, *and* for GEMM-bound training NVFP4 looks better too with today's kernels (see below),\nthough that's down to the kernels: with an identical kernel, MXFP4 is actually ~9% faster (see the update below). The difference disappears at larger batch sizes, which at first didn't surprise me: I assumed we were becoming HBM-bandwidth bound as the batch and KV-cache reads grow. I won't spoil it, but that turned out not to be the reason!\n\nAdditionally, quantizing from BF16 to the respective formats and measuring the loss indicates that NVFP4 should yield non-trivially better eval perf. I didn't run any evals to confirm this however.\n\nNow, these findings may generalize but as Stas suggests, you should always strive to\n[benchmark your actual production configuration](https://x.com/StasBekman/status/2107221020197429422).\n\n## Kernel implementations seem to dominate the perf differences\n\nOn a B200 (SM100) with vLLM v0.31, the NVFP4/MXFP4 decode perf difference mostly comes down to the kernel implementation, not to the 4.5 vs 4.25 bits difference. Note again that I tested this on only one dense model (Qwen3-32B, w/ BF16 KV cache).\n\n## Small-batch decode: NVFP4 is meaningfully faster\n\n+7.1%, +7.6% and +4.2% decode throughput at batch 1, 8 and 32.\n\nWorth highlighting that decode for this workload is neither bandwidth-bound (~40–50% of theoretical HBM bandwidth) nor compute-bound (the GEMMs are tiny), so kernel implementation differences dominate. NVFP4's superior perf here seems to come mostly from the kernels around the GEMMs: activation quantization, fewer kernels per step, etc.\n\n## Batch ≥ 64: there's no meaningful difference\n\nSo you might as well pick the format based on eval perf, portability or other concerns if you're in this regime.\n\n## Batch size dominates the perf difference & it's not due to HBM memory bandwidth saturation?\n\nNVFP4's non-GEMM kernels are faster, but its GEMMs fall behind MXFP4's as they grow in size, and from batch 64 up the two differences cancel each other out.\n\nSo is it the batch size or the number of tokens that end up dominating? I kept the batch at 1 and grew the context instead, and separately held the tokens constant and grew the batch:\n\nTurns out it's the batch size. Look @ batch 1, NVFP4 keeps saving the same ~0.4 ms per step all the way out to 127k tokens of context (the % only shrinks because each step gets longer). But at the same 128k tokens, bumping the batch to 128 wipes the saving out. More memory traffic didn't make a significant enough difference, but the bigger GEMMs did! Huh?\n\nBut why?!\n\nPerhaps a longer context only adds attention work, i.e. more KV cache reads. Remember that I kept the KV cache at BF16 for both formats, so both get slower by the same amount and NVFP4 keeps its lead. So, a bigger batch, on the other hand, means bigger GEMMs, and vLLM autotunes MXFP4's GEMM but (I think?) runs NVFP4's on a fixed heuristic. So as the GEMMs grow, NVFP4's fall further behind MXFP4's, until that slowdown cancels out NVFP4's lead. Maybe!\n\nNow, I'm still not 100% sure it isn't bandwidth: @ batch 128, MXFP4's small edge matches what the byte difference should theoreticaly be. But @ batch 1 w/ a 127k context, with the same memory traffic, and similar bandwidth use, NVFP4 keeps its lead, and the GEMM size is the only thing that changed between the runs.\n\nThis confuses me enough that I'll revisit it and read some metrics straight from the GPU to either confirm or rule it out.\n\n## Large GEMMs (prefill/training) depend heavily on the kernel implementation\n\nIn PyTorch, NVFP4 gets ~9% more TFLOPS\n([ml-engineering book](https://github.com/stas00/ml-engineering/tree/master/compute/accelerator#maximum-achievable-and-sustainable-matmul-flops-comparison-table)),\nbut there (at least in the PyTorch 2.13 I checked) NVFP4 runs on cuBLASLt and MXFP4 on a different library (MSLK). In vLLM's kernels\n(CuTe-DSL), NVFP4's largest GEMMs were from 4% to 20% slower at batch 512.\n\n### Update (Oct 15): it's definitely the kernels\n\n[Santosh challenged me](https://x.com/theycallmeMohan/status/2109447407419470003) on the finings here: *if the\nhardware roofline is about the same for both formats, why would NVFP4 be *inherently* faster?*\nTo convince ourselves we need to separate the format from the kernel, I ran both through the *same* [QuACK](https://github.com/Dao-AILab/quack)'s `GemmSm100` kernel on a B200.\nQuACK isn't as fast as the default vLLM kernels, but apples to apples MXFP4 was\n~9% faster on most large GEMMs, theoretically consistent with its smaller size.\n\n## You should serve NVFP4 on vLLM's default kernel\n\nThat's CuTe-DSL (`--linear-backend flashinfer_cutedsl`). On cuDNN (` flashinfer_cudnn`) the same\nweights are between 10 and 18% slower and lose to MXFP4 at every batch size. MXFP4 only has a single\nW4A4 kernel in vLLM 0.31 (FlashInfer's `mm_fp4` with the CuTe-DSL backend).\n\n## NVFP4 is more accurate\n\nIts NLL penalty after quantization from BF16 is 2.7× smaller. While no evals were run, the lower NLL (negative log-likelihood) suggests that NVFP4 should yield better eval results.\n\nNot tested here but to highlight this, NVIDIA's\n[own paper](https://arxiv.org/abs/2509.25149) found that an small LLM\nmodel trained with MXFP4 needed 36% more tokens (1.36T vs 1T) to match NVFP4's loss. Though they noted that both\nformats achieved similar raw throughput on both GB200 & GB300 (training is usually GEMM-bound).\n\n## Code & Weights\n\nThe code, quantized weights and full write-up are on [GitHub](https://github.com/cezarc1/decodebench) and HF ([MXFP4](https://huggingface.co/ggamecrazy/Qwen3-32B-MXFP4-W4A4), [NVFP4](https://huggingface.co/ggamecrazy/Qwen3-32B-NVFP4-W4A4)).", "url": "https://wpnews.pro/news/nvfp4-vs-mxfp4-decode-benchmark", "canonical_source": "https://cezarcocu.com/blog/nvfp4-vs-mxfp4-decode-bench/", "published_at": "2026-10-09 00:00:00+00:00", "updated_at": "2026-10-28 02:12:10.473148+00:00", "lang": "en", "topics": ["machine-learning", "ai-infrastructure", "large-language-models", "ai-research"], "entities": ["NVIDIA B200", "NVFP4", "MXFP4", "vLLM", "Qwen3-32B", "Modal", "Stas Bekman", "Cezar"], "also_reported_by": [], "takeaway": "On a B200 with vLLM v0.31 serving Qwen3-32B, NVFP4 beat MXFP4 by 7.1%, 7.6% and 4.2% decode throughput at batch 1, 8 and 32, with no meaningful difference at batch 64 and above, because kernel implementation rather than the 4.25 vs 4.5 bits-per-element difference dominates.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/nvfp4-vs-mxfp4-decode-benchmark", "markdown": "https://wpnews.pro/news/nvfp4-vs-mxfp4-decode-benchmark.md", "text": "https://wpnews.pro/news/nvfp4-vs-mxfp4-decode-benchmark.txt", "jsonld": "https://wpnews.pro/news/nvfp4-vs-mxfp4-decode-benchmark.jsonld"}}