NVIDIA-NeMo/RL #5049
(part 3 of the rollout-checkpointing stack, on top of #5048;
see also the #5048 page).
Permalinks pin the reviewed head c2bf309a, and 09627ac2 (the same two commits rebased onto main) for the W&B section.
weight_version_lag: how many updates old the oldest group in a step was. Nothing said how old the average trained token was.vLLM keeps a paused call alive across a refit, so its later tokens come from the new weights.
Commit 1 does not see that: it sums each call under its start version
(commit 1).
Commit 2 asks every vLLM engine, during the pause, how many tokens each running call has made
(captured_call_progress),
writes that as a refit_cut event, and splits the call there offline
(tokens_by_version).
The figure runs both on two calls trained by a step that updates version 6.
Both methods read high, never low: a token is never made by a version older than its call's stamp. Commit 1 is exact for every call that does not span a refit. The gap here is large only because one of two calls spans the refit; in a real batch most calls span none, and the PR's 6-step GPU run reports batch age only with the split, so the real gap is unknown. Call B shows a gap in the PR's split: the token counts are read right after the pause, before call B arrives, and its version stamp only moves after resume. Reading the counts right before resume instead sees call B with 0 tokens, so all 40 count on v5 and the exact split matches what really happened (1.23). The stamp itself should not move: it also decides which groups are evicted as stale.
Where the fix lands: RL only, no vLLM change. single_controller.py (W&B metric, split at publish, read timing),
trace.py (the writer keeps no state), and one vLLM-lane test.
| Ask | Why |
|---|---|
Also log batch age to W&B — two sums per group (tokens, tokens × version), one division per step next to weight_version_lag. |
The trace is opt-in and needs an offline script, so most runs never see the number. The per-group metric path already reaches the train pump
(_capture_token_metrics →
per_group_rollout_metrics).
Miles logs the same token-weighted number (code). |
Do the split in the controller when a group publishes, with the PR's own loop, and write the exact counts into group_published. |
Today the split exists only offline, so W&B can't use it, and the writer's _cut_calls set
(trace.py#L117) keeps call IDs of dropped groups forever. |
| Read the token counts right before resume, not right after the pause. | vLLM registers new requests even while paused (async_llm.py#L507), so call B shows up with 0 tokens. Left over: calls added after the read and before the stamp moves, and counts that can trail by about one decode step (vLLM: "not required for correctness"). |
Make the read safe: catch errors, give its ray.get a timeout, and test against vLLM's real classes. |
It reads vLLM private fields inside the refit try, which only catches RefitAborted/RayActorError; any other error skips resume.
The tests use fakes, so a rename passes CI. |
proposed — single_controller.py, _train_pump, next to weight_version_lag +tokens = sum(per_group_rollout_metrics.pop("batch_age/trained_tokens", [])) +version_sum = sum(per_group_rollout_metrics.pop("batch_age/token_version_sum", [])) +if tokens: + step_metrics["batch_age"] = version_during_step - version_sum / tokens
🟠 C7 — W&B C8 — split at publish C9 — read before resume, safe read C10 — real vLLM classes