(1/5) Add callback to sync weights before training begins#5319
Open
(1/5) Add callback to sync weights before training begins#5319
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
qgallouedec
reviewed
Mar 20, 2026
Member
qgallouedec
left a comment
There was a problem hiding this comment.
@albertvillanova curious to know if you think this is a good pattern
The rollout worker should start after initial weight synchronization, not at the beginning of the training loop. This ensures weights are properly synced before any rollout generation begins.
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?
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
Note
Medium Risk
Changes the training startup sequence by moving the first vLLM weight sync and rollout worker start into an
on_train_begincallback, which could affect distributed initialization/order and rollout generation timing.Overview
Ensures the vLLM rollout worker sees the correct policy weights before the first training step by adding
_InitialWeightSyncCallback, which runs a one-time_sync_weight()onon_train_begin, starts the rollout worker on the main process, and then unregisters itself.Removes the previous manual initial sync/start logic from
AsyncGRPOTrainer._inner_training_loop, keeping periodic weight syncing viaStepIntervalCallbackunchanged.Written by Cursor Bugbot for commit 4bf9211. This will update automatically on new commits. Configure here.