Repository navigation
Conversation
Let Laminar own checkpoint finalization and publication while verl writes a native snapshot in a thread. Assisted-by: OpenAI Codex
tongyx361
marked this pull request as ready for review
November 25, 2026 21:55
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
Add opt-in asynchronous Megatron checkpoints to the Laminar trainer.
trainer.async_checkpoint=truestages a CPU snapshot and uses the shared verl writer to save it in a background thread. The trainer publishes the latest checkpoint after the actor and dispatcher saves complete and drains the final checkpoint at shutdown. Checkpoint frequency and Relay weight publication frequency are independent.This branch pins a published Laminar hooks revision with the shared writer. The upstream writer is under review in verl #8823. HF initialization support is tracked separately in verl #8821.
Validation
tests/*_on_cpu.pyin the locked environment, including 73 focused checkpoint, actor bootstrap (WORLDprocess-group prewarming underEP > 1), and launch-script regressions, plus GitHub ActionsPublic source checksandSecrets scan.TP1/PP1/CP4/EP8/DP2) with a 12-layer 128-expert slice ofQwen3-Coder-30B-A3B-Instructand mocked SWE trajectories, the final pinned build passed fullAsyncRLTrainer+AsyncMegatronActorWorker+RelayManager+RolloutDispatcherexecution withsave_freq=1,weight_publish_interval=4, andmax_actor_ckpt_to_keep=2: checkpoints saved every step (1..5) while Relay published onlyv0andv4, retention keptglobal_step_4andglobal_step_5,checkpoint:5drained beforeTracker.finish()at shutdown, and a fresh-processresume_mode=autorestart (steps 6..7) restored step 5 across all 8 ranks with exact sampled model/Adam/scheduler match, exactRolloutDispatcherprompt cursor continuity, Relay re-seeding atv5plusv6publication, and clean shutdown drain.TP1/PP1/CP8/EP8/DP2) runningQwen3-Coder-30B-A3B-Instructwith reconstructed historical sequence lengths and synthetic tokens (2 warm-up updates, 12 measured updates, 128 sequences per update,73,385,108non-padding tokens, and 1 save every 4 updates, each arm in a fresh Ray process group), no-save training compute averaged243.41 sper update (2920.90 stotal;2937.28 sprimary loop):Async saved
24.96 sof foreground checkpoint blocking per training update—an81.81%reduction relative to sync—and shortened the measured training loop by8.33%(3404.48 sto3120.81 s, reducing loop overhead vs. no-save from+15.91%to+6.25%). Foreground time includes staging (47.44 s), save-boundary pending-write waits (5.84 s), and in-loop retention (13.34 s). The terminal async drain (3.74 s) and terminal retention (12.36 s) were recorded outside the measured loop.On the same 16-H100 allocation and final pinned build, 16-rank cold restores passed in both directions in both directions—verl to Laminar (
62.88 s) and Laminar to verl (62.47 s)— with sampled model, Adam, and scheduler state matching across all 16 ranks followed by a real optimizer update for each restore.Usage
Before marking ready
save_freq=1, independent Relay publication, shutdown drain, and trainer/dispatcher restart.OpenAI Codex assisted with implementation, testing, and drafting.