[https://nvbugs/6195110][fix] Restore DeepSeek shared-weights vanilla MTP path - #14457
Conversation
|
/bot run |
📝 WalkthroughWalkthroughThis PR implements checkpoint layer count preservation for vanilla MTP decoding expansion. When expanding MTP layers beyond the checkpoint's original capacity, the code now saves the original checkpoint layer count and uses it consistently for layer index remapping across all model architectures (DeepseekV3, ExaoneMoe, GLM, NemotronH). ChangesMTP Vanilla Decoding Layer Preservation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
PR_Github #49912 [ run ] triggered by Bot. Commit: |
f5c6957 to
a8ffd3e
Compare
|
/bot run --extra-stage "DGX_H100-PyTorch-Post-Merge-2" |
|
PR_Github #49913 [ run ] triggered by Bot. Commit: |
|
PR_Github #49912 [ run ] completed with state |
|
PR_Github #49913 [ run ] completed with state
|
|
/bot run --extra-stage "DGX_H100-PyTorch-Post-Merge-2" |
|
PR_Github #50133 [ run ] triggered by Bot. Commit: |
|
PR_Github #50133 [ run ] completed with state
|
|
/bot run --extra-stage "DGX_H100-PyTorch-Post-Merge-2" |
|
PR_Github #50182 [ run ] triggered by Bot. Commit: |
|
PR_Github #50182 [ run ] completed with state
|
834f267 to
1687d2e
Compare
|
/bot run --extra-stage "DGX_H100-PyTorch-Post-Merge-2" |
|
PR_Github #50223 [ run ] triggered by Bot. Commit: |
|
PR_Github #50223 [ run ] completed with state
|
|
/bot run --extra-stage "DGX_H100-PyTorch-Post-Merge-2" |
|
PR_Github #50259 [ run ] triggered by Bot. Commit: |
|
PR_Github #51283 [ run ] triggered by Bot. Commit: |
|
PR_Github #51283 [ run ] completed with state
|
|
/bot run --extra-stage "DGX_H100-PyTorch-Post-Merge-2" |
|
PR_Github #51300 [ run ] triggered by Bot. Commit: |
…ding for GLM/Exaone/Nemotron Signed-off-by: ZhaoyangWang <zhaoyangw@nvidia.com>
|
PR_Github #51300 [ run ] completed with state
|
…M/Exaone/Nemotron-H The MTPWorker vanilla runtime path (per-iter in-place shifts and shared attn_metadata across distinct MTP layers) hits a latent CUDA Graph IMA in warmup on GLM/Exaone/Nemotron-H when ModelLoader expands a single checkpoint MTP layer to multiple model MTP layer instances. The IMA is independent of the load-side fixes and reproduces even without expansion, so it lives in the worker itself, not in this PR. Reject the shared-weights expansion path upfront in Glm4MoeForCausalLM/ExaoneMoeForCausalLM/NemotronHForCausalLM with a clear NotImplementedError when `_ckpt_num_nextn_predict_layers` is set on the pretrained config (i.e. ModelLoader actually expanded). Eagle MTP and regular vanilla MTP (max_draft_len <= ckpt num_nextn_predict_layers) on these models, plus DeepSeek-V3 vanilla expansion, are unaffected. Also fix a pre-existing ConsumableWeightsDict incompatibility in ExaoneMoeWeightMapper.preprocess_weights: replace weights.pop(name) with explicit weights[new]=weights[name]+del weights[name] so HF loading of K-EXAONE no longer fails before reaching the model. Signed-off-by: ZhaoyangWang <zhaoyangw@nvidia.com>
…MTP only Drop the GLM/Exaone/Nemotron-H load-side extensions and runtime guards added in previous commits on this branch. The vanilla shared-weights runtime path (single ckpt MTP layer, max_draft_len > 1) was originally requested for DeepSeek-V3 and the test_fp8_block_scales[mtp=vanilla] CI case is the only end-to-end coverage we keep. The runtime path is not exercised in production on the other three model families, and local validation showed a latent IMA in MTPWorker's CUDA-graph warmup that is independent of the load-side fixes; making those models work end-to-end requires a separate runtime fix. Reverts (back to the Restore commit baseline): - modeling_glm.py: drop mark_consumed skip + has_shared_mtp_weights - modeling_exaone_moe.py: drop shared-weights vanilla guard - modeling_nemotron_h.py: drop shared-weights vanilla guard - exaone_moe_weight_mapper.py: drop modulo alias + ConsumableWeightsDict pop/setdefault compat - nemotron_h_weight_mapper.py: drop modulo alias - model_loader.py: drop 'or 1' fallback; restore strict gate on config-provided num_nextn_predict_layers Signed-off-by: ZhaoyangWang <zhaoyangw@nvidia.com>
…ers plumbing on GLM/Exaone/Nemotron-H These files only had Restore-commit plumbing (`getattr(_ckpt_num_nextn_predict_layers, None) or num_nextn_predict_layers`) that supports the shared-weights vanilla MTP expansion path. The PR scope is now DeepSeek-V3 only, so this plumbing is dead code on the other three model families -- and worse, if it accidentally activates (user sets use_mtp_vanilla=True + max_draft_len > 1) it would silently load wrong weights or hit the known MTPWorker runtime IMA. Revert these three files fully to main to keep the PR strictly DeepSeek-scoped. Signed-off-by: ZhaoyangWang <zhaoyangw@nvidia.com>
… model_types only
Gate the ModelLoader vanilla MTP expansion (max_draft_len > ckpt
num_nextn_predict_layers -> rewrite num_nextn_predict_layers + record
_ckpt_num_nextn_predict_layers) to {deepseek_v3, deepseek_v32,
glm_moe_dsa}. These are exactly the model_types whose MTP path goes
through DeepseekV3MTP + DeepseekV3WeightLoader, which is the only
weight loader that correctly handles shared-weights expansion.
For other MTP-capable models the expansion no longer fires; the
natural min(max_draft_len, ckpt_nextn) clamp in MTPForCausalLM keeps
the build size at ckpt count, so users effectively get up to
ckpt_nextn draft tokens.
Signed-off-by: ZhaoyangWang <zhaoyangw@nvidia.com>
…sion whitelist
glm_moe_dsa shares DeepseekV3's code path (registered as the same
ForCausalLM class), but it has not been end-to-end validated with the
shared-weights vanilla MTP expansion path. Keep the whitelist to the
DeepSeek model names only ({deepseek_v3, deepseek_v32}) to avoid
implying broader support than the CI case (DeepSeek-V3-Lite fp8 vanilla)
actually exercises.
Signed-off-by: ZhaoyangWang <zhaoyangw@nvidia.com>
…ghts expansion Update the comment block in ModelLoader to explain that the shared-weights vanilla MTP path is a very special mode that has not been used in any real-world workload to date and is only kept alive because DeepSeek indicated they want to support it for their model. That is why the expansion is whitelisted to DeepSeek model_types only; other MTP-capable model families do not need this mode and their vanilla MTP usage falls through to the natural clamp inside MTPForCausalLM. Signed-off-by: ZhaoyangWang <zhaoyangw@nvidia.com>
|
/bot run --extra-stage "DGX_H100-PyTorch-Post-Merge-2" |
1 similar comment
|
/bot run --extra-stage "DGX_H100-PyTorch-Post-Merge-2" |
|
PR_Github #51487 [ run ] triggered by Bot. Commit: |
|
PR_Github #51487 [ run ] completed with state
|
|
/bot run --extra-stage "DGX_H100-PyTorch-Post-Merge-2" |
|
PR_Github #51517 [ run ] triggered by Bot. Commit: |
|
PR_Github #51517 [ run ] completed with state
|
|
/bot run --extra-stage "DGX_H100-PyTorch-Post-Merge-2" |
1 similar comment
|
/bot run --extra-stage "DGX_H100-PyTorch-Post-Merge-2" |
|
PR_Github #51719 [ run ] triggered by Bot. Commit: |
|
PR_Github #51719 [ run ] completed with state |
The decoupling refactor (#12341) made num_nextn_predict_layers a checkpoint-only property and clamped max_draft_len to it for vanilla MTP. This silently dropped the shared-weights hack that lets vanilla run on single-MTP-layer checkpoints (e.g., DeepSeek-V3-Lite) with max_draft_len > ckpt MTP count, breaking the lone CI coverage of the vanilla path (TestDeepSeekV3Lite::test_fp8_block_scales[mtp=vanilla]).
Restore the hack by expanding pretrained_config.num_nextn_predict_layers to max_draft_len before model construction when use_mtp_vanilla=True, preserving the original checkpoint count as _ckpt_num_nextn_predict_layers for weight loader mod-indexing and FP8 exclude_modules duplication. Updates the affected modeling files (deepseekv3) to read ckpt_nextn from the preserved field, with a fallback to num_nextn_predict_layers when no expansion happened.
Remove the waive for the failing test.
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests
Description
The decoupling refactor (#12341) made
num_nextn_predict_layersacheckpoint-only property and clamped
max_draft_lento it for vanilla MTP.This silently dropped the "shared-weights" hack that lets a single-MTP-layer
checkpoint run vanilla MTP with
max_draft_len > ckpt MTP count, breaking theonly CI coverage of the path
(
TestDeepSeekV3Lite::test_fp8_block_scales[mtp=vanilla]).This shared-weights vanilla mode is a special MTP configuration: one
checkpoint MTP layer, run for multiple draft tokens, keeping a separate KV
cache per draft position — by sharing that single layer's weights across the
expanded layer instances. It is not used in any real-world workload today, but
DeepSeek indicated they want to keep the path alive for their model, so we
restore it and guard it with one CI test.
Test Coverage
TestDeepSeekV3Lite::test_fp8_block_scales[mtp=vanilla](verified on H200,sm_90 + CUTLASS MoE, same as CI H100).
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.