Skip to content

perf: Reduce MXFP8 refit weight-transfer overheads - #3294

Merged
terrykong merged 136 commits into
NVIDIA-NeMo:mainfrom
seonjinn:sna/pr-mxfp8-refit-optimization
Oct 18, 2026
Merged

terrykong merged 136 commits into
NVIDIA-NeMo:mainfrom
seonjinn:sna/pr-mxfp8-refit-optimization

Conversation

@seonjinn

@seonjinn seonjinn commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Reduce BF16-to-MXFP8 refit work for colocated synchronous RL by quantizing eligible Megatron weights before transfer. vLLM receives each E4M3 weight with its matching *_scale_from_checkpoint. Unsupported grouped layouts and incompatible refit configurations fail explicitly.

The path is opt-in via policy.generation.vllm_cfg.refit_prequantize. Qwen synchronous MXFP8 performance recipes enable it; asynchronous NCCL Reshard recipes leave it off.

Performance

Historical Qwen3-30B-A3B prequant-only A/B on 4 nodes / 16 GB200 GPUs (one 20-step job per variant, steps 3-19; control, prequant only):

Metric Off On Change
E2E step time 160.349 s 157.892 s -1.53%
Total refit 10.413 s 8.180 s -21.44%
Transfer + update 7.909 s 4.859 s -38.57%

These measurements predate the latest-main merge and current HEAD. They are directional, not a current-HEAD performance claim. A matched current-HEAD A/B remains outstanding.

Validation

  • OCI-HSG GB200: 275 focused vLLM, 20 MXFP8 prequantization, 33 recipe, and 3 targeted MCore tests passed.
  • Ruff lint and format checks passed for all 50 Python files changed by the PR.
  • A broader vLLM run had 288 passing tests and one external HF model-download error (HTTP 401, expired authentication). The focused offline vLLM suite above passed; the broader run did not pass overall.

@seonjinn
seonjinn requested review from a team as code owners July 20, 2026 19:32
@copy-pr-bot

copy-pr-bot Bot commented Jul 20, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@seonjinn seonjinn self-assigned this Jul 20, 2026
@seonjinn seonjinn changed the title perf: Reduce MXFP8 refit weight-transfer overheads (prequantize, persistent buffers, batched MoE shuffle) perf: Reduce MXFP8 refit weight-transfer overheads Jul 20, 2026
@seonjinn

Copy link
Copy Markdown
Contributor Author

Isolated-branch reproduction (follow-up promised in the PR body).

Setup: Qwen3-30B-A3B GRPO (OpenMathInstruct-2), 2 nodes x 8 B200, grpo-qwen3-30ba3b-4n4g-mxfp8-rollout.yaml, 20 steps, means over steps 3-20. Control = current main behavior (all flags off); treatment = this branch with refit_prequantize, persistent IPC buffers (4 GB), slim offload, cached loaders, pinned reference swap (batched shuffle is default-on). Same cluster, back-to-back runs.

steps 3-20 mean flags off (main) this PR delta
transfer_and_update_weights (s) 9.67 2.98 -69%
prepare_for_generation total (s) 17.2 13.1 -4.1 s
generation / logprob / training (s) 49.8 / 84.6 / 91.0 51.8 / 82.0 / 90.6 unchanged (noise)
total step (s) 256.3 250.9 -2.1%
train reward 0.528 0.529 =

The saving is confined to the refit phase, exactly as claimed; all compute phases and reward are untouched. NRL_MXFP8_SHUFFLE_VERIFY=1 bit-exact assert passed on first refit.

@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test 740c825

@seonjinn seonjinn added the CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) label Jul 21, 2026
@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test 3f60f5d

@seonjinn

Copy link
Copy Markdown
Contributor Author

Isolated reproduction at 235B scale (follow-up to the 30B numbers above).

Setup: Qwen3-235B-A22B GRPO, 8 nodes x 8 B200 (64 GPUs), grpo-qwen3-235b-16n4g-mxfp8-rollout.yaml, vLLM TP 8, 20 steps, means over steps 3-20. Control = same clean branch with all refit flags off; treatment = refit_prequantize + persistent IPC buffers + slim offload + cached loaders + pinned reference swap (batched shuffle default-on).

steps 3-20 mean flags off (main) this PR delta
transfer_and_update_weights (s) 21.8 7.4 -66%
prepare_for_generation total (s) 42.2 28.8 -13.4 s

The refit-transfer saving grows with model size (30B: 9.7 -> 3.0 s; 235B: 21.8 -> 7.4 s), because larger weights spend proportionally more of the refit in transport - exactly the phase this PR targets. Batched-shuffle bit-exact verify passed on first refit.

@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test 04af034

@seonjinn seonjinn added CI:L1 Run doctests, unit tests, and functional tests and removed CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) labels Jul 21, 2026
@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test e06f7a8

@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test 3ebdf9d

Reduce MXFP8 and ModelOpt refit overhead while preserving transport and checkpoint-engine lifecycle correctness.

Signed-off-by: sna <sna@nvidia.com>
@seonjinn
seonjinn force-pushed the sna/pr-mxfp8-refit-optimization branch from 3ebdf9d to b88aa2c Compare July 21, 2026 23:16
@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test b88aa2c

@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test 438e20d

@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test 96ba299

@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test 96ba299

@seonjinn
seonjinn requested a review from terrykong July 27, 2026 19:01
@seonjinn seonjinn added CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) and removed CI:L1 Run doctests, unit tests, and functional tests labels Jul 27, 2026
terrykong
terrykong previously approved these changes Oct 16, 2026
@terrykong
terrykong enabled auto-merge (squash) October 16, 2026 00:02
@seonjinn seonjinn added CI:L1 Run doctests, unit tests, and functional tests and removed CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) labels Oct 16, 2026
Signed-off-by: seonjinn <sna@nvidia.com>
Signed-off-by: seonjinn <sna@nvidia.com>
@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test f555a77

terrykong
terrykong previously approved these changes Oct 16, 2026
Signed-off-by: seonjinn <sna@nvidia.com>
Signed-off-by: seonjinn <sna@nvidia.com>
@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test d30a813

Signed-off-by: seonjinn <sna@nvidia.com>
@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test 5e451db

Signed-off-by: seonjinn <sna@nvidia.com>
@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test 7bc2096

ZhiyuLi-Nvidia
ZhiyuLi-Nvidia previously approved these changes Oct 18, 2026
Signed-off-by: seonjinn <sna@nvidia.com>
@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test ecb9aa0

Signed-off-by: seonjinn <sna@nvidia.com>
@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test 501b5d5

@copy-pr-bot

copy-pr-bot Bot commented Oct 18, 2026

Copy link
Copy Markdown

/ok to test 501b5d5

@seonjinn, there was an error processing your request: E2

See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/2/

@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test 501b5d5

Signed-off-by: seonjinn <sna@nvidia.com>
@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test b1a8060

@terrykong
terrykong merged commit c74be94 into NVIDIA-NeMo:main Oct 18, 2026
332 of 359 checks passed
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants