--- license: mit base_model: deepseek-ai/DeepSeek-V4.1-Flash base_model_relation: quantized pipeline_tag: text-generation tags: - deepseek - deepseek-v4.1 - nvfp4 - modelopt - vllm - blackwell - quantized - atomic-chat --- # DeepSeek-V4.1-Flash-NVFP4 [deepseek-ai/DeepSeek-V4.1-Flash](https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash) with its routed experts re-encoded as NVFP4, calibrated by NVIDIA's DeepSeek-V4 recipe, and **measured against the original**. Everything below was produced by one run of [`foundry-nvfp4.sh`](https://github.com/AtomicBot-ai/atomic-quantizer/blob/main/scripts/foundry-nvfp4.sh) on a 4×B200 box on 2026-09-10; the logs and the raw measurements are in [AtomicChat/DeepSeek-V4.1-Flash-NVFP4-metrics](https://huggingface.co/datasets/AtomicChat/DeepSeek-V4.1-Flash-NVFP4-metrics). ## What this is, and what it is not V4.1-Flash ships its routed experts in MXFP4 already. NVFP4 keeps every nibble and rewrites the block scales (E4M3 per 16 plus one fp32 per tensor instead of E8M0 per 32). The cast is lossless: **16,986,931,200 of 16,986,931,200 blocks** transcoded bit-exactly. Engram tables, attention, shared experts, the LM head and the MTP/DSpark draft stay in their original FP8 / BF16. The checkpoint is 8 GiB larger than the original, not smaller. What NVIDIA's recipe adds is one calibrated `input_scale` per expert projection: it places the E4M3 window for the FP4 activations on Blackwell's W4A4 NVFP4 MoE kernels. Calibration: `cnn_dailymail` + `nvidia/Nemotron-Post-Training-Dataset-v2`, 64 samples of 512 tokens each, through DeepSeek's reference `inference/model.py` under [NVIDIA Model-Optimizer](https://github.com/NVIDIA/Model-Optimizer) at commit `079078de` with two one-line patches for V4.1 (tokenizer into the Transformer, FP8 block size read from the scale shape). 15,246 of 15,360 routed experts (99.3 %) received calibration tokens; the rest got the per-layer fallback scale. This checkpoint does **not** make the model faster on Hopper (NVFP4 runs through Marlin there and the calibrated scales are ignored) and it is not smaller than the original. What it offers is the NVFP4 W4A4 path on Blackwell, with numbers instead of a promise. ## Measured against the original Reference: the original MXFP4 checkpoint served by the same vLLM build on the same 4×B200. Protocol: windows of 4096 tokens, second half scored, 24 windows per corpus, 49,152 scored positions each, top-512 log probabilities (the KLD is a bracket; the numbers below are its lower edge, the upper edge is within 0.0004 on every row). `ref-repeat` is the original scored twice and is the noise floor of the stand: MoE routing on non-deterministic kernels flips 2–4 % of top-1 tokens between two runs of the same model. | corpus | build | mean KLD | median KLD | p99 KLD | top-1 agree | ppl | | --- | --- | --- | --- | --- | --- | --- | | neutral (30 languages) | **this checkpoint** | 0.0353 | 0.00277 | 0.458 | 94.12 % | 2.9950 | | | cast, no calibration | 0.0344 | 0.00276 | 0.433 | 94.39 % | 2.9928 | | | original vs itself (noise) | 0.0159 | 0.00131 | 0.205 | 96.07 % | 2.9677 | | code | **this checkpoint** | 0.0199 | 0.000037 | 0.316 | 96.76 % | 1.8955 | | | cast, no calibration | 0.0191 | 0.000036 | 0.296 | 96.84 % | 1.9013 | | | original vs itself (noise) | 0.0101 | 0.000022 | 0.160 | 97.69 % | 1.8895 | | agentic | **this checkpoint** | 0.0089 | 0.000006 | 0.128 | 98.32 % | 1.3868 | | | cast, no calibration | 0.0085 | 0.000005 | 0.127 | 98.40 % | 1.3871 | | | original vs itself (noise) | 0.0055 | 0.000004 | 0.083 | 98.63 % | 1.3846 | Two honest readings of this table: 1. **The calibrated checkpoint and a plain cast with `input_scale = 1.0` are indistinguishable** within the noise of the stand: medians agree to the sixth decimal, mean KLD differs by 0.001 against a floor of 0.016. For this model that is expected: DeepSeek trained it with SwiGLU clamps that bound the expert inputs at 189 and 150, and the flat window already covers that range at full scale precision. The calibration is what NVIDIA's recipe prescribes, and it costs nothing, but it does not buy anything measurable here. 2. **The cost of W4A4 itself is real and small**: about 1.7 points of top-1 agreement beyond the noise on general text, 0.8 % perplexity on text, 0.5 % on code, 0.2 % on agentic dialogue, relative to the original served natively. The original MXFP4 path does not pay this. Speed is not measured and not claimed. ## Running it Needs Blackwell (B200/B300/GB200/GB300, or RTX PRO 6000) and a vLLM that knows `deepseek_v41`. As of 2026-09-10 that is branch `dsv41-feat` of vllm-project/vllm ([PR #56214](https://github.com/vllm-project/vllm/pull/56214)), built from source at `e47aa780`; the loader keys on `moe_quant_algo: NVFP4` in `config.json` and routes the experts to the FlashInfer TRT-LLM NVFP4 MoE backend. Measured with `tensor_parallel_size=4`, `max_model_len=4097`, no speculative decoding: the DSpark draft experts are left in MXFP4 and that combination has not been exercised. ## Reproduce Runbook, toolbox and the exact commands: [atomic-quantizer/docs/runbook-nvfp4.md](https://github.com/AtomicBot-ai/atomic-quantizer/blob/main/docs/runbook-nvfp4.md). The upstream reference code, encoding and license files are DeepSeek's, copied unchanged.