Skip to content

feat(nemo-gym): add shared looping metrics and optional reward zeroing - #5460

Open
u-brixton wants to merge 8 commits into
rzayashnikov/gym-baseline-upgradefrom
rzayashnikov/looping-training-metrics
Open

u-brixton wants to merge 8 commits into
rzayashnikov/gym-baseline-upgradefrom
rzayashnikov/looping-training-metrics

Conversation

@u-brixton

@u-brixton u-brixton commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor
  • I, the PR author, have personally reviewed every line of this PR.

What and why

Training and evaluation need the same severe text-loop label. Use Gym's shared detector, save is_looping and original verifier grades through existing metadata/logging paths, and pool diagnostic counts before dynamic sampling. Optional loop zeroing affects learning rewards while preserving the raw dynamic-sampling signal and sample/token masks.

Assessment is off by default. Zeroing requires Gym assessment on every shard and the reward-shaping master switch. Loop-only, length-only and combined shaping are supported. Classic GRPO, synchronous TransferQueue and SingleController/Forest paths keep their existing lifecycle and storage patterns; PPO supports its documented shaping paths.

This PR is stacked on #5484. The Gym submodule pin, dependency alignment and uv.lock belong entirely to that prerequisite. This layer has no Gym gitlink, lockfile or pyproject.toml diff.

flowchart LR
    R[Verifier grades] --> D[Raw dynamic sampling]
    G[Shared Gym assessment] --> M[Saved flag and diagnostic totals]
    G --> S[Optional learning reward zeroing]
    D --> S
    S --> A[Advantages and training]
Loading

Issues

No separate issue: this draft and the companion Gym PR track the feature.

Convergence / perf / functionality proof

Follow-up review fixes passed 25 focused CPU tests, including actual SingleController and async GRPO reward-zeroing paths and retention of per-agent metrics under the looping namespace. Pinned Ruff lint, import ordering and formatting checks passed for all changed Python files. These are local CPU checks; locked Linux/GPU validation was not run.

The fixes passed the complete 80-case reward-function suite, six effective-shard safeguard cases and 14 Forest-validation cases. Focused bool-only checks also passed six CPU cases, four replay restoration/merge cases, and tri-state context and saved-metadata checks. Pinned Ruff 0.9.9 checks passed. A paired check using the pinned Gym code produced matching true/false/null labels through the real Gym assessor and NRL result-processing path with Forest mode enabled and disabled, preserving scores.

Synthetic post-response processing through the real NRL stream and Gym assessor measured the following warm medians over three 96-output trials (one persistent worker; generation and receipt postprocessing replaced with fixed data):

Admission concurrency Assessment off Assessment on
1 0.49 ms/output 9.03 ms/output
8 0.28 ms/output 8.83 ms/output

First assessment with a fresh worker took 0.43–0.57 seconds. Each trial mixed 164-character ordinary text, 77,757-character synthetic text, 6,000-character repeated text and missing-output controls: all 72 readable outputs were assessed; 24 intentional missing-output controls were unknown. Labels and raw grades matched. This local macOS/arm64 CPU check measures result processing, not training throughput.

The companion Gym passed 1,617 CPU tests and full local pre-commit. NRL's full locked pre-commit cannot run on this macOS host because its lock targets Linux. No full locked Linux/GPU/Ray training, throughput or convergence result is claimed; this remains a draft.

Needs upstream changes

Merge prerequisite #5484, which owns the Gym version and waits for Gym #6846 to land.

CI scope: CI:L1.

@copy-pr-bot

copy-pr-bot Bot commented Nov 26, 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.

