Support bounded distributed-optimizer main initialization - #86
Merged
yueming-yuan merged 1 commit intoAug 31, 2026
Merged
Conversation
ziang-and
force-pushed
the
ziang/bounded-main-param-initialization
branch
from
August 20, 2026 23:23
0c35bad to
d7f63a0
Compare
zianglih
marked this pull request as ready for review
August 21, 2026 06:24
yueming-yuan
force-pushed
the
miles-main
branch
from
August 24, 2026 19:59
2e64d78 to
235952d
Compare
zianglih
force-pushed
the
ziang/bounded-main-param-initialization
branch
from
August 28, 2026 22:38
5dcbc10 to
c0dad03
Compare
yueming-yuan
approved these changes
Aug 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do ?
@HumansAnd
Add one opt-in constructor primitive for external optimizer-state backends: retain stable distributed-optimizer FP32 main-param tensor handles without retaining the cumulative FP32 main state in HBM.
OptimizerConfig.defer_main_param_initializationdefaults toFalse; the ordinary path still usesshard_model_param.clone().float().+47/-0.Paired Miles integration: radixark/miles#2653 at
ab760c086fde48c7c40b10030970008f6ee64e65.Validation
docker.io/radixark/miles:dev-202608301223; OCI indexsha256:22c82828fca9215e22c8493bfe53fba12ca2b63feb0e6343c052fc48f16e7d47; linux/amd64 manifestsha256:cb5beb813caa5aaaf47b144bc4fabe7b75cae1c1cf65bf7cac5b6840c5b110e3.590.48.01, PyTorch2.13.0+cu130, CUDA13.0, imageCUDA_VERSION=13.0.3. Focused GPU tests used GPU 0; each integration run used four GPUs.0401d4e3f2baf20855bd4ce821e20d4569664fbe; the submitted Miles head differs only by qualifying one documentation sentence, and all changed Python blobs are identical. The full Miles command prepends/root/Megatron-LM, so its two changed Megatron runtime files were overlaid on the exact image base; their hashes matched the synced Megatron head.Focused tests:
The Megatron test verifies stable model/optimizer tensor identity, nonzero logical shape, FP32 CUDA metadata, and zero backing storage. The Miles test verifies exact BF16-to-FP32 bytes after direct-final initialization and confirms the CUDA storage is released again.
The existing Miles Qwen3-4B disk-stream E2E then ran with TP2/PP1/CP1, four B300s, two rollouts/optimizer steps, colocated SGLang, disk train offload, and
--stream-optimizer-state-to-disk:Upstream's separate Muon E2E then passed as a control: Ray job
raysubmit_1DNkhNExcJ1nLigMsucceeded, all 4 ranks armed disk offload and logged four file-backed Muon state records, while all 4 recorded zero Adam NVMe main-init and streaming records. The direct dispatch probe agreed:Both jobs completed both steps normally. There was no CUDA OOM, host OOM, ENOSPC, invalid step, or Ray failure.
Repository checks at the submitted head:
Current-run boundaries: checkpoint conversion required an explicit loopback rendezvous because the C2 pod hostname was not resolvable; it then completed and both existing E2E execution paths ran unchanged. SGLang logged recovered post-warm-up
/freeze_gcconnection races before reporting ready. The run covered fresh load, initialization, two optimizer steps, offload/wake-up, and weight updates for Adam and Muon, but not checkpoint save/resume.Contribution process
flowchart LR A[Pre-checks] --> B[PR Tests] subgraph Code Review/Approval C1[Expert Review] --> C2[Final Review] end B --> C1 C2 --> D[Merge]Pre-checks
Core 0.8)Code review
The following process is enforced via the CODEOWNERS file for changes into
megatron/core. For changes outside ofmegatron/core, it is up to the PR author whether or not to tag the Final Reviewer team.For MRs into `main` branch
Feel free to message or comment the @mcore-oncall to help accelerate your merge into main. The less complex your PR is, the faster it will be approved and merged!
(Step 1): Add PR label
Expert Review(Step 2): Collect the expert reviewers reviews
Expert Reviewlabel when your PR is ready for review.Final Review might get declined if these requirements are not fulfilled.
(Step 3): Final Review
Final Reviewlabel(Optional Step 4): Cherry-pick into release branch
If this PR also needs to be merged into
core_r*release branches, after this PR has been merged, selectCherry-pickto open a new PR into the release branch.For MRs into `dev` branch
The proposed review process for `dev` branch is under active discussion.MRs are mergable after one approval by either
eharper@nvidia.comorzijiey@nvidia.com.Merging your PR
Any member of core-adlr and
core-nemowill be able to merge this PR.