Repository navigation
[#20969][fix] Qwen3.5/3.8: default dense NVFP4 checkpoints to Marlin on Ada/Hopper - #21434
Conversation
Dense Qwen3.5/3.6/3.8 text and VL models inherit the Qwen3-Next defaults, so NVFP4 and mixed-precision checkpoints keep the default W4A4 backends on SM89-99, where the CUTLASS FP4 GEMM is unsupported. Apply the nvfp4_gemm_config Marlin default that the MoE classes already get. Signed-off-by: Han-Yin Chang <[email protected]>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Dense model defaults and VLM wiring tensorrt_llm/_torch/models/modeling_qwen3_5.py |
Shared helpers apply dense NVFP4 Marlin defaults when the algorithm and SM support them. MoE defaults extend the dense defaults with the Marlin MoE backend. The dense causal-LM and shared VLM wrapper return the dense defaults. |
Default and checkpoint coverage tests/unittest/_torch/modeling/test_modeling_qwen3_5_vl.py |
CPU tests cover quantization and SM combinations, preservation of explicitly configured GEMM backends, and HF quant-config checkpoint loading. |
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested reviewers: moraxu
Merge Risk: 
Minimal · up to c5e82
-
Supported Qwen3.5-family NVFP4 checkpoints now default to Marlin; no merge-blocking risk was established.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Linked Issues check
-
Explanation
Directly linked issue
#20969is the only active target. Its coding requirement: dense Qwen3.5-family NVFP4 and MIXED_PRECISION checkpoints on SM89-99 must use Marlin for NVFP4 linears by default, matching the MoE behavior from#17293.Code at the reviewed head (tensorrt_llm/_torch/models/modeling_qwen3_5.py):
- New
_use_nvfp4_marlinapplies the same quant-algo andis_nvfp4_marlin_supported_smcondition that the MoE helper used before. - New
_get_qwen35_dense_model_defaultssetsnvfp4_gemm_config = {"allowed_backends": ["marlin"]}when that condition holds. It does not setmoe_config. - New
Qwen3_5ForCausalLM.get_model_defaultsreturns the dense helper output. This covers the dense text class. _Qwen3_5VLModel.get_model_defaultsnow returns the dense helper output. This coversQwen3_5VLModel, which the issue reports as the resolved class for RadixArk/Qwen3.8-27B-NVFP4._get_qwen35_moe_model_defaultscalls the dense helper and addsmoe_config = {"backend": "MARLIN"}under the same condition. MoE output is unchanged.
Tests at the reviewed head (tests/unittest/_torch/modeling/test_modeling_qwen3_5_vl.py) cover: default selection by quant algo and SM for both dense classes; preservation of a user-set
allowed_backends; and a synthetic NVFP4 and MIXED_PRECISION checkpoint loaded throughModelLoaderwith SM patched to 90. The H200 run and GSM8K score are author-reported. I did not run them. Not verified: GPU behavior on H100, Ada, Blackwell, and the nvidia/ and Inferact/ checkpoints. The issue marks those as not run, and the code path does not depend on them.No unmet coding requirement found. The issue's non-coding items and the related PR
#12591and bug#20965are not requested outcomes. - New
Full details: Out of Scope Changes check
-
Explanation
All changes at the reviewed head relate to the
#20969objective.- The modeling change refactors the NVFP4 Marlin condition into
_use_nvfp4_marlin. It adds the dense helper and the denseget_model_defaultsoverride. It repoints_Qwen3_5VLModel.get_model_defaultsto the dense helper. These changes implement the requirement directly. - The MoE helper now calls the dense helper and adds only the
moe_configbackend. Its effective output matches the prior MoE helper for every input, so the refactor does not change MoE behavior. - The VLM wrapper change does not reach
Qwen3_5MoeVLModel. Before this PR, the base wrapper returned Qwen3-Next defaults with no MARLIN MoE backend. The unchangedtest_qwen35_moe_model_defaultsexpects MARLIN forQwen3_5MoeVLModel, so that class must overrideget_model_defaults. This is inferred from the existing test. I did not read the MoE class body to confirm it. - The test changes add coverage for the dense defaults, explicit-backend preservation, and checkpoint loading. They support the objective and contain no unrelated changes.
No change was found that falls outside the issue scope.
- The modeling change refactors the NVFP4 Marlin condition into
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 6 functions across 2 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
|
Automatically added "ci: full pre-merge approved" because this PR has satisfied the required GitHub review approvals. Unresolved review conversations and other required checks remain independent merge requirements. |
|
/bot run |
|
PR_Github #83122 [ run ] triggered by Bot. Commit: |
|
PR_Github #83122 [ run ] completed with state |
…in's Qwen3.5-VL test Main renamed _construct_checkpoint_loader to construct_checkpoint_loader (NVIDIA#20703), while NVIDIA#21434 added a Qwen3.5-VL test that still imports the old name, so the whole test module fails to import. The pre-merge H100 stage runs it, and an x86 single-GPU failure keeps the x86 multi-GPU stages from running. The renamed helper takes the same keyword arguments. Signed-off-by: ziyixiong-nv <[email protected]>
…in's Qwen3.5-VL test Main renamed _construct_checkpoint_loader to construct_checkpoint_loader (NVIDIA#20703), while NVIDIA#21434 added a Qwen3.5-VL test that still imports the old name, so the whole test module fails to import. The pre-merge H100 stage runs it, and an x86 single-GPU failure keeps the x86 multi-GPU stages from running. The renamed helper takes the same keyword arguments. Signed-off-by: ziyixiong-nv <[email protected]>
…loader NVIDIA#20703 renamed _construct_checkpoint_loader; NVIDIA#21434 still imported the old name, so every unittest/_torch/modeling run failed collection on main. Signed-off-by: Zhenhuan Chen <[email protected]>
Description
Fixes #20969: with default settings,
RadixArk/Qwen3.8-27B-NVFP4loads its weights on H200 and then fails at warmup withArch unsupported for CUTLASS FP4 GEMM. The same defaults apply to every dense Qwen3.5-family NVFP4 or MIXED_PRECISION checkpoint on SM89-99.#17293 gave the Qwen3.5 MoE classes
nvfp4_gemm_config.allowed_backends = ["marlin"]on SM89-99 for NVFP4 / MIXED_PRECISION checkpoints. The denseQwen3_5ForCausalLMand the VLM wrapper_Qwen3_5VLModelstill return the Qwen3-Next defaults, so their NVFP4 linears keep the W4A4 backends that need Blackwell.This PR splits the helper.
_get_qwen35_dense_model_defaultssets the Marlin linear default under the same condition as #17293; the MoE helper calls it and addsmoe_config.backend = "MARLIN", so MoE defaults are unchanged. The two dense classes use the dense helper. Other quant algos, Blackwell and a user-setallowed_backendsare unchanged.On 1x H200 (
1.4.0rc1.dev202610201007container,trtllm-serve, TP 1, the reproduction in #20969), with the container'smodeling_qwen3_5.pyreplaced by a copy with this change applied, and no backend setting in the config: the server starts, the NVFP4 linears runMarlinNVFP4LinearMethod, and a small client script scores 92/100 on the first 100 GSM8K test questions (5-shot chat, greedy); in the same job, the same command without the change fails as above.Not run: H100, Ada, Blackwell, TP > 1, image or video inputs, the
nvidia/andInferact/checkpoints on GPU (config files only), accuracy against a BF16 baseline, and the tests on a full checkout of current main with and without this PR.Test Coverage
tests/unittest/_torch/modeling/test_modeling_qwen3_5_vl.py::test_qwen35_dense_model_defaults(new): NVFP4 on SM89/SM90 and MIXED_PRECISION on SM90 get["marlin"]; FP8 on SM90, NVFP4 on SM100 and MIXED_PRECISION on SM120 keep the default; both dense classes....::test_qwen35_dense_model_defaults_keep_explicit_backends(new): a user-setallowed_backendsis kept....::test_qwen38_nvfp4_checkpoint_load_applies_hopper_defaults(new): a synthetic 2-layer checkpoint with anhf_quant_config.jsoncut from the RadixArk (MIXED_PRECISION) and Inferact (NVFP4) checkpoints, loaded throughModelLoaderwith SM patched to 90, gets["marlin"]; a user-set value is kept.tests/unittest/_torch/modeling/test_modeling_qwen3_5_vl_moe.py::test_qwen35_moe_model_defaults(existing) still passes.On CPU (SM monkeypatched,
release:1.4.0rc3.dev202611010007container, whosemodeling_qwen3_5.pyis main's before #20815, which changed other methods of that file): without the change, the 5 cases that expect["marlin"]by default fail and the 9 that check unchanged behaviour pass; with it, all 14 pass.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.Dev Engineer Review
allowed_backends.QA Engineer Review
tests/unittest/_torch/modeling/test_modeling_qwen3_5_vl.py. Added CPU tests for dense and VLM defaults across quantization algorithms and SM versions, explicit backend preservation, and Qwen3.8 NVFP4 checkpoint defaults. The reported test set includestest_qwen35_dense_model_defaults,test_qwen35_dense_model_defaults_keep_explicit_backends,test_qwen38_nvfp4_checkpoint_load_applies_hopper_defaults, and the existingtest_qwen35_moe_model_defaults.Per-File QA Perspective
tensorrt_llm/_torch/models/modeling_qwen3_5.py: Verify that dense text and VLM defaults select Marlin for NVFP4 and MIXED_PRECISION only on supported SMs, and preserve explicit backends. Verify that MoE defaults retain their existing MoE backend.tests/unittest/_torch/modeling/test_modeling_qwen3_5_vl.py: Covers dense/VLM defaults, explicit backend preservation, checkpoint quantization configuration, and Hopper defaults. This is a unit-test file, not an integration test-list entry.