Skip to content

fix(sc): retain rollout metrics through training - #3880

Merged
yfw merged 11 commits into
mainfrom
yifu/v2_rollout_metrics
Sep 4, 2026
Merged

fix(sc): retain rollout metrics through training#3880
yfw merged 11 commits into
mainfrom
yifu/v2_rollout_metrics

Conversation

@yfw

@yfw yfw commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Ports the rollout-metric aggregation behavior from #2175 to the SingleController async/TransferQueue path.

  • retain per-group rollout metrics when prompt groups are committed to TQReplayBuffer
  • carry metrics only from prompt groups selected by the sampler for the current training step
  • aggregate selected metrics with the shared aggregate_rollout_metrics semantic rules and log them with the corresponding train step
  • honor the existing W&B opt-in before retaining NeMo Gym full-result tables, keeping disabled payloads out of replay checkpoints

No new configuration or migration changes are required.

Validation

  • focused SingleController, replay-buffer, sampler, rollout-manager, setup, and aggregation tests: 151 passed
  • ruff check and ruff format --check: passed
  • pyrefly check on changed production files: passed

Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
@yfw
yfw requested review from a team as code owners August 27, 2026 19:51
@copy-pr-bot

copy-pr-bot Bot commented Aug 27, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@yfw yfw left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rollout metrics reaching the SingleController train logs is a real gap: on main the SC path computed record.rollout_metrics and discarded it, with no other route to those numbers. The implementation matches its nearest analogs (grpo.py:4845-4849, ppo.py:2432) almost line for line and reuses the shared aggregate_rollout_metrics rather than reimplementing its min/max/sum/histogram semantics, which is the right call. The re-attach in _finalize_selection is genuinely necessary — concat keeps only the first meta's extra_info — and the pop targets a fresh concat-produced meta, so it cannot corrupt buffered state. Multi-chunk accumulation is correctly scoped, and resume from a pre-PR checkpoint degrades gracefully.

One inline comment is a real bug on an adjacent line this PR activates; the other two are low-priority test pins.

Minor, no action required: the TODO at single_controller.py:1401-1403 still lists rollout_metrics as outstanding — this PR implements it. The histogram log item in that same TODO is a different thing (the explicit log_histogram calls that grpo.py:2562-2582 makes for baseline/advantage) and is still outstanding.

Generated by Claude Code

Comment thread nemo_rl/algorithms/async_utils/replay_buffer.py Outdated
Comment thread tests/unit/single_controller/test_sampler_interface.py Outdated
Comment thread tests/unit/single_controller/test_single_controller_actor.py
Honor the existing W&B opt-in before retaining NeMo Gym full-result tables in SingleController rollout metrics. Add coverage for default-off behavior, setup propagation, checkpoint compatibility, and removal before DP sharding.

Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
@yfw
yfw requested a review from a team as a code owner August 27, 2026 22:59
@yfw yfw added the CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) label Aug 28, 2026
@yfw

yfw commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 14a80c8

Keep the constructor-bypassing NeMo Gym redispatch fixture aligned with the production default so rollout metric computation can exercise the retry path.

Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
@yfw

yfw commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 3be567b

Keep the partial checkpoint setup config aligned with the production logger shape so full-result table gating can be evaluated during resume tests.

Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
@yfw

yfw commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 103fef5

Resolve the SingleController setup import overlap while preserving rollout metric logging and warm-start checkpoint validation.

Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
@yfw

yfw commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 38ee49e

yfw added 3 commits August 29, 2026 16:23
Keep the partial PPO setup config aligned with the production logger shape so rollout table gating can be evaluated across critic setup tests.

Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
Resolve SingleController rollout metric retention against native TQ checkpoint recovery while preserving both behaviors.

Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
Preserve rollout metric retention and optional full-result table logging while incorporating reward penalties, reference-logprob gating, and the latest SingleController changes.

Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
@yfw

yfw commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 8491d65

Treat generation worker IDs as string metric labels so retained per-worker token counts remain valid native TQ replay metadata. Cover both metric production and checkpoint round trips.

Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>

@mehraakash mehraakash left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The full-result-table opt-in is useful, but the branch is no longer safe to merge as-is.

The rollout-metric retention and aggregation portion has already landed on main through #3883, together with speculative-decoding metrics and replay-manifest handling. This PR now conflicts with current main, and taking the PR versions during conflict resolution could regress those newer changes.

Please rebase and reduce this PR to the remaining unique change:

  • propagate log_nemo_gym_full_result_tables into the SingleController rollout manager;
  • construct full-result tables only when enabled;
  • retain focused default-off, opt-in, setup-propagation, and checkpoint-serialization tests.

The current SingleController functional failure is a real checkpointing regression caused by hashing rollout_metrics, so I don’t think this is ready until that path is fixed and green.

Comment thread nemo_rl/algorithms/async_utils/replay_buffer.py
Comment thread nemo_rl/experience/rollout_manager.py
yfw added 2 commits September 2, 2026 21:26
Keep the full-result-table opt-in on top of main rollout metrics and replay-manifest handling.

Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
@yfw

yfw commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 782dff6

@yfw
yfw merged commit 9b75ab7 into main Sep 4, 2026
86 checks passed
@yfw
yfw deleted the yifu/v2_rollout_metrics branch September 4, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants