Skip to content

fix(refit): release trainer memory before collective export - #3984

Open
seonjinn wants to merge 2 commits into
NVIDIA-NeMo:mainfrom
seonjinn:fix/qwen35-mxfp8-refit-memory-20260903
Open

fix(refit): release trainer memory before collective export#3984
seonjinn wants to merge 2 commits into
NVIDIA-NeMo:mainfrom
seonjinn:fix/qwen35-mxfp8-refit-memory-20260903

Conversation

@seonjinn

@seonjinn seonjinn commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

What does this PR do ?

Adds an opt-in trainer-memory release before default non-colocated vLLM collective refit. This avoids large MXFP8 exports, including Qwen3.5 397B, competing with completed gradient buffers, optimizer state, and Transformer Engine workspaces for trainer GPU memory.

The implementation reuses policy.offload_before_refit(), supports GRPO and distillation, preserves the existing path by default, and rejects unsupported backend, topology, and transport combinations.

Issues

N/A

Usage

policy:
  release_grads_before_refit: true
  offload_optimizer_for_refit: true
  megatron_cfg:
    fp8_cfg:
      enabled: true
      force_clear_fp8_caches: true
  generation:
    backend: vllm
    colocated:
      enabled: false
    refit_transport: null

Before your PR is "Ready for review"

Pre checks:

  • Read and followed the contributor guidelines.
  • Added focused unit coverage for configuration, routing, and refit ordering.
  • Run the full unit and functional suites locally. The project lockfile supports Linux only; focused lifecycle checks, Ruff, Pyrefly, compile, and YAML/reference validation passed on macOS.
  • Updated the refit guide and exemplar/reference configurations.

Additional Information

The option is disabled by default. It is supported for Megatron policy training with default non-colocated vLLM NCCL collective refit.

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

copy-pr-bot Bot commented Sep 3, 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.

@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Sep 3, 2026
@seonjinn
seonjinn requested a review from jepio September 3, 2026 21:31
@seonjinn
seonjinn marked this pull request as ready for review September 3, 2026 22:01
@seonjinn
seonjinn requested review from a team as code owners September 3, 2026 22:01
@copy-pr-bot

copy-pr-bot Bot commented Sep 3, 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.

@seonjinn seonjinn changed the title fix(refit): avoid Qwen3.5 397B MXFP8 export OOM fix(refit): release trainer memory before collective export Sep 3, 2026
@seonjinn seonjinn added the CI:L1 Run doctests, unit tests, and functional tests label Sep 3, 2026
@seonjinn

seonjinn commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test ca43e3d

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

seonjinn commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 32b0467

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.

1 participant