Repository navigation
NVFP4: load a checkpoint's FP8 linears as FP8 - #49922
Draft
IlyasMoutawwakil wants to merge 4 commits into
Draft
IlyasMoutawwakil wants to merge 4 commits into
IlyasMoutawwakil wants to merge 4 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
A converter pattern only ends at a name boundary. `experts.down_proj` also claimed a shared expert's `shared_experts.down_proj.weight`, so MiniMax-M3.1-Flash failed to load. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: nvfp4 |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #49851, the NVFP4 PR. This PR targets its branch.
ModelOpt exports often mix NVFP4 layers with FP8 ones. #49851 loads those FP8 layers dequantized to the model dtype. This PR loads them as they ship, with the same finegrained-kernels it already uses for NVFP4.
What
FP8Linearloads three FP8 layer formats next to the NVFP4 ones:fp8: one weight scale per tensor, and the checkpoint's staticinput_scalefor the activations.fp8_per_block: one weight scale per 128x128 block (ModelOptFP8_PB_WO). Activations are quantized at run time, as vLLM does.mxfp8: one scale per 32 values.quantized_layerstakes these formats. The ModelOpt and MXFP8 readers map their layers to them instead of to"dequantize".FP8Linearlike a linear. A per-tensor scale is replicated, and a block scale is split with its weight.input_scaleraises when loading.Why
Dequantizing keeps a bf16 copy of every FP8 layer. Loading them as FP8 halves their memory and keeps the checkpoint's numerics, at about the same speed.
Results
Each forward is captured in a CUDA graph and timed as replays, without torch.compile. Decode replays one step with a static cache. B200, bf16 model dtype.
nvidia/Muse-Glimmer-30B-NVFP4, one GPU. It mixes 180 per-tensor FP8 layers with 213 weight-only NVFP4 layers.MiniMax-M3.1-Flash, 4 GPUs withtp_size=4, ep_size=4. Its NVFP4 experts sit next to MXFP8 attention, indexer, shared expert and dense layers.MiniMax's batch-1 decode is slower because finegrained-kernels' MXFP8 GEMM at one token reads its weights at about a third of bf16 cuBLAS's bandwidth. That is a kernel issue to fix there. In prefill the FP8 GEMMs are about 1.9x faster than bf16, but they are a small part of this model's runtime.
Tests
input_scaleraises.🤖 Generated with Claude Code