Skip to content

fix: support reward-model environments on SingleController - #5530

Open
macandro96 wants to merge 1 commit into
mainfrom
amahishi/sc-rm-env
Open

macandro96 wants to merge 1 commit into
mainfrom
amahishi/sc-rm-env

Conversation

@macandro96

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

What and why

GRPO can score responses with a reward model (env.reward_model) instead of a rule-based checker. This worked on the legacy path but failed on SingleController (SC) for two reasons:

  1. SC didn't leave GPUs free for the reward model. The reward model grabs its own GPUs, but SC sized its training and generation clusters as if the whole node were theirs, so a run on a fully used node hangs. SC now sets those GPUs aside the same way legacy GRPO does.
  2. Scoring a single response crashed. SC scores one response at a time, and with one response the reward model returned a 0-d tensor that couldn't be batched. That extra squeeze is removed.

This PR fixes both and adds an SC reward-model example config and a functional test, the SC counterpart of grpo_rm_env.sh.

Issues

Part of #5044

Convergence / perf / functionality proof

Bug fixes plus tests. The new SC functional test passes locally on 3×H100, and its rewards come from the reward model, not the default math checker. The new unit tests fail without the fixes and pass with them.

Needs upstream changes

None

PR commands and CI
  • CI label, exactly one:
    • CI:Lfast: the default for most PRs. Runs a fast test subset.
    • CI:L1: dependency or container changes (pyproject.toml, uv.lock, Dockerfile) or broad core changes. Builds a new image and runs unit and functional tests.
    • CI:docs: docs-only changes. Runs doc tests only.
  • /ok to test <full-commit-sha>: start CI for that commit. Post again after each push.
  • /nightly-ci test-case=<test>: run NVIDIA's nightly CI for the PR head; eligible teams only.
  • /review: automated review comments. Add mode=strict for a stricter review, reset=true for a fresh full review.
  • /resolve-conflict: Autobot merges main into this PR and resolves the conflicts. PRs from forks must allow edits by maintainers.
  • Locally: /review-pr-team <pr-number> for a team review before you ask for human review.
  • Contributor guidelines

🤖 Generated with Claude Code

@copy-pr-bot

copy-pr-bot Bot commented Dec 2, 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.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added complexity:medium Moderate change. Set by Autobot PR classify (skills/pr-classify) convergence-risk:low Unlikely 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) labels Dec 2, 2026
@macandro96
macandro96 marked this pull request as ready for review December 3, 2026 02:33
@macandro96
macandro96 requested a review from yuki-97 December 3, 2026 02:33
Two bugs kept a reward-model environment from working on the SC native
rollout path:

- SC never set aside the reward model's GPUs. RewardModelEnvironment
  claims env.reward_model.resources for itself when setup builds it,
  which happens before SC sizes its clusters, so on a fully used node the
  two waited on each other's placement groups. _build_clusters now leaves
  those GPUs out, split the same way as legacy GRPO setup.
- Scoring a single response returned a 0-d tensor. SC steps the
  environment one sample at a time, and score() squeezed the
  already-squeezed scores again, so BatchedDataDict.from_batches failed
  with "iteration over a 0-d tensor".

Add grpo_rm_1B_megatron_single_controller.yaml and an SC sibling of
grpo_rm_env.sh (3 GPUs: trainer, generation, reward model), registered as
a fast entry in L1_Functional_Tests_SingleController_4.sh.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Anish Mahishi <[email protected]>
@github-actions github-actions Bot added the CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) label Dec 4, 2026
@macandro96

Copy link
Copy Markdown
Contributor Author

/ok to test cd85269

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:medium Moderate change. Set by Autobot PR classify (skills/pr-classify) convergence-risk:low Unlikely 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)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants