[None][fix] Resolve NVFP4 mixed-precision base layers for the DSpark draft - #16831
Conversation
…draft NVFP4 DeepSeek-V4 checkpoints declare a global MIXED_PRECISION quant algo (per-layer NVFP4 routed experts over an FP8 base). The target model resolves this base in _normalize_deepseek_v4_nvfp4_mixed_precision_config (MIXED_PRECISION -> FP8_BLOCK_SCALES; the routed experts stay NVFP4 through quant_config_dict). The DSpark draft model builds its ModelConfig separately (get_draft_model -> DSparkDraftModel._derive_draft_model_config) and never went through that normalization, so the inherited DeepseekV4DecoderLayer hit the "MIXED_PRECISION is ambiguous" assertion while building the draft stages and an NVFP4 DSpark checkpoint failed to load. Extend the same normalization to the draft: DSparkDraftModel now derives the resolved global quant_config by reusing the target normalizer on a throwaway shallow copy and sets it on the draft ModelConfig. The path is a strict no-op for checkpoints whose global algo is not MIXED_PRECISION (e.g. MXFP4) and for checkpoints the target normalizer leaves unchanged, so those draft configs stay byte-identical. Signed-off-by: tianyuz-nv <tianyuz@nvidia.com>
|
/bot run |
WalkthroughDSpark draft configuration derivation now supports NVFP4 checkpoints using global ChangesDSpark NVFP4 configuration
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tensorrt_llm/_torch/models/modeling_dspark.py`:
- Around line 516-539: Update _draft_normalized_quant_config with an explicit
type annotation for model_config and a return annotation covering both the
resolved quant configuration and None. Use the existing model configuration and
quant-config types from the module or project conventions, without changing the
helper’s behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: e87f6c35-bd5c-4ef7-8477-fa6aedc0faa0
📒 Files selected for processing (1)
tensorrt_llm/_torch/models/modeling_dspark.py
|
PR_Github #61531 [ run ] triggered by Bot. Commit: |
|
PR_Github #61531 [ run ] completed with state
|
|
/bot run |
|
PR_Github #61567 [ run ] triggered by Bot. Commit: |
|
PR_Github #61567 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #61580 [ run ] triggered by Bot. Commit: |
|
PR_Github #61580 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #61796 [ run ] triggered by Bot. Commit: |
|
PR_Github #61796 [ run ] completed with state |
…nnahz/dep-1083-port-flashinfer-stable-va-lifecycle-for-native-all-reduce * 'main' of https://github.com/NVIDIA/TensorRT-LLM: (54 commits) [NVIDIA#15673][fix] Enable CUDA core fast path for SM89/SM120/SM121 (NVIDIA#12705) [None][test] Adjust timeout cases in QA perf test (NVIDIA#16894) [https://nvbugs/6157892][fix] Mistral format refactor (NVIDIA#15123) [None][feat] Add kimi_k2/glm_5 grouped routing and fused router to bench_moe (NVIDIA#16830) [https://nvbugs/6501376][fix] Test-only fix — drop the `if hidden_size % 2 != 0: with pytest.raises(...)`… (NVIDIA#16844) [TRTLLM-13642][feat] Add perf sanity tests for Llama-3.1-8B and Gemma-3-1B and verify cache transceiver V2 support (NVIDIA#16355) [https://nvbugs/6433376][fix] Update the Dense test to mirror the MoE sibling — assert `bfloat16` under… (NVIDIA#16203) [None][fix] Resolve NVFP4 mixed-precision base layers for the DSpark draft (NVIDIA#16831) [https://nvbugs/6479324][test] Remove waiver for fixed qwen3_5_4b_fp8_stress disaggregated stress test (NVIDIA#16878) [https://nvbugs/6507109][infra] Split slow DGX B300 attention unit tests (NVIDIA#16838) [None][infra] Waive 21 failed cases for main in post-merge 2862 (NVIDIA#16882) [None][perf] prepare_inputs: avoid O(seq_len) get_tokens(0) marshalling on the host (NVIDIA#16791) [None][perf] Optimize Blackwell fused MHC half-MMA kernel (NVIDIA#16799) [None][infra] Auto-update test durations from OpenSearch (last 7 days) [None][perf] Skip DeepGEMM clean_logits in DSA indexer prefill on custom top-k path (NVIDIA#16789) [None][feat] Support DeepSeek-V4 in layer_wise_benchmarks (NVIDIA#16774) [https://nvbugs/6465993][fix] use attention cache dtype for disaggregated transfer (NVIDIA#16505) [https://nvbugs/6463822][fix] Fix LTX2 CUDA graph test leak issue (NVIDIA#16775) [https://nvbugs/5948435][chore] Unwaive DeepSeekV3Lite test_nvfp4_4gpus CUTLASS ep4 fp8kv on RTXPro6000D (NVIDIA#16621) [TRTLLM-14417][fix] Exclude ADP/cuda-graph dummy requests from speculative-decode acceptance stats (NVIDIA#16571) ... Signed-off-by: Hannah Zhang <hannahz@nvidia.com>
…nnahz/dep-1082-shared-mnnvl-moe-lifecycle * 'main' of https://github.com/NVIDIA/TensorRT-LLM: (142 commits) [NVIDIA#15673][fix] Enable CUDA core fast path for SM89/SM120/SM121 (NVIDIA#12705) [None][test] Adjust timeout cases in QA perf test (NVIDIA#16894) [https://nvbugs/6157892][fix] Mistral format refactor (NVIDIA#15123) [None][feat] Add kimi_k2/glm_5 grouped routing and fused router to bench_moe (NVIDIA#16830) [https://nvbugs/6501376][fix] Test-only fix — drop the `if hidden_size % 2 != 0: with pytest.raises(...)`… (NVIDIA#16844) [TRTLLM-13642][feat] Add perf sanity tests for Llama-3.1-8B and Gemma-3-1B and verify cache transceiver V2 support (NVIDIA#16355) [https://nvbugs/6433376][fix] Update the Dense test to mirror the MoE sibling — assert `bfloat16` under… (NVIDIA#16203) [None][fix] Resolve NVFP4 mixed-precision base layers for the DSpark draft (NVIDIA#16831) [https://nvbugs/6479324][test] Remove waiver for fixed qwen3_5_4b_fp8_stress disaggregated stress test (NVIDIA#16878) [https://nvbugs/6507109][infra] Split slow DGX B300 attention unit tests (NVIDIA#16838) [None][infra] Waive 21 failed cases for main in post-merge 2862 (NVIDIA#16882) [None][perf] prepare_inputs: avoid O(seq_len) get_tokens(0) marshalling on the host (NVIDIA#16791) [None][perf] Optimize Blackwell fused MHC half-MMA kernel (NVIDIA#16799) [None][infra] Auto-update test durations from OpenSearch (last 7 days) [None][perf] Skip DeepGEMM clean_logits in DSA indexer prefill on custom top-k path (NVIDIA#16789) [None][feat] Support DeepSeek-V4 in layer_wise_benchmarks (NVIDIA#16774) [https://nvbugs/6465993][fix] use attention cache dtype for disaggregated transfer (NVIDIA#16505) [https://nvbugs/6463822][fix] Fix LTX2 CUDA graph test leak issue (NVIDIA#16775) [https://nvbugs/5948435][chore] Unwaive DeepSeekV3Lite test_nvfp4_4gpus CUTLASS ep4 fp8kv on RTXPro6000D (NVIDIA#16621) [TRTLLM-14417][fix] Exclude ADP/cuda-graph dummy requests from speculative-decode acceptance stats (NVIDIA#16571) ... Signed-off-by: Hannah Zhang <hannahz@nvidia.com>
Dev Engineer Review
DSparkDraftModelto normalize globalMIXED_PRECISIONquantization using the target DeepSeek-V4 model’s normalizer.quant_configonly when normalization changes the configuration, preserving existing behavior for other checkpoints.QA Engineer Review
No test changes.
Description
NVFP4 DeepSeek-V4 checkpoints declare a global
MIXED_PRECISIONquant algo(per-layer NVFP4 routed experts over an FP8 base). The target model resolves
this base in
_normalize_deepseek_v4_nvfp4_mixed_precision_config(
MIXED_PRECISION→FP8_BLOCK_SCALES; the routed experts stay NVFP4 throughquant_config_dict).The DSpark draft model builds its
ModelConfigseparately(
get_draft_model→DSparkDraftModel._derive_draft_model_config) and neverwent through that normalization, so the inherited
DeepseekV4DecoderLayerhitsthe
MIXED_PRECISION is ambiguousassertion while building the draft stages andan NVFP4 DSpark checkpoint fails to load.
This PR extends the same normalization to the draft.
DSparkDraftModelnow derives the resolved global
quant_configvia a new_draft_normalized_quant_confighelper (reusing the target normalizer on athrowaway shallow copy) and sets it on the draft
ModelConfig. The path is astrict no-op for checkpoints whose global algo is not
MIXED_PRECISION(e.g. MXFP4) and for checkpoints the target normalizer leaves unchanged, so
those draft configs stay byte-identical.
Test Coverage
Validated end-to-end on
nvidia/DeepSeek-V4-Pro-nvfp4-DSpark(TP4/EP4): withthis change the draft model loads and DSpark speculative decoding runs a full
draft-length 1–7 acceptance sweep (GSM8K / HumanEval / MATH500, chat and
thinking) with no acceptance-length regression versus the MXFP4 checkpoint.
Without this change the same run aborts while building the draft stages with
MIXED_PRECISION is ambiguous.PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why.
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.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
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.