Repository navigation
[Qwen4-Exp] Load nvidia/Qwen3.8-Flash-Next-NVFP4 (ModelOpt MIXED_PRECISION: NVFP4 experts, fp8 PLE, fp8 MTP) - #37752
Closed
YAMY1234 wants to merge 2 commits into
Conversation
…PLE and fp8 MTP nvidia/Qwen3.8-Flash-Next-NVFP4 is exported by ModelOpt as MIXED_PRECISION: routed experts NVFP4, the PLE n-gram table FP8 (shard_N.weight + weight_scale), MTP experts FP8_BLOCK_SCALES (weight_scale_inv), quantized_layers keyed model.language_model.* and no text_config.ple_embedding_dtype. Four things kept it from loading on this branch: - ModelOptMixedPrecisionConfig could not match model.language_model.* keys to the model.* prefixes Qwen4-Exp modules use, and iterated exclude_modules=None. - Qwen4ExpNGramEmbedding only picked fp8 storage for an fp8 checkpoint or an explicit ple_embedding_dtype, so the fp8 shards hit the offload auto-switch ValueError; it now resolves the table's quant_algo from the mixed config. - The sm100 Qwen MoE override skipped modelopt_mixed, leaving the runner on auto; ModelOptNvFp4FusedMoEMethod then resolved trtllm at run time but had enable_flashinfer_trtllm_moe=False and raised Unsupported moe_runner_backend. - _mtp_quant_config dropped the mixed config for the MTP head, and the mixed config had no FP8_BLOCK_SCALES mapping; both now route the MTP experts to the 128x128 block Fp8MoEMethod.
YAMY1234
requested review from
Alisehen,
AniZpZ,
BBuf,
Edwardf0t1,
FlamingoPg,
HaiShaw,
OrangeRedeng,
b8zhong,
ch-wan and
mmangkad
as code owners
September 3, 2026 08:04
YAMY1234
commented
Sep 3, 2026
YAMY1234
commented
Sep 3, 2026
YAMY1234
force-pushed
the
qwen38-flash-next-nvidia-mixed
branch
from
September 4, 2026 00:07
66d242d to
056877d
Compare
…stub test - qwen3_moe override: only default modelopt_mixed to flashinfer_trtllm when the mixed config's expert layers are NVFP4/FP8; W4A16_NVFP4 experts go to marlin (or reject an explicit non-marlin runner), mirroring the Nemotron override. - test_shared_experts_fusion_gates: the modelopt_mixed stub now carries quantized_layers; add the positive mtp.* case.
YAMY1234
force-pushed
the
qwen38-flash-next-nvidia-mixed
branch
from
September 4, 2026 00:22
056877d to
4369675
Compare
4 of 5 tasks
Jiminator
pushed a commit
that referenced
this pull request
Sep 5, 2026
…PLE and fp8 MTP nvidia/Qwen3.8-Flash-Next-NVFP4 is exported by ModelOpt as MIXED_PRECISION: routed experts NVFP4, the PLE n-gram table FP8 (shard_N.weight + weight_scale), MTP experts FP8_BLOCK_SCALES (weight_scale_inv), quantized_layers keyed model.language_model.* and no text_config.ple_embedding_dtype. Four things kept it from loading on this branch: - ModelOptMixedPrecisionConfig could not match model.language_model.* keys to the model.* prefixes Qwen4-Exp modules use, and iterated exclude_modules=None. - Qwen4ExpNGramEmbedding only picked fp8 storage for an fp8 checkpoint or an explicit ple_embedding_dtype, so the fp8 shards hit the offload auto-switch ValueError; it now resolves the table's quant_algo from the mixed config. - The sm100 Qwen MoE override skipped modelopt_mixed, leaving the runner on auto; ModelOptNvFp4FusedMoEMethod then resolved trtllm at run time but had enable_flashinfer_trtllm_moe=False and raised Unsupported moe_runner_backend. - _mtp_quant_config dropped the mixed config for the MTP head, and the mixed config had no FP8_BLOCK_SCALES mapping; both now route the MTP experts to the 128x128 block Fp8MoEMethod. Ported from #37752 (base qwen4-main-squashed-rebased) onto qwen4-main-squashed: - The sm100 Qwen MoE runner override lives inline in arg_groups/overrides.py on this branch (model_overrides/qwen3_moe.py does not exist here yet). - This branch's ModelOptMixedPrecisionConfig has no fp8_pb_wo_config, so a 128x128 block Fp8Config (fp8_block_config) is added for FP8_BLOCK_SCALES. - Comments trimmed. (cherry picked from commit 7bc5bec)
Jiminator
pushed a commit
that referenced
this pull request
Sep 5, 2026
…stub test - qwen3_moe override: only default modelopt_mixed to flashinfer_trtllm when the mixed config's expert layers are NVFP4/FP8; W4A16_NVFP4 experts go to marlin (or reject an explicit non-marlin runner), mirroring the Nemotron override. - test_shared_experts_fusion_gates: the modelopt_mixed stub now carries quantized_layers; add the positive mtp.* case. Ported from #37752 onto qwen4-main-squashed: the override and its test target arg_groups/overrides.py instead of model_overrides/qwen3_moe.py. (cherry picked from commit 4369675)
3 of 4 tasks
Jiminator
pushed a commit
to Jiminator/sglang
that referenced
this pull request
Sep 8, 2026
Restore the original sgl-project#38121/sgl-project#37752 MTP and sm100 runner gates, which are still absent from main. Deployment testing found that dropping the mixed MTP config loads FP8 expert values without their intended quantization method and reduces draft acceptance. Co-authored-by: Yangmin Li <[email protected]>
3 of 5 tasks
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.
Motivation
Stacked on #37500.
nvidia/Qwen3.8-Flash-Next-NVFP4(ModelOpt export) does not load on theqwen4-main-squashed-rebasedbranch. UnlikeRadixArk/Qwen3.8-Flash-Next-NVFP4, the NVIDIA checkpoint is a ModelOpt MIXED_PRECISION export:quantized_layers["model.language_model.layers.N.mlp.experts"]quantized_layers["model.language_model.layers.1.ple.ple_embedding.ngram_embedding"], 128 fp8shard_N.weight+weight_scalequantized_layers["mtp.layers.0.mlp.experts"],weight_scale_invignorelistconfig.jsoncarries thequantization_config(quant_method: modelopt) and has notext_config.ple_embedding_dtype.On the base branch the server dies while loading weights:
and with
--no-ple-offload-embeddingit dies at CUDA-graph capture:Modifications
ModelOptMixedPrecisionConfig: resolvemodel.language_model.*keys against themodel.*prefixes Qwen4-Exp modules use; defaultexclude_modulesto[](ModelOpt may omitignore, andis_layer_skippediterates it); mapFP8_BLOCK_SCALESto the 128x128 blockFp8LinearMethod/Fp8MoEMethod.Qwen4ExpNGramEmbedding: pick fp8 table storage when the mixed config marks the ngram table FP8 (previously only an fp8 checkpoint or explicitple_embedding_dtype), so the pinned-host offload path sees fp8 storage up front instead of hitting the auto-switch error.model_overrides/qwen3_moe.py: apply the sm100flashinfer_trtllmMoE runner override tomodelopt_mixedas well. With the runner left onauto,ModelOptNvFp4FusedMoEMethod.create_moe_runnerresolves TRTLLM at run time whileenable_flashinfer_trtllm_moewas computed as False at init, which is what raised theNotImplementedErrorabove._mtp_quant_config: keep the mixed config for the MTP head when it listsmtp.*layers (the NVIDIA checkpoint quantizes the MTP experts); previously it was dropped, so the fp8 expert weights would have been loaded into bf16 params.test_modelopt_loader.py.Accuracy Tests
All runs: GB300 (sm103), TP1,
--linear-attn-{prefill,decode}-backend flashinfer --mamba-ssm-dtype bfloat16, containerlmsysorg/sglang:nightly-dev-cu13-20260901-07c8f729with this branch overlaid. GSM8K = sgl-eval, 200 examples, thinking on,max_tokens=16384(same astest_qwen4_exp_models.py, threshold 0.94). MTP = NEXTN 3/1/4.fp8 PLE auto-switch is unsupported with ple_offload_embedding)All runs finished with
stop_rate1.0 (0.995 on one run) anderror_rate0.0; the same code path was also exercised on a synthetic copy of the RadixArk checkpoint rewritten to the NVIDIA MIXED_PRECISION metadata (0.965-0.975, MTP accept 3.03).Unit tests:
pytest test/registered/unit/model_loader/test_modelopt_loader.py -k MixedPrecision-> 14 passed.Checklist
🤖 Generated with Claude Code
CI States
Latest PR Test (Base): ❌ Run #33821513388
Latest PR Test (Extra): ❌ Run #33821513119
Latest PR Test (AMD ROCm 7.2): ❌ Run #33821513209