fix(orchestrator): align train metrics with trainer cohort#3033
Open
vineetjain96 wants to merge 1 commit into
Open
fix(orchestrator): align train metrics with trainer cohort#3033vineetjain96 wants to merge 1 commit into
vineetjain96 wants to merge 1 commit into
Conversation
vineetjain96
marked this pull request as ready for review
July 15, 2026 03:50
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.
Summary
Problem
TrainBatch.rolloutsis the finalized-group observation window, not necessarily the payload sent to the trainer.TrainSinkcan finalize more clean rollouts than fit in the current batch, retain overflow for the next step, or exclude rollouts that have no samples.For example, with a batch size of six, two finalized groups of four put eight clean rollouts in the observation window. Only six ship in the current trainer batch; two remain buffered for the next one. Metrics currently treat all eight as effective now, then can omit the buffered two when they actually train. The same mismatch affects input/output usage, traces, sample tables, and environment-mix summaries.
Regression
Before #2907,
TrainSink.process_batch()returned the sliced trainer cohort asTrainBatch.rollouts, so each step's reward was calculated from the rollouts selected for that trainer batch. This behavior is visible in v0.6.1.dev30 (16efd8a).#2907 introduced the broader observation window while consolidating train and eval metrics, and used its non-errored, non-filtered
effectiveview as an approximation of what trained. The two sets diverge at batch overflow, so the reward mismatch appears to be an unintended consequence of that consolidation rather than an intended change to training semantics.#3013 later corrected which finalized groups belong to each observation window, but deliberately retained a window that can be broader than the sliced trainer cohort.
Fix
Carry an explicit
trainer_rolloutscohort alongside the observation window. It is derived from the same sliced, post-filter, non-empty-sample rollouts that produce the trainer payload.Use that cohort for effective metrics and trainer-bound observability while retaining the full finalized-group window for all-rollout, error, and pre-filter diagnostics. Point the curated reward panel at the effective trainer-cohort metric and document the distinction. When an existing W&B overview still uses the older all-rollout reward panel, create a versioned overview with the corrected schema instead of reusing or overwriting the saved view.
This changes accounting and observability only. It does not change rollout filtering, batching, reward assignment, samples, losses, or optimizer behavior.
Verification
All commands ran against this checkout using the existing shared environment with
uv run --active --no-syncand an explicitPYTHONPATH.pytest tests/unit/orchestrator/test_metrics.py tests/unit/utils/test_wandb.py -v— 13 passedpytest tests/unit/orchestrator -m "not gpu" -v— 95 passed, 1 skippedpytest tests/unit -m "not gpu" --ignore=tests/unit/test_configs.py --ignore=tests/unit/utils/test_metrics_server.py -q— 352 passed, 1 skipped, 81 deselectedpytest tests/unit/utils/test_metrics_server.py -qwith proxy variables unset for localhost — 16 passedpre-commit run --files <touched files>— Ruff check and Ruff format passedtests/unit/test_configs.pywas excluded from the broad shared-environment run because that environment intentionally does not contain every optional taskset package referenced by the repository's config catalog.Note
Low Risk
Observability and logging only—no changes to filtering, batching, rewards, or trainer payloads beyond aligning what gets measured.
Overview
Train observability was treating the finalized-group observation window as the cohort that actually trained, which diverges when batching overflows or rollouts have no samples.
This PR adds an explicit
trainer_rolloutsonTrainBatch—the same sliced, post-filter rollouts that produce the shippedsamples—and uses it for effective reward, traces, W&B samples/distributions, env mix (batch/*), and console Step lines. The broaderrolloutswindow stays onallmetrics for errors and diagnostics.Docs and the monitor skill now point at
train/.../effective/reward/meanas the main progress signal. W&B overview train panels use that metric; legacy overviews that still chartall/rewardtrigger a versioned view instead of reuse.Reviewed by Cursor Bugbot for commit c9bd6f8. Bugbot is set up for automated code reviews on this repo. Configure here.