Repository navigation
feat(image_tools_agent): cap GRPO reward at 1.0 and reduce tool-use shaping - #4249
Merged
yfw merged 6 commits intoOct 29, 2026
Conversation
…VIDIA-NeMo#3161) (cherry picked from commit 22f94c4) Signed-off-by: Danial Mohseni Taheri <smohsenitahe@nvidia.com>
6 tasks
This was referenced Oct 22, 2026
yfw
reviewed
Oct 23, 2026
…-tools-pivot-terminal-to-main Signed-off-by: Danial Mohseni Taheri <smohsenitahe@nvidia.com> # Conflicts: # responses_api_agents/image_tools_agent/tests/test_app.py
- Remove pivot_terminal_examples.jsonl and grpo_examples.jsonl: they held internal cluster image paths and rows from non-distributable data, and nothing reads them. The README now shows the __answer__ row shape. - Grade no answer when reasoning is still open after the last </think>, or when a generation cut off at the token limit never closed its reasoning (no </think> and no separate reasoning item). - Record rollout_tool_name on tool_call_when_answer_expected, and drop the unused expected_answer_text state key. - Declare extraction_mode and case_sensitive in the image_tools task-data schema, and describe the terminal expected_action shape. - README: terminal rows are graded on the final answer; add a "Terminal (answer) pivots" section with failure codes and row fields. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Danial Mohseni Taheri <smohsenitahe@nvidia.com>
Terminal (__answer__) rows have no in-repo builder. Document how to cut
the prefix, pick the gold answer, ask for \boxed{} in the prompt with
extraction_mode: boxed (matching the image-tools GRPO rows), and validate
rows with gym dataset collate.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Danial Mohseni Taheri <smohsenitahe@nvidia.com>
…changes Scope this PR to the image_tools agent (GRPO path) only. Restore resources_servers/image_tools (verifier, schema, pivot config, README) to main and remove test_answer_pivot.py. What remains: - image_tools_agent: final reward is min(1.0, base_reward + aux_reward). - image_tools_agent.yaml: train/validation datasets with license, smaller tool_success_reward / cap and invalid_tool_call_penalty. - Agent tests parametrized over base rewards to check the cap. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Danial Mohseni Taheri <smohsenitahe@nvidia.com>
…-tools-pivot-terminal-to-main Signed-off-by: Danial Mohseni Taheri <smohsenitahe@nvidia.com>
Contributor
|
/ok to test fc6772c |
yfw
approved these changes
Oct 29, 2026
yfw
enabled auto-merge
October 29, 2026 16:59
Contributor
Author
|
@yfw do you have any other comments? |
Contributor
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/40953490358 |
This branch was previously deployed
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.
Part of #3161 (
22f94c44116ac263673ea3aafb5f80b558800e25) fromsuper-v3.5-posttraining, ported tomain. This PR now contains only the image_tools agent (GRPO) changes. The PivotRL terminal-answer changes from #3161 have been removed from this PR.What does this PR do?
Caps the image_tools agent's final reward at 1.0, makes its auxiliary tool-use shaping smaller, and gives the agent config train/validation datasets.
Why. The agent adds auxiliary rewards (tool-success bonus, invalid-call and duplicate-call penalties) to the base reward from the delegated resources server. Before this change, the sum was uncapped, so a correct answer plus tool bonuses could score above 1.0, rewarding extra tool calls on rows the model already answers correctly. Capping at 1.0 keeps a correct answer at most 1.0, and the smaller shaping values keep the auxiliary terms small next to the base reward.
responses_api_agents/image_tools_agent/app.pymin(1.0, base_reward + aux_reward)instead ofbase_reward + aux_reward. Positive bonuses can still raise any score below 1.0; negative penalties still apply at every base score, including a correct answer's 1.0.base_rewardandimage_tools_aux_rewardare still reported separately.responses_api_agents/image_tools_agent/configs/image_tools_agent.yamltrain/validationdatasets (grpo_train.jsonl/grpo_validation.jsonl) with the requiredlicensefield. Withoutlicense, the server is silently demoted to an "almost-server" that never starts. The JSONLs are internal and not checked in.tool_success_reward0.02 → 0.01,tool_success_reward_cap0.20 → 0.05,invalid_tool_call_penalty-0.05 → -0.01.duplicate_tool_call_penaltyis unchanged (-0.02).Tests and docs
responses_api_agents/image_tools_agent/tests/test_app.py: the tool-loop test is parametrized over base rewards0.0 / 0.5 / 0.99 / 1.0→ expected0.02 / 0.52 / 1.0 / 1.0, on top ofmain's entrypoint and capture-mode parametrization.README.md: environment table regenerated withscripts/update_env_list.py(adds the Image Tools Agent row now that the agent config has datasets).Validation
main(2b910d2), then 1013cdf restoresresources_servers/image_toolstomainand removes the PivotRL test file, then fc6772c merges currentmainagain (clean). The net diff againstmainis the 4 files above.nemo-gym[dev]+ server requirements):resources_servers/image_tools/tests,responses_api_agents/image_tools_agent/testsandresources_servers/string_match/tests(the agent's grader): 70 passed.ruff checkandruff format --check(v0.9.9) pass;scripts/update_env_list.pyleaves the README table unchanged.Rollouts
Smoke rollout run on this branch at fc6772c (job on one GB300 node): 12 GRPO rows through
image_tools_simple_agent→string_match(extraction_mode: boxed). Policy: Super-3.5 Omni served with vLLM 0.30 (TP4), temperature 0.6, top-p 0.95,max_output_tokens32768. Rows are internal BabyVision-style VQA items, one per category plus two multiple-choice; answers are not reproduced here.base_rewardimage_tools_aux_rewardrewardmax_tool_calls;max_steps(21) used up before the forced final turnincomplete_detailsunset on every row).reward == min(1.0, base_reward + image_tools_aux_reward); no reward exceeds 1.0. Row 7 is the capped case: 1.00 + 0.03 → 1.00. Before this PR the sum was uncapped, and with the old shaping (0.02 per call) this row would have scored 1.06.image_tools_aux_rewardreconstructs exactly from its tool responses with this PR's config: +0.01 per successful call, −0.02 per duplicate / near-duplicate, −0.01 per invalid call, capped at 0.05 (rows 2, 6 and 10 reach the cap with 13, 20 and 7 calls; with the old values, 0.02 per call capped at 0.20, row 6 would have earned 0.20).reward0.190, meanbase_reward0.167, meanimage_tools_aux_reward0.026. Accuracy (2/12) isn't the point of a 12-row smoke test.max_steps: 21andmax_tool_calls: 20, a rollout that uses all 20 calls gets the forced "final turn" prompt on its last step, so the model never answers it (row 6).max_steps≥max_tool_calls+ 2 would leave room for that answer; happy to follow up separately if useful.Compatibility and benchmark impact
image_tools_agentrewards are capped at 1.0 and the auxiliary terms are smaller, so reward scales of runs using this agent will differ from earlier runs.resources_servers/image_toolsor the PivotRL path.Checklist
pre-commit run --all-files) (so CI lint/format checks pass).git commit -s) (so the DCO check passes).🤖 Generated with Claude Code