feat: multi-reward tool-call environment and reward_components for GDPO - #1525
Merged
cmunley1 merged 9 commits intoJun 12, 2026
Merged
Conversation
Add an optional reward_components field to BaseVerifyResponse so environments can return decoupled per-component scores for multi-reward RL (GDPO, https://arxiv.org/abs/2601.05242). Add the tool_call_multireward environment, which grades a single get_weather tool call on three independent components (correctness, schema_valid, format) and returns them in reward_components with reward set to their sum. Includes dataset generator, example data, config, README, and unit tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Anjali Shah <anjshah@nvidia.com>
This was referenced Jun 3, 2026
Merged
…tting Move reward_components off BaseVerifyResponse onto ToolCallMultiRewardVerifyResponse so other environments' verify responses are unchanged (the base-class field was serializing reward_components: null into every response and breaking other servers' exact-match tests). Regenerate example.jsonl via create_examples.py and apply ruff format/lint. NeMo-RL's bridge still reads reward_components from the verify result. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Anjali Shah <anjshah@nvidia.com>
Add example_metrics.json and example_rollouts.jsonl (5 rollouts) generated by running the 5 example prompts through the agent (Qwen2.5-7B-Instruct via a local vLLM server), plus a data/.gitignore matching the other example environments. This satisfies ng_test's example-data validation (ng_test +should_validate_data=true). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Anjali Shah <anjshah@nvidia.com>
Contributor
Author
Note on the example-validation artifacts
Validated locally: Reviewers/maintainers can regenerate these against the standard serving stack if a different reference model is preferred — the env scoring logic is model-agnostic. |
Regenerated via scripts/update_env_list.py (the update-readme-table pre-commit hook) so the new multi-reward environment appears in the environment list. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Anjali Shah <anjshah@nvidia.com>
cmunley1
reviewed
Jun 5, 2026
Per review feedback, prefix the environment with example_ to match the repo convention for illustrative envs (example_single_tool_call, example_multi_step, ...), since it's a reference/test-bed for the reward_components convention rather than a training/eval dataset. Renames the directory, config + server/agent keys, dataset paths, the agent reference inside the example data artifacts, and regenerates the README environment catalog (now listed under examples). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Anjali Shah <anjshah@nvidia.com>
Add the value field (per review) for catalog consistency with other resources servers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Anjali Shah <anjshah@nvidia.com>
Contributor
|
Is there any docs how to use it with NeMo RL or is that a future thing? |
Contributor
|
/ok to test 1146e5d |
Contributor
|
/ok to test 603a0a7 |
wprazuch
pushed a commit
that referenced
this pull request
Jun 22, 2026
…PO (#1525) ## Summary Adds multi-reward support for GDPO ([arXiv:2601.05242](https://arxiv.org/abs/2601.05242)) on the NeMo Gym side. - **`nemo_gym/base_resources_server.py`** — optional `reward_components: dict[str, float] | None = None` on `BaseVerifyResponse`. Backward-compatible (defaults to `None`); single-reward environments are unaffected. - **`resources_servers/tool_call_multireward/`** — a new environment that asks the model to call `get_weather` and scores the response on three independent `{0,1}` components — `correctness`, `schema_valid`, `format` — returned in `reward_components` (with `reward` set to their sum). Includes dataset generator, example data, config, README, and tests. ## Why GRPO sums reward components and normalizes the sum, so responses with the same total but different composition collapse to an identical advantage. GDPO normalizes each component independently and keeps them distinct. This environment exposes exactly that structure (e.g. `{0,1,1}` and `{1,1,0}` both total `2.0`). Downstream, NeMo-RL consumes `reward_components` as `reward1…rewardN` for the GDPO advantage estimator. ## Test plan `resources_servers/tool_call_multireward/tests/test_app.py` — 7 scoring cases including the same-total/different-composition case. Verified green (8/8) via the NeMo Gym test runner. --------- Signed-off-by: Anjali Shah <anjshah@nvidia.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Christian Munley <cmunley@nvidia.com>
6 tasks
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
Adds multi-reward support for GDPO (arXiv:2601.05242) on the NeMo Gym side.
nemo_gym/base_resources_server.py— optionalreward_components: dict[str, float] | None = NoneonBaseVerifyResponse. Backward-compatible (defaults toNone); single-reward environments are unaffected.resources_servers/tool_call_multireward/— a new environment that asks the model to callget_weatherand scores the response on three independent{0,1}components —correctness,schema_valid,format— returned inreward_components(withrewardset to their sum). Includes dataset generator, example data, config, README, and tests.Why
GRPO sums reward components and normalizes the sum, so responses with the same total but different composition collapse to an identical advantage. GDPO normalizes each component independently and keeps them distinct. This environment exposes exactly that structure (e.g.
{0,1,1}and{1,1,0}both total2.0). Downstream, NeMo-RL consumesreward_componentsasreward1…rewardNfor the GDPO advantage estimator.Test plan
resources_servers/tool_call_multireward/tests/test_app.py— 7 scoring cases including the same-total/different-composition case. Verified green (8/8) via the NeMo Gym test runner.