@github-actions github-actions Bot added Documentation Improvements or additions to documentation CI:L1 Run doctests, unit tests, and functional tests labels Nov 26, 2026
@github-actions

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: 41bc3b6 (PR #5460 from rzayashnikov/looping-training-metrics)

✅ Submodules that are properly updated:

Gym: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

@github-actions

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: f613843 (PR #5460 from rzayashnikov/looping-training-metrics)

✅ Submodules that are properly updated:

Gym: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

@github-actions

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: f530cd3 (PR #5460 from rzayashnikov/looping-training-metrics)

✅ Submodules that are properly updated:

Gym: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

@github-actions

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: 4d662db (PR #5460 from rzayashnikov/looping-training-metrics)

✅ Submodules that are properly updated:

Gym: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

@github-actions

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: e6a1be4 (PR #5460 from rzayashnikov/looping-training-metrics)

✅ Submodules that are properly updated:

Gym: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

@github-actions

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: eca7fd9 (PR #5460 from rzayashnikov/looping-training-metrics)

✅ Submodules that are properly updated:

Gym: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

@github-actions

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: f3c0374 (PR #5460 from rzayashnikov/looping-training-metrics)

✅ Submodules that are properly updated:

Gym: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

@github-actions

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: e27beff (PR #5460 from rzayashnikov/looping-training-metrics)

✅ Submodules that are properly updated:

Gym: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

@github-actions

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: 213be4e (PR #5460 from rzayashnikov/looping-training-metrics)

✅ Submodules that are properly updated:

Gym: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

@terrykong terrykong removed the Documentation Improvements or additions to documentation label Nov 28, 2026
@u-brixton
u-brixton force-pushed the rzayashnikov/looping-training-metrics branch from 213be4e to 6dca502 Compare November 30, 2026 11:44
@u-brixton
u-brixton changed the base branch from main to rzayashnikov/gym-baseline-upgrade November 30, 2026 11:46
@u-brixton
u-brixton added this pull request to stack #5485 November 30, 2026 11:46
@github-actions

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: 6dca502 (PR #5460 from rzayashnikov/looping-training-metrics)

✅ Submodules that are properly updated:

Gym: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

@svcnvidia-nemo-ci svcnvidia-nemo-ci added complexity:high Large or cross-cutting change. Set by Autobot PR classify (skills/pr-classify) convergence-risk:high Likely to change training results. Set by Autobot PR classify (skills/pr-classify) proof:functionality Needs proof that it works. Set by Autobot PR classify (skills/pr-classify) proof:convergence Needs convergence proof (W&B runs). Set by Autobot PR classify (skills/pr-classify) proof:perf Needs performance proof. Set by Autobot PR classify (skills/pr-classify) labels Nov 30, 2026
@u-brixton
u-brixton force-pushed the rzayashnikov/looping-training-metrics branch from 6dca502 to 5fb2072 Compare November 30, 2026 13:19
@github-actions

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: 5fb2072 (PR #5460 from rzayashnikov/looping-training-metrics)

✅ Submodules that are properly updated:

Gym: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

@u-brixton
u-brixton force-pushed the rzayashnikov/looping-training-metrics branch from 5fb2072 to 0a5aef2 Compare November 30, 2026 14:03
@github-actions github-actions Bot added CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) and removed CI:L1 Run doctests, unit tests, and functional tests labels Nov 30, 2026
@github-actions

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: 0a5aef2 (PR #5460 from rzayashnikov/looping-training-metrics)

✅ Submodules that are properly updated:

Gym: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

@github-actions

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: 350fc7d (PR #5460 from rzayashnikov/looping-training-metrics)

✅ Submodules that are properly updated:

Gym: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

1 similar comment
@github-actions

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: 350fc7d (PR #5460 from rzayashnikov/looping-training-metrics)

✅ Submodules that are properly updated:

Gym: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

@u-brixton u-brixton 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.

LGTM for this scoped follow-up at 350fc7d, against stacked base dd4165c. All previous private requests are fixed: both metric filters and the pooling explanation, all three length-only diagnostics, and the assessor, SingleController and async trainer regression checks. Source fixes in becc5be are preserved by the merge. No new major regression or follow-up comment remains.

Five specialist roles ran across three agents, followed by independent discovery and challenge passes and a separate editor. Eleven distinct modified cases passed. Five targeted source reversions fail the intended assertions; the four False/None stage controls pass, and all source copies were restored. All three pinned Ruff 0.9.9 checks passed on ten changed Python files. The actual upper diff has no Gym gitlink, lock or project-dependency change.

Execution is adapted macOS CPU evidence with mocked infrastructure boundaries. A guard prevented Ray initialization; the async case passed after isolating an unrelated autouse fixture dependency. Cached package versions differ from the Linux lock. No native locked Linux/GPU/Ray training, throughput or convergence result is established; the known pre-commit blocker was not retried. At review time, CI reported pr-description and Self-review failures; local results did not establish green CI. The existing prerequisite merge, pin replacement, rechecks and restacking remain acknowledged obligations.

nemo-rl-review: kind=self harness=codex/0.169.0-alpha.11.1 model=gpt-6.1-sol effort=high review-pr-team=v3 reviewed=350fc7d

@u-brixton
u-brixton marked this pull request as ready for review November 30, 2026 21:16
Use Gym assessment before token rebuilding, preserve verifier grades and row metadata, and pool diagnostic counts across supported training paths. Keep raw dynamic sampling and make loop zeroing optional under the reward-shaping master switch.

Signed-off-by: Renat Zayashnikov <[email protected]>
Use the shared bool-or-None assessment and preserve only is_looping in result metadata, recovery, replay and saved rows.

Signed-off-by: Renat Zayashnikov <[email protected]>
Describe supported loop-only zeroing and name the unsupported length settings in validation errors. Cover effective shard assessment and both length-plus-loop reward compositions through the existing behavioral tests.

Signed-off-by: Renat Zayashnikov <[email protected]>
@u-brixton
u-brixton force-pushed the rzayashnikov/looping-training-metrics branch from e07b11a to dad6c67 Compare December 3, 2026 14:34
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: dad6c67 (PR #5460 from rzayashnikov/looping-training-metrics)

✅ Submodules that are properly updated:

Gym: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

1 similar comment
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: dad6c67 (PR #5460 from rzayashnikov/looping-training-metrics)

✅ Submodules that are properly updated:

Gym: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

@u-brixton

Copy link
Copy Markdown
Contributor Author

/ok to test dad6c67

@u-brixton

Copy link
Copy Markdown
Contributor Author

/ok to test ee0bfef

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: ee0bfef (PR #5460 from rzayashnikov/looping-training-metrics)

✅ Submodules that are properly updated:

Gym: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

@u-brixton

Copy link
Copy Markdown
Contributor Author

/ok to test 090065f

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: 090065f (PR #5460 from rzayashnikov/looping-training-metrics)

✅ Submodules that are properly updated:

Gym: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

This branch has not been deployed

No deployments
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) complexity:high Large or cross-cutting change. Set by Autobot PR classify (skills/pr-classify) convergence-risk:high Likely to change training results. Set by Autobot PR classify (skills/pr-classify) proof:convergence Needs convergence proof (W&B runs). Set by Autobot PR classify (skills/pr-classify) proof:functionality Needs proof that it works. Set by Autobot PR classify (skills/pr-classify) proof:perf Needs performance proof. Set by Autobot PR classify (skills/pr-classify)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants