Stream optimizer main initialization to NVMe - #2653
Open
zianglih wants to merge 3 commits into
Open
Conversation
6 tasks
ziang-and
force-pushed
the
ziang/stream-optimizer-main-init
branch
from
August 20, 2026 23:23
078621b to
1697c45
Compare
zianglih
marked this pull request as ready for review
August 21, 2026 06:24
zianglih
requested review from
Shi-Dong,
Zhichenzzz,
fzyzcjy,
maocheng23,
yueming-yuan and
yushengsu-thu
as code owners
August 21, 2026 06:24
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.
Summary
@HumansAnd
ci-megatron-pr: #86
Extend
--stream-optimizer-state-to-diskto cover distributed-optimizer construction. Miles enables the paired Megatron deferred-main mode, then initializes FP32 mains one existing runtime bucket at a time directly in their final files.5dcbc1020a94ea973316163e8db6719886823e63.54f083eb0530e47fce951d2fba243c0d64038cb8.+89/-6; no addedtry,except, orfinallyblocks.Design
200,000,000-element soft bucket limit. A nominal FP32 main bucket is about 0.745 GiB; an indivisible parameter entry can make a bucket larger. This avoids per-parameter I/O while preventing accumulation of the full FP32 main state._bind.reload_model_paramsretains the existing implementation and still invokes Megatron's normal reload callback. This PR intentionally does not bucketize or otherwise change checkpoint/model reload.Validation
Exact-head public-image B300 tests
docker.io/radixark/miles:dev-202608210021@sha256:e2e25e4121c595d352933fab81ce05cc8fb2aef8c8478a16abc704b51e330003.2.11.0+cu130; CUDA13.0.54f083eb0530e47fce951d2fba243c0d64038cb8; Megatron5dcbc1020a94ea973316163e8db6719886823e63.PYTHONPATHcontained only the synced public Miles and Megatron source roots; both imports were asserted to resolve there. The image needed test-onlymock==5.2.0for the Megatron unit-test module.20260821T051726Z.tightened-clean.log, SHA-256511b5a047716f8618d75f9aff89d96a0e00b1929093f56906f2499f6e636b1c9.Commands:
Raw output:
The Miles test verifies exact BF16-to-FP32 bytes in the final file and zero CUDA backing storage after initialization. The Megatron test verifies stable model/optimizer tensor identity, logical shape, FP32 CUDA metadata, and zero backing storage.
Repository checks
At the exact heads above:
Whitespace-sensitive and whitespace-insensitive aggregate stats are identical. Formatter-only changes were removed instead of running file-wide formatters over upstream baseline drift.
Exact-head full-Miles four-node constructor validation
Run
20260821T060606Zexercised the production Miles initialization path at the exact heads above:miles/train.py --debug-train-only->RayTrainGroup-> 32MegatronTrainRayActor.initcalls ->initialize_model_and_optimizer-> paired deferred construction and NVMe initialization.docker.io/radixark/miles:dev-202608210021@sha256:e2e25e4121c595d352933fab81ce05cc8fb2aef8c8478a16abc704b51e330003; four C2 nodes; 32 NVIDIA B300 GPUs.54f083eb0530e47fce951d2fba243c0d64038cb8; Megatron5dcbc1020a94ea973316163e8db6719886823e63; harnessbbb6b2df9643b7a06ec44d3f0a1488677d4491d6.Reproduction:
cd /Users/ziangli/playground/projects/upstream-optimizer-main-init-streaming/public_miles_debug_train_glm5_pp1_streaming ./launch_c2.sh provision ./launch_c2.sh sync ./launch_c2.sh ray ./launch_c2.sh prepare ./launch_c2.sh runFinal gate object:
{ "status": "pass", "checks": { "ray_job_exit_zero": true, "no_timeout": true, "no_cuda_oom": true, "no_host_oom": true, "no_disk_full": true, "native_store_records_64": true, "native_initialization_records_64": true, "unique_store_paths_64": true, "unique_initialization_paths_64": true, "store_and_initialization_paths_match": true, "all_32_ranks_have_dense_and_expert_stores": true, "zero_optimizer_streaming_steps": true, "zero_training_iterations": true, "scoped_optimizer_cleanup_succeeded": true } }Artifact integrity:
This is an initialization-only production-Miles test:
--num-rollout 0deliberately produced no forward pass, optimizer step, training iteration, or checkpoint operation.Predecessor two-step GLM-5.2 scale evidence
Run
20260821T001150Zused the same direct-final, bucketwise initialization mechanism on a broader predecessor of this tightened diff: Miles1697c45ec3973376fdf7c0f0e3fa41aaf8f48682with Megatrond7f63a091dbe566c2fd8dfd7b7b34cb8821235c7.docker.io/radixark/miles:dev-202608200558@sha256:89d2278b083c32d4e794df27aa266cb085a74d0b0bce0b09eab05eddaa972322; four C2 nodes; 32 NVIDIA B300 GPUs.(rank, store, step)events completed; four launchers returned zero; no CUDA OOM, host OOM, ENOSPC, timeout, skipped iteration, or NaN.This scale run is evidence for the mechanism and dense/expert chain, not an exact-current-head run. The current tightened heads are covered by the focused public-image tests above; the removed code concerned checkpoint, path, lifecycle, validation, and failure handling rather than the successful constructor mechanism.
Limitations
torch_distsave/resume round trip.