batch params together in weight sync and async update the weights#5249
Open
winglian wants to merge 1 commit intohuggingface:mainfrom
Open
batch params together in weight sync and async update the weights#5249winglian wants to merge 1 commit intohuggingface:mainfrom
winglian wants to merge 1 commit intohuggingface:mainfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
commit the batch_update_named_params method fix peft handling and also reorder elif so we don't have unhandled conditions
fe437e1 to
b777252
Compare
kashif
approved these changes
Mar 9, 2026
Member
|
thanks for the PR. I'd prefer having a good heuristic (hard-coded value) and avoid adding again a new parameter. What would be a good value? |
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?
Rather than firing off 100s of HTTP calls to update weights to vLLM, we can update these in batch. Also, we can async the rpc collective call so the update doesn't block the HTTP call.
For Owen2 0.5B, this cuts the weight sync from 0.6sec to 0.15sec.
Fixes # (issue)
Before submitting
Pull Request section?
to it if that's the case.
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
Touches distributed weight-sync plumbing (HTTP + NCCL/XCCL ordering, new batching/chunking, and async worker dispatch), so subtle ordering or shape/dtype mismatches could cause sync hangs or incorrect weights despite the change being localized.
Overview
Speeds up vLLM server-mode weight synchronization by introducing a batched update path: the client now can POST parameter metadata once (optionally chunked by total tensor elements) and then broadcast tensors sequentially, and the server loads the received weights in one
load_weights()call.Updates
VLLMGeneration.sync_weights()to use this batched sync when not using ZeRO-3/FSDP gather paths, and threads a new config/arg (weight_sync_chunk_size/vllm_weight_sync_chunk_size) fromGRPOConfigthroughGRPOTrainerintoVLLMGeneration.On the
trl vllm-serveside, adds a/batch_update_named_params/endpoint and switches the existinginit_communicator/update_named_paramfan-out to workers to send over pipes concurrently viaasyncioto avoid blocking the HTTP handler.Written by Cursor Bugbot for commit b777252. This will update automatically on new commits. Configure here.