Skip to content

fix: prevent MiniMax-M2.7 recipe OOM - #4759

Merged
yuki-97 merged 1 commit into
r0.8.0from
larkz/fix-r080-minimax-m27-oom
Oct 17, 2026
Merged

yuki-97 merged 1 commit into
r0.8.0from
larkz/fix-r080-minimax-m27-oom

Conversation

@jQizhang

@jQizhang jQizhang commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The 8-node MiniMax-M2.7 recipe can exhaust H100 memory during AdamW's foreach update. With CP=8, rounding the full sequence to 64 tokens also does not guarantee the per-rank 64-token alignment required by HybridEP, causing its combine kernel to fail JIT compilation.

Changes

  • Set context parallelism to 8 to reduce per-rank activation memory.
  • Set both full-sequence padding and dynamic-batch sequence rounding to 512, preserving 64-token alignment after CP sharding.
  • Disable AdamW foreach updates to reduce optimizer-step temporary memory.

Only examples/configs/recipes/llm/grpo-minimax-m27-dapo-8n8g-automodel-ep64.yaml is changed.

Validation

  • Existing Slurm job 20333911 completed 23 training steps on 8 nodes / 64 H100 GPUs with these parallelism, alignment, and optimizer settings, using the nightly container and a local MiniMax-M2.7 checkpoint. The launcher exited 0 after the configured checkpoint deadline. W&B run.
  • Post-run evaluation of the saved W&B metrics with tests/check_metrics.py passed the existing 10-step gate: mean train/gen_kl_error over steps 1-10 was 0.009333862400490034 < 0.01. The test script and its threshold are unchanged. The original run did not execute the test harness or produce TensorBoard logs.
  • All LLM/VLM recipe minimize-check checks, resolved-config assertions, CP-local alignment checks for sequence lengths 1-10240, and git diff --check passed.

@jQizhang jQizhang added the CI:L1 Run doctests, unit tests, and functional tests label Oct 16, 2026
@copy-pr-bot

copy-pr-bot Bot commented Oct 16, 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.

@jQizhang

Copy link
Copy Markdown
Contributor Author

/ok to test 063353b

@jQizhang jQizhang 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 Oct 16, 2026
@jQizhang

Copy link
Copy Markdown
Contributor Author

/ok to test 063353b

@jQizhang jQizhang added the cherry-pick-to-main Opt in: cherry-pick this PR's commit from the release branch back into main label Oct 16, 2026
@jQizhang
jQizhang requested review from seonjinn and yuki-97 October 16, 2026 15:58

@yuki-97 yuki-97 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.

@jQizhang thanks for helping fix!

@yuki-97
yuki-97 merged commit c634f31 into r0.8.0 Oct 17, 2026
209 of 215 checks passed
@yuki-97
yuki-97 deleted the larkz/fix-r080-minimax-m27-oom branch October 17, 2026 08:06
joyang-nv added a commit that referenced this pull request Oct 20, 2026
…ment)

With torch AdamW the 8-node MiniMax-M2.7 recipe (EP=64, 3.57B params per rank)
keeps fp32 params, grads and both Adam moments: 53.7-54.2 GiB of resident
training state per GPU. #4759 made it fit with CP=8 and AdamW(foreach=False);
it completes, but peaks at 65.1 GiB allocated / 68.2 GiB reserved and logs
expandable-segment mapping failures (near-OOM, recovered) on the way.

Switch to TE FusedAdam with fp32 master weights stored as bf16 params plus
16-bit remainders, a bf16 first moment and an fp32 second moment. The second
moment stays fp32 because at beta2=0.999 a bf16 exp_avg_sq cannot decay
(per-step decay 0.1% < half a bf16 ulp). CP=8 and the 512-token alignment from
#4759 are kept.

Measured on the release recipe (main 8338530, 8x8 H100, 10 steps, same
container, one run per arm): resident state 40.4-40.8 GiB (-13.3), peak
allocated 54.2 GiB (-10.9; set by optimizer.step's fp32 copy of exp_avg),
peak reserved 62.1 GiB (-6.0), no mapping failures, mean step time -4.3%
(steps 2-4 and 6-9). All arms pass the gen_kl < 0.01 gate.

Signed-off-by: Jonas Yang <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-pick-to-main Opt in: cherry-pick this PR's commit from the release branch back into main CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants