Skip to content

feat(modelopt): support real NVFP4 QAT rollout for MoE and Mamba - #2983

Merged
terrykong merged 9 commits into
NVIDIA-NeMo:mainfrom
HollowMan6:real_quant
Jul 20, 2026
Merged

terrykong merged 9 commits into
NVIDIA-NeMo:mainfrom
HollowMan6:real_quant

Conversation

@HollowMan6

@HollowMan6 HollowMan6 commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do ?

Add ModelOpt NVFP4 real-quant vLLM reload support for W4A16 fused-MoE & w4a4 rollout weights.

Issues

List issues that this PR closes (syntax):

Summary

  • Add Nano3-specific/Qwen3 real-quant ignore profile so Mamba, attention, gates/routers, shared experts, norms, and selected sensitive layers stay in BF16.
  • Wire Megatron real-quant refit through export_hf_weights_modelopt(..., quant_mode="w4a16_nvfp4").
  • Add Nano3/Qwen3 W4A16 & W4A4 real-quant recipe.

Usage

Run the Nano3 W4A16 real-quant rollout recipe directly:

uv run --no-sync examples/run_grpo.py \
  --config examples/configs/recipes/llm/grpo-nanov3-30ba3b-4n4g-megatron-qa-nvfp4-w4a16-real.yaml

Or enable real-quant rollout on an existing Megatron + vLLM recipe:

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you run the unit tests and functional tests locally? Visit our Testing Guide for how to run tests
  • Did you add or update any necessary documentation? Visit our Document Development Guide for how to write, build and test the docs.

Additional Information

image image image image

@copy-pr-bot

copy-pr-bot Bot commented Jun 29, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@HollowMan6
HollowMan6 requested a review from mxinO June 29, 2026 03:01
@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Jun 29, 2026
@HollowMan6 HollowMan6 added CI:L1 Run doctests, unit tests, and functional tests Feature labels Jun 29, 2026
Comment thread nemo_rl/modelopt/utils.py Resolved
@HollowMan6
HollowMan6 requested a review from mxinO June 30, 2026 08:06
@HollowMan6
HollowMan6 marked this pull request as ready for review July 11, 2026 08:46
@HollowMan6
HollowMan6 requested a review from a team as a code owner July 11, 2026 08:46
Copilot AI review requested due to automatic review settings July 11, 2026 08:46
@HollowMan6
HollowMan6 requested review from a team as code owners July 11, 2026 08:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@NVIDIA-NeMo NVIDIA-NeMo deleted a comment from github-actions Bot Jul 13, 2026
@NVIDIA-NeMo NVIDIA-NeMo deleted a comment from github-actions Bot Jul 13, 2026
@NVIDIA-NeMo NVIDIA-NeMo deleted a comment from github-actions Bot Jul 13, 2026
@NVIDIA-NeMo NVIDIA-NeMo deleted a comment from github-actions Bot Jul 13, 2026
@NVIDIA-NeMo NVIDIA-NeMo deleted a comment from github-actions Bot Jul 13, 2026
@NVIDIA-NeMo NVIDIA-NeMo deleted a comment from github-actions Bot Jul 13, 2026
@NVIDIA-NeMo NVIDIA-NeMo deleted a comment from github-actions Bot Jul 13, 2026
@NVIDIA-NeMo NVIDIA-NeMo deleted a comment from github-actions Bot Jul 13, 2026
@NVIDIA-NeMo NVIDIA-NeMo deleted a comment from copy-pr-bot Bot Jul 13, 2026
@copy-pr-bot

copy-pr-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@NVIDIA-NeMo NVIDIA-NeMo deleted a comment from cursor Bot Jul 19, 2026
@NVIDIA-NeMo NVIDIA-NeMo deleted a comment from github-actions Bot Jul 19, 2026
@NVIDIA-NeMo NVIDIA-NeMo deleted a comment from cursor Bot Jul 19, 2026
@NVIDIA-NeMo NVIDIA-NeMo deleted a comment from github-actions Bot Jul 19, 2026
@HollowMan6

Copy link
Copy Markdown
Contributor Author

/ok to test 81c44aa

@github-actions

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: 81c44aa (PR #2983 from real_quant)

✅ Submodules that are properly updated:

Megatron-Bridge: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

sharonyu-115 added a commit to sharonyu-115/RL that referenced this pull request Jul 19, 2026
…/rollout, no ModelOpt

Follows the fp8-rollout pattern (base MegatronPolicyWorker) rather than the
QAT worker: TE fp4_cfg training, quantize-at-export via a new Bridge
export_hf_weights_nvfp4 with a pluggable producer, and a neutral
nvfp4_pertoken vLLM module graduated from the probe overlay. Reuses the
bridge conversion machinery, NVIDIA-NeMo#2983's transport (factored), and the probe's
tests/thresholds; explicitly excludes all ModelOpt QAT plumbing.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Shuang Yu <[email protected]>
@zhangyimi

Copy link
Copy Markdown
Contributor

I reviewed the W4A4-related changes, and the implementation looks good to me. The training curves also look healthy. LGTM aside from the one remaining comment.

@NVIDIA-NeMo NVIDIA-NeMo deleted a comment from cursor Bot Jul 19, 2026
@github-actions

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: 66c5545 (PR #2983 from real_quant)

✅ Submodules that are properly updated:

Megatron-Bridge: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

@NVIDIA-NeMo NVIDIA-NeMo deleted a comment from cursor Bot Jul 20, 2026
@NVIDIA-NeMo NVIDIA-NeMo deleted a comment from github-actions Bot Jul 20, 2026
@HollowMan6
HollowMan6 requested a review from zhangyimi July 20, 2026 06:50
@HollowMan6

Copy link
Copy Markdown
Contributor Author

/ok to test 66c5545

@terrykong
terrykong merged commit ec46ab3 into NVIDIA-NeMo:main Jul 20, 2026
94 checks passed
@HollowMan6
HollowMan6 deleted the real_quant branch July 20, 2026 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:L1 Run doctests, unit tests, and functional tests Documentation Improvements or additions to documentation Feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support QAT for low precision RL

5 participants