[DeepSeek-V4][fix] Detect MTP routed-expert layout separately#16276
Open
waynehacking8 wants to merge 1 commit into
Open
[DeepSeek-V4][fix] Detect MTP routed-expert layout separately#16276waynehacking8 wants to merge 1 commit into
waynehacking8 wants to merge 1 commit into
Conversation
Contributor
WalkthroughDeepSeek V4 mixed-precision handling now derives FP8 block-scale configurations, dequantizes fused-A weights for unquantized destinations, and applies consistent quantization settings to attention, shared-expert, and MTP projections. ChangesDeepSeek V4 mixed-precision quantization
Estimated code review effort: 4 (Complex) | ~45 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
waynehacking8
added a commit
to waynehacking8/TensorRT-LLM
that referenced
this pull request
Jul 11, 2026
Addresses the CodeRabbit docstring-coverage warning on NVIDIA#16276. Signed-off-by: WEI CHENG CHIU <waynehacking8@gmail.com>
waynehacking8
added a commit
to waynehacking8/TensorRT-LLM
that referenced
this pull request
Jul 18, 2026
Addresses the CodeRabbit docstring-coverage warning on NVIDIA#16276. Signed-off-by: WEI CHENG CHIU <waynehacking8@gmail.com>
waynehacking8
force-pushed
the
wayne/fix-16196-fused-a-dequant
branch
from
July 18, 2026 02:25
5816fa5 to
e64f1a0
Compare
mikeiovine
approved these changes
Jul 23, 2026
waynehacking8
force-pushed
the
wayne/fix-16196-fused-a-dequant
branch
from
July 27, 2026 01:25
e64f1a0 to
0113873
Compare
…MXFP4) The ModelOpt experts-only NVFP4 repacks (e.g. nvidia/DeepSeek-V4-Pro-NVFP4) re-quantize only the dense routed experts to NVFP4 (U8) and leave the MTP routed experts at the base model's MXFP4 (I8). _set_deepseek_v4_routed_moe_ quant_config detected a single layout from layers.0 and applied it to every MoE layer including the MTP layer, so the MTP experts got NVFP4 and crashed in fused_moe load_quant_scales. Detect the MTP expert dtype separately and assign the MTP layer indices the correct (MXFP4) config. Validated end-to-end on real weights: nvidia/DeepSeek-V4-Pro-NVFP4 on 4x B300, TP4, moe_backend=TRTLLM, rc15.post1 (equivalent change), with the construction fix from 3972f5e: loads 100% + serves + generates, MTP=1 and MTP=3 (mtp_eagle_one_model builds one shared MTP layer). MTP accept_len ~2.86. Signed-off-by: d3nb <wanxiren@gmail.com>
waynehacking8
force-pushed
the
wayne/fix-16196-fused-a-dequant
branch
from
July 27, 2026 01:26
0113873 to
bbb07f9
Compare
Author
|
@mikeiovine I rebased onto current main after #16433 and narrowed the PR to the remaining MTP layout commit; it is mergeable and DCO is green. When convenient, could you trigger |
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.
Description
#16433 merged the base mixed-precision construction and loading fix for
nvidia/DeepSeek-V4-Pro-NVFP4, superseding the earlier construction commits in this PR. This PR now contains only the remaining MTP-specific fix, authored by @d3nb.The checkpoint stores dense routed experts as NVFP4 (
U8) but leaves MTP routed experts at the base model's MXFP4 layout (I8)._set_deepseek_v4_routed_moe_quant_config()previously detected one layout fromlayers.0and assigned it to every MoE layer, so MTP speculative decoding received NVFP4 configuration and crashed infused_moescale loading.The loader now probes the MTP expert header separately and assigns MXFP4 or NVFP4 configuration to the MTP layer range only when its layout differs from the dense experts. Matching or absent MTP headers retain the existing dense configuration.
Related: #16196, #16433.
Test Coverage
nvidia/DeepSeek-V4-Pro-NVFP4checkpoint using 4x B300, TP4, and the TRT-LLM MoE backend.main.PR Checklist