[TRAIN-1] Megatron async GRPO with dis-colocated generation deadlocks at weight sync
Problem
Async GRPO with colocate_generation: false on the Megatron backend hangs permanently at the first weight sync (step 1 to 2). After the first training step completes, the trainer and the async rollout collector each wait on the other. The pipeline stalls with idle GPUs and never recovers. The same step runs fine with colocated generation and on the DTensor backend.
Steps to reproduce
- Configure async GRPO with
colocate_generation: falseusing the Megatron backend. - Start training.
- Observe the pipeline stall after step 1 with no error output and idle GPUs.
Suggested fix
- Investigate the weight handoff coordination between
MegatronPolicyWorkerandVllmAsyncGenerationWorker. - Add a timeout and explicit error on weight-sync deadlock so the failure surfaces rather than hanging silently.
@anwithk
I can't reproduce it on my side. I need more detailed reproduction guide, including recipe, commit, as well as containers.
https://wandb.ai/nvidia/nemorl-vdr-debug/runs/z1oos66a/overview
This run worked well.
By the way, there's no colocate_generation: false only policy.generation.colocated.enabled.
Formal-verification evidence supporting this report — we model-checked the weight-refit rendezvous in TLA+ (TLC), independent confirmation of the hang class and of the suggested fix direction.
What the model shows:
-
The wedge is real and structural. The two-sided refit rendezvous (
refit_policy_generation,grpo.py~L2719-2825; trainer-sidebroadcast_weights_*/stream_weights_*futures and inference-sideupdate_weights_*futures) requires both sides to complete; the driver waits onray.get(futures_train)/ray.get(futures_inference)(~L2797-2808) with no timeout. TLC produces the liveness counterexample:BeginRefit → one side dies → both sides wedge → phase=Refit forever. Matches this issue's "each waits on the other, no error output, idle GPUs, never recovers". -
The suggested fix (timeout + explicit error) is verified. Adding a driver-side refit timeout/rescue to the model makes the liveness property hold — all 16,442 distinct states clean, refit always terminates or raises. So "Add a timeout and explicit error on weight-sync deadlock so the failure surfaces rather than hanging silently" is confirmed sufficient in-model.
-
Adjacent invariant worth preserving during the fix: the driver's
update_success = all(results)all-ack gate is load-bearing. A model variant without it produces a 7-step split-brain counterexample — a shard that joins the new communicator epoch early accepts data while a peer is still mid-join. Whatever timeout/retry logic is added should keep the all-ack semantics intact (i.e., timeout → fail the refit loudly, not partial proceed).
Spec details available on request (the model covers weight-version freshness, stale flag, and crash/recover around the refit phase).