Fix ZeRO-3 synchronization during OPSD rollout - #8264
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Hi @LiRunGuo thanks for your issue and fix. I have some comments:
@PKUWZP for this discussion. |
|
Thanks for pointing this out. I agree that setting eos_token_id=None is only a deadlock workaround and changes the originalgeneration behavior by disabling EOS termination. I will revise the fix so that EOS detection and post-EOS padding are preserved. The rollout will keep all ranks in lockstep, retain the first EOS token, and pad all subsequent positions, matching the previous output semantics. For the current OPSD configuration, the main 8-GPU run uses micro_batch_size_per_gpu=1, gradient_accumulation_steps=1, and n_samples_per_prompt=1. With 8 data-parallel ranks, this corresponds to 8 prompts and 8 rollouts per training iteration. The 2-GPU smoke test uses 2 prompts and 2 rollouts per iteration. The verification runs use a maximum response length of 64, while the full reproduction uses 1024. I agree that synchronized early stopping across ranks would improve performance. I will treat that as a follow-up optimization after restoring the original EOS/padding behavior. |
687cd49 to
b434480
Compare
|
Hi @LiRunGuo , I saw you force-pushed after comments but Thanks for your setup information, we definely should support such use case. |
|
Hi @LiRunGuo thanks for the followup. Can you resolve merge conflicts? Thanks! I'll create an issue for early stopping and assign to you, let me know if it works. |
687cd49 to
9637a65
Compare
|
Thanks for the reminder. I have rebased the PR onto the latest master and resolved the conflicts with the newly added HybridEngineRollout profiling changes. The updated branch preserves both profiling and synchronized fixed-length decoding with post-EOS padding. I kept synchronized early stopping out of this PR and will address it separately in #8321. Local validation after the rebase:
|
|
The PR is now mergeable, approved, and all available checks/DCO have passed. I attempted to merge it, but this repository uses a maintainer-controlled merge queue and my account does not have permission to add it. Could you please add #8264 to the merge queue when convenient? Thanks! |
|
Hi @delock, I checked the failed merge-queue run (32981748015). The only failures were two unrelated FusedAdam numerical-reference cases:
All This therefore appears to be an unrelated intermittent CI/test failure rather than a regression from #8264. Could you please rerun the failed merge-group job or add the PR back to the merge queue? Thanks! |
|
Hi @delock, thank you for requeueing the PR. I checked the second merge-group commit (
Because required workflows for this merge group have already failed, the still-queued CPU workflow cannot make the merge complete. Could you please cancel/ignore this stale merge group and add #8264 to the merge queue again? No code changes appear necessary. Thanks! |
Signed-off-by: LiRunGuo <li19107254665@gmail.com>
Signed-off-by: LiRunGuo <li19107254665@gmail.com>
9637a65 to
281a23c
Compare
|
Hi @delock, I have rebased #8264 onto the latest master ( The updated code preserves the complete shared-prefill hook lifecycle and places the ZeRO-3-safe Local validation after the rebase:
The branch has been updated with |
Summary
Fixes #8262.
Why
ZeRO-3 gathers partitioned parameters during every autoregressive decode forward. If one data-parallel rank emits EOS and returns from
generate()while another rank continues decoding, the continuing rank enters another parameter all-gather while the finished rank moves to a later collective. The job then deadlocks.Passing
eos_token_id=Nonemakes every rank execute exactlymax_new_tokensiterations. Output masking remains unchanged, so EOS and padding tokens are still excluded from downstream response loss as applicable.Validation
pytest -q tests/unit/runtime/rollout/test_hybrid_engine_rollout.py(10 passed)pre-commit run --files deepspeed/runtime/rollout/hybrid_engine_rollout.py tests/unit/runtime/rollout/test_hybrid_engine_rollout.py