Skip to content

fix: validate NVFP4 rollout and centralize refit compatibility - #5

Merged
zhangyimi merged 5 commits into
zhangyimi:codex/nvfp4-pertoken-draft-main-20260805from
sharonyu-115:codex/pr3566-review-fixes-20260916
Sep 17, 2026
Merged

zhangyimi merged 5 commits into
zhangyimi:codex/nvfp4-pertoken-draft-main-20260805from
sharonyu-115:codex/pr3566-review-fixes-20260916

Conversation

@sharonyu-115

@sharonyu-115 sharonyu-115 commented Sep 17, 2026 •

Copy link
Copy Markdown

NVFP4 per-token rollout can inherit unintended module precision, accept unsupported settings, and use different fast-math settings in the main and nightly recipes. This helper PR validates the precision contract, rejects unsupported configurations early, aligns the recipes, and documents the precision options in the exemplar. It also centralizes the ModelOpt MoE refit alias workaround so its implementation and compatibility tests can be reviewed with the other vLLM patches. It targets the source branch of NVIDIA-NeMo#3566.

  • Precision contract (review #3, #4): add a final BF16 catch-all and validate effective training/evaluation precision using Megatron's native recipe parser. Require RHT and 2D quantization to be disabled, generate the required-env error text from the settings, and document why stochastic rounding is optional with dequantized backward.

  • Unsupported configurations (#5, #6): reject vLLM PP>1 for either engine mode until refit handles foreign-stage expert weights. Add an explicit SingleController rejection: its vLLM path requires non-colocated rollout, while this mode requires colocation. Training PP and rollout TP are unaffected.

  • Defaults and entry points (#12, #13): compare copied BF16 boundary defaults with Megatron in tests, read the instantiated trainer fields directly, and pass entry_point="grpo" explicitly.

  • Engine settings (#16): reject the explicit top-level FlashInfer autotune setting with an actionable error; keep nested false accepted. Update the documented topology limits.

  • Recipes and exemplar (#8, #10): align both FP4 fast-math environment variables in the quick recipe with the main recipe. Add disabled FP4 and BF16 boundary settings to the GRPO exemplar and its reference twin. Both NVFP4 recipes inherit fp4: e2m1, retain explicit FP4 enablement, and preserve their 2/4 BF16 boundary counts.

  • Nightly timeout (#9): retain 90 minutes. Historical job 2758997 completed in 20m 14s on earlier commit 3a1289911; it does not establish fully cold-start timing.

  • Tests and cleanup (#11, #14, #15): strengthen the DeepSeek fixture to distinguish its full mapper from generic fallback and detect double mapping; rename the per-token ignore constant to DEFAULT_NVFP4_PERTOKEN_IGNORE; remove the overwritten async test config assignment. ModelOpt defaults and production mapping behavior are unchanged.

  • ModelOpt refit compatibility (#17): move temporary MoE quantizer alias creation and cleanup into patches.py:modelopt_moe_amax_aliases. The backend invokes it only during refit. Preserve existing attributes and support nested/repeated use and cleanup after partial setup failures. Correct the explanation to identify NemotronHModel.load_weights as the loader removed in vLLM 0.26. Tests now call the installed vLLM loader and mapping builder instead of copying their lookup logic. Shared version enforcement, including the routed-experts capture patch, and the repository-wide executor redesign remain in #4155, using the deferral offered in review.

Validation: 441 tests passed: 252 Megatron setup tests, 109 SingleController setup tests, and 80 selected NVFP4 generation/refit tests. Slurm jobs 2842720 and 2842754; the SingleController suite required HF_HOME to resolve recipe paths. Ruff 0.9.9 lint/import-order/format checks and git diff --check passed; the first commit's two recipe minimize-check checks also passed.

Tests use the existing nemo-rl-pr3566-te218-pypi-2026-09-07-v2.sqsh container, which differs from the current PR's dependency fingerprint, including Megatron-Bridge. The new end-to-end attempt described below failed before training; no fresh runtime or metric result is claimed. Pyrefly's SingleController configuration check reports one pre-existing missing-attribute error on the unchanged checkpoint lookup (config.py:1256); a complete checkout of parent commit b26308a86 reproduces the same error at line 1241 (job 2842804).

Recipe-group validation on commit 6911767d73f716c012b13253b3b7d598b432a1dd: 31 tests passed across test_config_v2.py and test_recipes_and_test_suites.py (Slurm 2842965). Repository-wide recipe minimize-check, expanded-config precision/flag checks for both NVFP4 recipes, and git diff --check passed.

Fresh 4-node GB200, 20-step nightly attempt: Slurm job 2842976 failed before training (1m 26s) because the code snapshot lacked 3rdparty/Automodel-workspace/Automodel, causing uv package-metadata generation to fail. It produced no fresh training metrics or evidence about the 90-minute timeout; the runtime validation remains outstanding. The attempt used the existing TE 2.18 baked image and shared Hugging Face cache, with W&B disabled. No metric thresholds or timeout were changed.

Test/cleanup validation on commit 0d23145c659c7127a42114b826380b742af2b326: 84 tests passed (80 NVFP4 generation/refit tests, 2 mapping tests, 2 sparse-refit post-init tests; Slurm jobs 2843152 and 2843161). An in-memory mutation harness confirmed the strengthened DeepSeek test fails at its exact-path assertion when the full mapper is bypassed and when generic mapping is applied afterward; the unchanged production resolver passes. Ruff 0.9.9 lint/import-order/format checks and git diff --check passed. Pyrefly 0.24.2 reports zero errors on the two modified production modules (3 ignored diagnostics). Validation uses the same existing container and dependency-fingerprint caveat noted above.

Patch-centralization validation on commit 12e5f9c93b1a29a1e07f63ce4730f40237b03086: 105 tests passed, 1 skipped (25 patch tests and 80 ModelOpt backend tests; Slurm job 2843595). The installed-loader test uses vLLM 0.26.0 with disposable CPU buffers, verifies the missing-attribute failure without aliases, and confirms correct w13/w2 maximum merging with aliases. The existing fake-quant worker inheritance test was skipped because this worker environment lacks modelopt.torch.quantization.calib; ModelOpt backend tests use their existing stubs. Ruff 0.9.9 lint/import-order/format checks and git diff --check passed. Pyrefly 0.24.2 reports zero errors and zero ignored diagnostics for patches.py, which also imports directly without loading torch, vLLM, or ModelOpt. This uses the same existing container and dependency limitations noted above; it is not a new end-to-end training run.

Review replies on the original PR remain pending and unsubmitted. This helper PR does not change review-thread resolution states.

@sharonyu-115 sharonyu-115 changed the title fix: enforce TE per-token precision contract fix: validate TE NVFP4 precision and rollout configuration Sep 17, 2026
@sharonyu-115 sharonyu-115 changed the title fix: validate TE NVFP4 precision and rollout configuration fix: validate NVFP4 rollout and centralize refit compatibility Sep 17, 2026
@zhangyimi
zhangyimi merged commit a65a4e9 into zhangyimi:codex/nvfp4-pertoken-draft-main-20260805 Sep 17, 2026
sharonyu-115 pushed a commit that referenced this pull request Sep 17, 2026
…60916

fix: validate NVFP4 rollout and centralize refit compatibility
sharonyu-115 pushed a commit that referenced this pull request Sep 18, 2026
…60916

fix: validate NVFP4 rollout and centralize refit compatibility
sharonyu-115 pushed a commit that referenced this pull request Sep 18, 2026
…60916

fix: validate NVFP4 rollout and centralize refit compatibility
sharonyu-115 pushed a commit that referenced this pull request Sep 19, 2026
…60916

fix: validate NVFP4 rollout and centralize refit compatibility
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.

2 participants