[rl] Remove call to get_model_state_dict in push_model_state_dict#3066
Merged
daniellepintz merged 1 commit intomainfrom Apr 23, 2026
Merged
[rl] Remove call to get_model_state_dict in push_model_state_dict#3066daniellepintz merged 1 commit intomainfrom
daniellepintz merged 1 commit intomainfrom
Conversation
…del_state_dict The trainer refactor (#2985) changed push_model_state_dict to call get_model_state_dict() which unshards FSDP state (all-gather) before pushing to TorchStore. This added an expensive all-gather and increased the size of tensors transferred. Revert to passing self.model.state_dict() directly, which keeps the sharded representation.
joecummings
approved these changes
Apr 23, 2026
Member
joecummings
left a comment
There was a problem hiding this comment.
Great catch thank you! Would you mind opening a GitHub Issue as well to add in timing tests for our RL work? That would've caught this immediately
wwwjn
reviewed
May 4, 2026
| means "skip StorageVolumes and let the destination read directly | ||
| from the source's GPU memory". | ||
|
|
||
| Uses get_model_state_dict() to unshard FSDP state before pushing. |
Contributor
There was a problem hiding this comment.
Now why we don't need unshard FSDP state?
Contributor
Author
There was a problem hiding this comment.
actually, even before this PR, we weren't unsharding the FSDP state; the comment was wrong. by default get_model_state_dict() returns the sharded state
we don't need to unshard FSDP state because torchstore handles sharded DTensors. each trainer rank can put its own shard of a tensor to TorchStore, and when the generator pulls, it will handle the resharding if it needs to
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.
The trainer refactor (#2985) changed push_model_state_dict to call get_model_state_dict() instead of
model.state_dict(). While the end result of these calls are the same (returns sharded state_dict with DTensors), callingget_model_state_dictadds some overhead.Average push time over 10 steps for Qwen3 0.6B:
with
get_model_state_dict(): 0.0170swith
model.state_dict(): 0.008sRevert to previous way of calling self.model.state_dict() directly.