RL diagnostics: documents_seen, weights_ready document-count version, reward/model_version staleness metrics#557
Closed
jlamypoirier wants to merge 2 commits into
Closed
Conversation
The `weights_ready` event now carries `document_count` (= documents_seen) alongside the existing `step` (= completed step). Consumers stamp `document_count` onto rollouts so staleness is measured in documents, aligning with DeepSpeed's document clock, while `step` remains available for logging. Keeping `step` makes the change backward-compatible. Threads `documents_seen` through the `TrainerCallback.run_begin` / `step_end` hooks (a training-progress counter alongside `step`). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add two optional per-token fields to the RL streaming schema and thread them through the data pipeline alongside `advantages` / `old_log_probabilities` (reusing `TokenDataDocument`/`TokenDataBatch`): - `reward`: the raw (un-normalized) reward, a per-rollout scalar broadcast per-token — distinct from the group-relative `advantage`. - `model_version`: the model version each token was generated under (documents-seen units), one per token, for staleness diagnostics. Both are optional (absent when the producer does not send them), so the batch/target plumbing guards on presence. The shared policy-gradient loss logs mean/max/min of each supplied field when `metrics != none` (GRPO and GSPO), registered only when the data is present. Staleness is `documents_seen - model_version`, derivable from the logged version stats and `documents_seen`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
3bc5e6a to
a26c2b6
Compare
This was referenced Jul 8, 2026
Collaborator
Author
|
Claude Sonnet 5, on behalf of @jlamypoirier: closing this — it bundled two commits
|
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.
Claude Sonnet 5, on behalf of @jlamypoirier.
Summary
Extracted from #553. Stacked on #559 (
documents_seen/num_documentstracking), which thisPR depends on: the model version broadcast below is
documents_seen, and staleness iscomputed as
documents_seen - model_version. Base will retarget tomainonce #559 merges.weights_readynow carriesdocument_count(=
documents_seen) alongside the existingstep, so consumers can measure staleness indocuments (DeepSpeed-aligned). Keeping
stepmakes this backward-compatible.TrainerCallback.run_begin/step_endgaindocuments_seenalongsidestep.rewardand per-tokenmodel_version. Two optional per-token fields threaded through theRL streaming schema and data pipeline (reusing
TokenDataDocument/TokenDataBatch); bothoptional and guarded on presence.
rewardis the raw reward (distinct from the group-relativeadvantage). The shared policy-gradient loss logs mean/max/min of each when present (GRPO andGSPO, via the shared
_data_metric_definitions/_register_data_metrics). Staleness isdocuments_seen − model_version, derivable from the logged version stats.Paired PipelineRL changes (raw-reward forwarding + document-count model version) are in a
separate PR against PipelineRL's
fast-llmbranch.Tests
tests/data/test_streaming.py(schema round-trip for the new fields) andtests/layers/test_lm_losses.py(reward/model_version metric registration, single-process anddistributed) pass on CPU: 584 passed / 21 skipped (lm_losses), 87 passed (streaming + lm_head).
Caveats
tests/models/test_streaming.py::test_model_streaming,which exercises
documents_seen+ theweights_readydocument_countpath) was not runhere (no GPU) — worth running in CI before merge.
model_versionconsumer and its metric are in place, but the producer(tagging tokens with the active version inside vLLM's output path) is a separate,
cluster-validated follow-up; until it lands, the
model_version/staleness metrics simply don'tpopulate.