Fix ZeRO-3 synchronization during OPSD rollout - #8264
Conversation
Signed-off-by: LiRunGuo <li19107254665@gmail.com>
|
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. |
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