Skip to content

[None][fix] Fix nemotron-h quant and loading config#16833

Open
Wanli-Jiang wants to merge 2 commits into
NVIDIA:mainfrom
Wanli-Jiang:user/williamj/check-nano35-main
Open

[None][fix] Fix nemotron-h quant and loading config#16833
Wanli-Jiang wants to merge 2 commits into
NVIDIA:mainfrom
Wanli-Jiang:user/williamj/check-nano35-main

Conversation

@Wanli-Jiang

@Wanli-Jiang Wanli-Jiang commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Dev Engineer Review

  • Updated Nemotron-H Mamba in_proj scale splitting to detect the full NVFP4 quantization family via has_nvfp4(), covering variants such as W4A16_NVFP4 and W4A8_NVFP4_FP8.
  • Centralized lm_head quantization resolution in _resolve_lm_head_quant_config, preserving exclusion, tied-embedding, and TP-in-ADP compatibility guards while enabling global quantization configuration for homogeneous checkpoints.
  • No configuration-file or test-list changes were identified.

QA Engineer Review

No test changes.

Description

Test Coverage

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-compatible or api-breaking. For api-breaking, include BREAKING in 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.

…ckpoints

DecoderModelForCausalLM only resolved the lm_head quant entry from the
per-layer quant_config_dict (MIXED_PRECISION checkpoints). A homogeneous
checkpoint with a single global quant_algo that quantizes lm_head (and
does not exclude it) built lm_head unquantized, so loading its packed
NVFP4 weight failed with a shape mismatch (e.g. Nemotron-Nano-3.5 NVFP4:
'size of tensor a (2688) must match tensor b (1344)').

Resolve lm_head_quant_config from config.quant_config when
quant_config_dict is None and the global config quantizes, and share the
exclude_modules / tie_word_embeddings / lm-head-TP-in-ADP guards across
both sources. No-op for existing models: the MIXED_PRECISION path is
unchanged, and homogeneous checkpoints that keep lm_head in FP16 list it
in exclude_modules, so the exclude guard keeps it unquantized as before.

Verified on Nemotron-Nano-3.5 NVFP4 (W4A16_NVFP4 + FP8 KV) on H100:
single-GPU and 4-GPU attention-DP + EP now load and generate coherently
(with and without MTP).

Signed-off-by: Wanli Jiang <35160485+Wanli-Jiang@users.noreply.github.com>
NemotronHHfWeightMapper gated the structural (z/x/B/C/dt) TP split of the
mamba in_proj block scales on quant_algo == "NVFP4", which misses
W4A16_NVFP4 (and W4A8_NVFP4_FP8). For those checkpoints the packed
in_proj weight was TP-split structurally but its group scales were passed
through and even-split by the base loader, so weight and scale ended up
misaligned and TP>1 produced garbage (TP1 / attention-DP use tp_size=1,
so the split is identity and were unaffected).

Use quant_config.quant_mode.has_nvfp4() so all NVFP4 variants take the
structural scale split.

Verified on Nemotron-Nano-3.5 NVFP4 (W4A16_NVFP4 + FP8 KV) on 4x H100:
TP4 and TEP4 (with and without MTP) now generate coherently; previously
all produced garbage.

Signed-off-by: Wanli Jiang <35160485+Wanli-Jiang@users.noreply.github.com>
@Wanli-Jiang
Wanli-Jiang requested a review from a team as a code owner July 24, 2026 08:41
@Wanli-Jiang
Wanli-Jiang requested a review from nv-guomingz July 24, 2026 08:41
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: c61e2443-71b5-41a2-87d2-6033c1c904c9

📥 Commits

Reviewing files that changed from the base of the PR and between 75b39d4 and d8b4bb6.

📒 Files selected for processing (2)
  • tensorrt_llm/_torch/models/checkpoints/hf/nemotron_h_weight_mapper.py
  • tensorrt_llm/_torch/models/modeling_utils.py

Walkthrough

Updates NVFP4 detection to cover the full NVFP4 family and extracts decoder lm_head quantization selection into a reusable resolver used during model initialization.

Changes

Quantization updates

Layer / File(s) Summary
NVFP4 family detection
tensorrt_llm/_torch/models/checkpoints/hf/nemotron_h_weight_mapper.py
Uses quant_mode.has_nvfp4() to handle NVFP4 variants during mamba2 scale processing.
lm_head quantization resolution
tensorrt_llm/_torch/models/modeling_utils.py
Adds _resolve_lm_head_quant_config for checkpoint, exclusion, tied-embedding, and TP-in-ADP decisions, then uses it when constructing the lm_head.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: nv-guomingz

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description keeps the template but leaves the Description and Test Coverage sections empty, so the rationale and validation are missing. Fill in the issue and solution under Description and list the relevant tests or verification steps under Test Coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title follows the required ticket/type format and accurately summarizes the Nemotron-H quantization/config fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@Wanli-Jiang

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61545 [ run ] triggered by Bot. Commit: d8b4bb6 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61545 [ run ] completed with state SUCCESS. Commit: d8b4bb6
/LLM/main/L0_MergeRequest_PR pipeline #49757 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@Wanli-Jiang

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61572 [ run ] triggered by Bot. Commit: d8b4bb6 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61572 [ run ] completed with state SUCCESS. Commit: d8b4bb6
/LLM/main/L0_MergeRequest_PR pipeline #49783 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants