Repository navigation
feat(grpo): add exclude_infra masked-reward policy for infra-masked rollouts - #4968
Conversation
… default Add a third grpo.masked_reward_policy value, exclude_infra, and make it the default. A rollout that the environment masked still votes in its group's baseline and std only when its top-level failure_kind is listed in the new grpo.policy_failure_kinds (default: agent_timeout, agent_command_not_allowed, agent_limit, agent_invalid_output, model_context_limit). Any other masked rollout, including one with no failure_kind, gets dataset weight 0 where RL reads the Gym result, so the include population from #4160 leaves it out on the legacy sync, async, TQ and SingleController trainers. include and exclude behave as before. The SingleController token-capture path carries the raw failure_kind through the recovery ledger (schema v4) and ReassemblyRequest.infra_failure. infra_failure_sample_rate reports the share of rollouts left out. Co-authored-by: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
exclude_infra stays available as an opt-in value; the default stays include, as in #4160. Update the config default, the example and reference configs, the GRPO guide and the default test. Co-authored-by: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
yfw
left a comment
There was a problem hiding this comment.
Self review of this draft, left as a comment. There are four inline comments:
- (C1) No test fails if a trainer stops passing
grpo.policy_failure_kindsto its rollout code. Four trainer-level tests and small edits to existing rollout tests close the gap (test_grpo.py#L9586). - (C2) The finalizer test has no row with flag
False. One more parametrize case closes the gap (test_rollout_reassembler.py#L295). - (C3) SingleController drops infrastructure-failed rows from the statistics but logs no
infra_failure_sample_rate(payload.py#L184). - (C4) The YAML comment says that names "may be added", but a recipe list replaces the five defaults (grpo_math_1B.yaml#L16-L17).
These parts are correct at head:
- The worked-example table in the PR description matches a recomputation with the real
calculate_baseline_and_std_per_prompt. - The
includeandexcludevalues ofgrpo.masked_reward_policybehave exactly as before. - The opt-out
env.should_mask_flagged_samples: falseholds on every path. - All tests in the 9 changed test files pass on CPU, except 3 existing tests that need a GPU, which this review did not run. The 22 unchanged test files that use a changed API also pass. Every new test runs in a CI lane.
Generated by Claude Code
…ind forwarding - SingleController now logs infra_failure_sample_rate under exclude_infra: TQReplayBuffer.commit adds it to the rollout metrics on the native path, and finalize_group adds it to the finalizer metrics on the token-capture path. The guide now says that every trainer reports it. - New tests check that each trainer passes grpo.policy_failure_kinds on: legacy grpo_train, the async collector, the TQ sync actor, SingleController setup (TQReplayBuffer and RolloutManager), the RolloutManager store, both places inside the rollout code, and the prompt-group seal. - The finalizer test gets a row whose infra_failure flag is False. - Comments, the guide and the example configurations now say that a recipe that sets grpo.policy_failure_kinds replaces the list (OmegaConf.merge replaces lists), so it must list the defaults with any new name. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
|
/ok to test 23cf9bf |
|
/ok to test 23cf9bf |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
Static review of all 27 changed files and their affected trainer/data-plane paths found no demonstrated correctness regression. The current source addresses the earlier forwarding, finalizer False-row, SingleController metric, and list-replacement feedback.
Two nonblocking suggestions remain:
- (C5) Provide a controlled training comparison for the opt-in policy.
- (C6) Shorten repeated in-function policy explanations while retaining their invariants.
Tests and linters were not executed. Upstream Gym source was unavailable in the mount. Two child reports were unavailable despite terminal completion status; their assigned paths were inspected directly before consolidation.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
The full rule lives in docs/guides/grpo.md and in the rollouts.infra_failure_flags docstring. The call sites now keep a short pointer and their local invariant. Comments only. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
|
/ok to test dfe2133 |
…comparison A failed judge comparison is still dropped. A rollout whose comparisons all failed is now masked alone through the judge failsafe (reward 0.0, mask_sample, failure_kind judge_failed), and its siblings keep their scores. Before, it failed the whole group. The masked rollout is left out of the group's length and style adjustments. When every rollout is left uncovered, the whole group fails as a judge failure, as before. - The server now waits for every comparison to finish or fail, within cohort_evaluation_timeout_s. A non-judge error still fails the group at once and cancels the comparisons still running. - The fixed_baseline path follows the same rule. /compare has no per-response mask, so it still returns 503 when a response keeps no comparison. - Checkpoints save and restore a member masked alone (masked_alone). - New metric: genrm_masked_rollout_rate_per_group. The masked rollout's reward is a placeholder, so a trainer must keep it out of the group statistics: in NeMo RL, grpo.masked_reward_policy exclude_infra (NVIDIA-NeMo/RL#4968) or exclude. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
…kind-advantages Main added rollout recovery schema v4 (token-capture receipts, #4124) and v5 (logical_selection, #4200), so failure_kind moves to schema v6. The ledger still loads v2 to v5, with failure_kind=None. Conflicts kept both sides: failure_kind next to logical_selection in the ledger, SiblingSealResult and both seal calls; infra_failure next to the Forest fields in ReassemblyRequest; the infra metric next to the logical owner counts; the infra sample_mask next to the sampler top-k copy. Main moved row building into _publish_rows, so finalize_group now passes infra_failure in. With forest_training, each segment row takes its rollout's flag, and infra_failure_sample_rate counts rollouts. Tests: the v3 load test is now a v5 load test; the finalizer test sets capture_key, as main's receipts need; a new Forest test checks that the segment rows of a flagged rollout get sample_mask 0. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
|
/ok to test ab0a647 |
…kind-advantages Brings in main 939890a (94 commits). Conflicts, all keeping both sides: - rollout_recovery.py: main's ledger is at schema 8 (6: turn-level recovery, 7: taskset attribution, 8: steps_allowed_short), so the sealed failure_kind moves from 6 to 9; schemas 2 to 8 still load, with failure_kind=None. The failure_kind check sits next to main's attribution_key check. - rollout_manager.py: main's imports plus Collection; main's mask_sample_flagged() next to the failure_kind read. - docs/guides/grpo.md: main unwrapped the guide's sentences (#5211); the exclude_infra text follows that style. - test_grpo.py: main removed the masked_reward_policy default test under its testing rules (#5009); the exclude_infra behaviour tests stay. - test_rollouts.py, test_single_controller_actor.py, test_rollout_reassembler_actor.py: both sides' tests and fields. - test_rollout_manager.py: generate_for_finalization now returns (request, rollout_metrics). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
…mpling under exclude_infra main's SingleController dynamic sampling (#4588, #5202) decides whether a group carries signal from its voting rewards (voting_rewards). It treated exclude_infra like include, so an infrastructure-failed row still voted there although the advantage stage leaves it out. With rewards [0 (infra), 1, 1] the group was kept as mixed, and every row's advantage was then 0. voting_rewards now takes the exclude_infra flags (rollouts.infra_failure_flags) and drops the flagged rows: - native path: RolloutManager._voting_rewards computes them from the completions with grpo.policy_failure_kinds; - token-capture path: the finalizer carries them per reward row as FinalizedGroup.reward_infra_failure. Under include and exclude nothing changes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
terrykong
left a comment
There was a problem hiding this comment.
Review of the exclude_infra follow-up to #4160: one point on the default for env-masked rows (C1), and seven smaller doc, config, test and placement fixes (C2–C8).
- (C1) Please make
exclude_infrathe default once a same-seed run on a recipe that masks samples shows no regression. This is what #4160 promised, and both #4160 reviewers should confirm. - (C2) The guide and one test docstring say OSWorld masks evaluator errors with no
failure_kind; at RL's Gym pin it tags theminfrastructure_error. Wording only; training is unaffected. - (C3) Please cut the long new comments and docstrings to 1–2 lines that point to the guide section.
- (C4) The
infra_failure_sample_ratetest cannot tell a per-row rate from the per-rollout rate; a one-row/two-row split fixes that. - (C5) The
policy_failure_kindslist ingrpo_math_1B.yamloverrides the Python default for every recipe that inherits it, and no test ties the two together; please add a check over every shipped config intest_shipped_config. - (C6) A misspelled name in
policy_failure_kindsraises nothing and silently moves those rows out of the baseline; please check each name with Gym'srequire_failure_kindat setup. - (C7) Please link the Gym source file from the comment above
DEFAULT_POLICY_FAILURE_KINDS. - (C8) Please move
DEFAULT_POLICY_FAILURE_KINDSandFAILURE_KINDintonemo_rl/experience/interfaces.py, next to the other copied Gym names.
Please also correct the PR description's "Risk" bullet. It says swe_agents, anyswe and anyterminal mask limits and timeouts with no kind, so those rows are treated as infra under exclude_infra. At the Gym pin they tag them agent_timeout / agent_limit / model_context_limit (swe_agents/app.py#L359-L381, anyswe_agent/app.py#L160-L215, anyterminal_agent/app.py#L465-L470), so under exclude_infra those rows vote, as under include.
C-numbers here belong to this review; they are unrelated to the C1–C6 in earlier reviews on this PR.
The rest looks solid: the copied Gym kind list has a drift test that fails rather than skips, every mode check goes through one helper, and the trainer math did not change.
Background on how the setting works across the four trainers: https://terrykong.github.io/gh-pages-poc/terryk/pr-4160-who-votes.html
Visual explainer: https://terrykong.github.io/gh-pages-poc/terryk/pr-4968-who-votes-exclude-infra.html
Generated by Claude Code
Review 5898906962 (terrykong): - C1: grpo.masked_reward_policy now defaults to exclude_infra, in the field, grpo_math_1B.yaml, its reference copy and the guide. include keeps the earlier behavior. A same-seed run of both values follows. - C2: the guide and two test docstrings no longer say OSWorld masks evaluator errors with no failure_kind (at the Gym pin it tags infrastructure_error). - C3: long comments and docstrings cut to 1-2 lines that point to the guide. - C4: the forest finalizer test gives its rollouts one and two rows, so a per-row infra_failure_sample_rate (2/3) differs from the per-rollout one. - C5: test_shipped_config checks that every shipped config that sets grpo.policy_failure_kinds keeps all default kinds; the YAML links Gym's list. - C6: under exclude_infra, setup asks one Gym actor to check each policy_failure_kinds name with Gym's require_failure_kind (legacy and SingleController setups), so a misspelled kind stops the run. - C7/C8: DEFAULT_POLICY_FAILURE_KINDS and FAILURE_KIND move to nemo_rl/experience/interfaces.py, with a link to Gym's source file. Setup tests stub the new check the way they stub the dataset coverage check. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
|
/ok to test 425888b |
…nd in-loss table Review by aroshanghias-nvd on #4968: the advantage-estimator module docstring still called include the default, and the in-loss filtering table in the GRPO guide listed include as required although exclude_infra is also accepted (setup rejects only exclude with seq_logprob_error_in_loss). The setup error for exclude now names both values, and the test checks that exclude_infra passes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
|
/ok to test e997ead |
|
/resolve-conflict |
Signed-off-by: svcnemo-autobot <[email protected]>
|
/ok to test 3f9be6a |
…infra default NVIDIA-NeMo/RL#4968 makes masked_reward_policy: exclude_infra the default. Under it, a judge failure is not a policy fault, so a masked judge-failure row leaves the group baseline, and its placeholder does not change the other rollouts' advantages. The judge_failsafe docstring and the judge guide said that the placeholder counts in the baseline under the default include. They now say that it counts only under include, or when a recipe adds the judge's failure kind to policy_failure_kinds. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
…der_reward() and the exclude_infra default #6675 renamed the hook judge_failure_reward() to judge_failure_placeholder_reward(). The lifecycle test reads the hook by name, so it now looks up the new name, and the README names it too. NVIDIA-NeMo/RL#4968 makes masked_reward_policy: exclude_infra the default. The README said that include is the default and that exclude is the setting to choose. It now says that the default exclude_infra keeps a judge-failure row out of the group baseline, and that include is an explicit choice that counts the placeholder. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
…masked_reward_policy Main's #5098 added test_actor_forwards_the_token_capture_setting_to_the_gym_rollout with a SimpleNamespace grpo config that has no masked_reward_policy. On this branch rollout_to_tq passes exclude_infra_policy_kinds(cfg.grpo), which reads that field, so the test raised AttributeError after the merge of main. Real configs always carry it (GRPOConfig defaults it to exclude_infra), so the fake config gets the field rather than the read getting a default. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
|
/ok to test d45e5c5 |
…er choose its placeholder reward (NVIDIA-NeMo#6675) * feat(verification): let a parser's JudgeError name judge_unparseable A parser that finds no verdict in a judge reply can now raise JudgeError(..., failure_kind="judge_unparseable"). judge_failsafe masks the row under that kind and keeps the routing class judge_failed, so recovery judges the row again from its saved answer. Before, every JudgeError was recorded as judge_failed, so a judge that answered without a verdict looked the same as a judge that did not answer. is_judge_failure also accepts a resources server judge_unparseable event, and judge_call_failed takes the kind. JudgeError refuses any other kind. JudgeError without failure_kind still means judge_failed, so existing servers do not change. The judge guide now names this option for an unparseable verdict. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * feat(verification): let a server choose the placeholder reward of a judge failure judge_failsafe hard-coded the masked row's placeholder reward to 0.0. A masked row does not train, but its placeholder still reaches reward metrics. For a server whose scores sit around a neutral value other than 0, a burst of judge failures then reads as a drop in the mean reward. judge_failsafe takes a keyword-only placeholder_reward (default 0.0), and SimpleResourcesServer passes judge_failure_reward(), which returns 0.0 unless a server overrides it. Every existing server keeps 0.0. Masking, failure routing and the sidecar row are unchanged. Tests: tests/unit_tests/verification. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Jiaqi Zeng <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * test(server_runtime): check that /verify uses the server's placeholder reward A SimpleResourcesServer whose verify raises JudgeError returns a masked row with reward 0.0 by default, and with judge_failure_reward() when the server overrides it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(eval): plan a re-judge for a judge failure that names its own kind Collection saves a judge_failsafe row whose failure names its own kind (judge_unparseable, or a provider stop) under that kind, and keeps the producer's judge_failed only as _ng_failure_legacy_class. Recovery planning matched only the exact class judge_failed, and the remote evidence projection dropped the legacy class. So such a row ended as stop/unknown, although gym eval reverify --judge-failed-only selects it. Now: - decide_recovery treats a row as a judge failure when its class or its legacy class is judge_failed, the predicate that the re-judge uses. This covers the sidecar row and the result-row check. - The evidence projection keeps _ng_failure_legacy_class. - The default recovery outcome policy verifies judge_unparseable, as it verifies judge_failed. A provider stop saved through collection now gets its designed handling: it waits for the quota reset, then its saved answer is judged again. Tests: tests/unit_tests/eval/recovery/test_judge_failure_kind_recovery.py runs judge_failsafe, collection and recovery planning for both judge_unparseable forms, a plain judge failure and a quota stop. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(rollouts): count a judge failure as 0 whatever placeholder it carries count_failure_classes_as_zero promises zero-valued metric inputs. First collection drops the reward from a judge-failure row, so it counts as 0. But when the judge fails again in the end-of-run re-judge, the re-judge saves the /verify reply, which carries the failsafe's placeholder reward. _counted_failure_row kept that reward, so a server that overrides judge_failure_reward() (genrm_compare returns 3.0) was counted at its placeholder. _counted_failure_row now counts a row whose class or legacy class is judge_failed as 0.0. Every other class still counts as it stands. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * docs(verification): describe the judge_unparseable kind and the placeholder reward - The judge.py module docstring still told a parser to score an unparseable verdict and not raise. It now names JudgeError(..., failure_kind="judge_unparseable"). - The judge_failsafe docstring said the placeholder reaches reward metrics but no training signal. It now says what each side does: Gym leaves the row out of its aggregates, and a trainer that reads the /run reply gets the placeholder, which NeMo RL's default masked_reward_policy include counts in the group baseline. - The judge guide names SimpleResourcesServer.judge_failure_reward(). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * test: run judge_unparseable through collection, recovery and re-judge - The saved-generation recovery test also runs for judge_unparseable and provider_credentials_rejected. - The collection and re-judge test also runs a JudgeError(failure_kind="judge_unparseable") and a judge_unparseable event. - The failsafe test asserts the kind on the selected failure event, which recovery reads first. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * docs(verification): describe the placeholder under NeMo RL's exclude_infra default NVIDIA-NeMo/RL#4968 makes masked_reward_policy: exclude_infra the default. Under it, a judge failure is not a policy fault, so a masked judge-failure row leaves the group baseline, and its placeholder does not change the other rollouts' advantages. The judge_failsafe docstring and the judge guide said that the placeholder counts in the baseline under the default include. They now say that it counts only under include, or when a recipe adds the judge's failure kind to policy_failure_kinds. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * refactor(server_runtime): rename judge_failure_reward() to judge_failure_placeholder_reward() The hook and the judge_failsafe argument named one concept twice. The hook now carries the same name as the argument it supplies, placeholder_reward. Both are new in this PR, so no alias is needed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> --------- Signed-off-by: Yi-Fu Wu <[email protected]> Signed-off-by: Jiaqi Zeng <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Jiaqi Zeng <[email protected]>
…em 0 (NVIDIA-NeMo#6673) * feat(verification): let a parser's JudgeError name judge_unparseable A parser that finds no verdict in a judge reply can now raise JudgeError(..., failure_kind="judge_unparseable"). judge_failsafe masks the row under that kind and keeps the routing class judge_failed, so recovery judges the row again from its saved answer. Before, every JudgeError was recorded as judge_failed, so a judge that answered without a verdict looked the same as a judge that did not answer. is_judge_failure also accepts a resources server judge_unparseable event, and judge_call_failed takes the kind. JudgeError refuses any other kind. JudgeError without failure_kind still means judge_failed, so existing servers do not change. The judge guide now names this option for an unparseable verdict. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(abstention): parse the judge grade explicitly; score an empty answer as incorrect The fallback 'letter in text' matched any capital A, so "C: NOT_ATTEMPTED" graded CORRECT. A reply that is not a bare letter is now read only from a leading letter, a stated grade, or the last label word. An empty final answer scores incorrect without a judge call instead of likely earning the abstention reward. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Jiaqi Zeng <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(abstention): mask a judge reply without a grade instead of scoring it INCORRECT Before: parse_judge_grade fell back to "B" (INCORRECT) for a judge reply with no A/B/C grade it could read, so the row was trained at incorrect_reward (0.0). Now: parse_judge_grade returns None for such a reply and verify raises JudgeError(judge_unparseable); judge_failsafe turns it into a masked row routed to the failures sidecar. An empty judge reply already masked (judge_failed) and is unchanged; an empty policy answer still scores INCORRECT without a judge call and stays trained. Tests: resources_servers/abstention/tests (41 passed). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Jiaqi Zeng <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(genrm_compare): give a cohort the judge could not score the neutral default_score judge_failsafe hard-coded the masked row's placeholder reward to 0.0. For genrm_compare, a cohort that exhausts its judge retries had every member logged at reward 0 while a scored cohort averages around default_score (3.0), so a burst of judge failures read as a drop in the mean GenRM reward although no masked row trains. judge_failsafe takes a keyword-only placeholder_reward (default 0.0, every other server unchanged); SimpleResourcesServer passes judge_failure_reward(), which genrm_compare overrides to config.default_score, the score an unparseable verdict and a singleton cohort already get. Masking, failure routing and the sidecar row are unchanged. Tests: tests/unit_tests/verification (all pass) and resources_servers/genrm_compare/tests (485 passed together). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Jiaqi Zeng <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(math_with_judge): mask judge replies without a verdict and math-verify failures A judge reply that names neither [[A=B]] nor [[A!=B]] (only reasoning, a refusal, empty or unlabelled text, no output) was scored as unequal, so the row was trained as reward 0. A reply cut at the judge's own output limit was parsed like a complete one. Both now raise JudgeError(judge_unparseable): judge_failsafe masks the row and routes it to the failures sidecar, where recovery re-judges it from the saved answer. math-verify failures (the 10 s child-process deadline, a crashed child, an exception or TimeoutException escaping math_metric, e.g. an expected answer it cannot parse) returned (0.0, None). With should_use_judge the judge already grades the answer in math-verify's place, which is unchanged; without a judge the row was trained as 0 and is now masked as verifier_error. Unchanged: no \boxed / no answer candidate and wrong answers are still trained as 0. Subclasses that grade with their own _verify_answer (physics_judge, ugphysics_judge, math_with_autograder) keep the 0.0 from _verify_answer_with_library_async; polymath and math_tool_rewards inherit the new behaviour. Signed-off-by: Jiaqi Zeng <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(equivalence_llm_judge): mask judge replies cut off or without a verdict A judge reply with no verdict label (no_verdict, unparseable_judge_output) was treated as not equal: the row was trained as reward 0, or went to the full-generation rescue pass. A reply cut at the judge's own output limit (status incomplete) kept whatever label it held, and without one scored 0. Every judge pass whose verdict the grade uses (first, rescue and swap passes) now goes through _judge_verdict, which raises JudgeError(judge_unparseable) for those replies: judge_failsafe masks the row and routes it to the failures sidecar for re-judging. lc_judge runs on this server and gets the same behaviour. A row without its expected_answer was judged against an empty string and trained as 0; it is now masked as verifier_error without calling the judge. Unchanged: empty_final_answer and final_answer_too_long are still trained as 0, and a parsed [[A!=B]] (or conflicting labels, last wins) still scores 0. _generate_judge_evaluation still returns its parse with diagnostics, so subclasses that check it themselves (llm_judge_tool_rewards) keep their own JudgeError. Signed-off-by: Jiaqi Zeng <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(ether0): mask grader exceptions and rows without a usable solution An exception raised by a reward function other than OracleError (a malformed answer_info, a remote oracle client's transport error) was logged and scored 0, so the row was trained as reward 0. The graders score invalid and wrong answers 0 themselves (fuzzing them with malformed SMILES, reactions and text raised nothing), so an exception is the grader's own failure: it is now masked as verifier_error, like the existing OracleError path. A row whose solution string does not parse, or that names an eval function the server does not have, has no usable expected-output spec; it was scored 0 and is now masked as verifier_error. Unchanged: no extractable answer, invalid molecules and wrong answers are still trained as 0. Signed-off-by: Jiaqi Zeng <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(jailbreak_detection): mask a judge failure instead of training it as the unclear reward Before: _request_judge swallowed every judge transport, HTTP, JSON and schema failure and returned (None, error); each verification path (policy-aware verifiers, the legacy safety x quality flow, Nemotron mode) then scored the row with its "unclear" reward (0.0 for safety_check in the live templates) and it was trained. A judge reply with no message text (reasoning only, e.g. cut at the judge's own max_output_tokens) took the same unclear path. Now: _request_judge goes through call_judge, so 408/429/5xx replies, timeouts and lost connections are retried and a call that still fails raises a judge_failed event; a reply without message text, or a reply cut off (incomplete_details set) before any label, raises JudgeError(judge_unparseable). The base server's judge_failsafe turns both into a masked row (mask_sample: true) routed to the failures sidecar. Unchanged: an empty policy answer still scores 0 without a judge call, and a complete judge reply that names neither label keeps the configured unclear reward. Tests: resources_servers/jailbreak_detection/tests (48 passed). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Jiaqi Zeng <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(jailbreak_detection): mask a complete judge reply that names no verdict label Before (after the previous jailbreak_detection commit): a complete, non-empty judge reply naming neither of its labels still scored the "unclear" reward and was trained. That applied to the policy-aware verifiers (rewards.unclear, 0.0 for safety_check), the legacy safety judge (reward_if_unclear), the legacy quality judge (fell back to reward_if_quality_low) and the Nemotron judge (no "Response harm:" verdict). Now: every such reply raises JudgeError(judge_unparseable) on all three scoring paths; judge_failsafe turns it into a masked row routed to the failures sidecar. The failure reason says whether the judge's own output limit cut the reply. The unreachable unclear branches in the legacy flow are removed; reward_if_unclear stays a config field (no longer read) so existing configs still validate. Unchanged: an empty policy answer still scores 0 without a judge call and is trained; parsed SAFE/UNSAFE and per-verifier labels score as before. Tests: resources_servers/jailbreak_detection/tests (50 passed). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Jiaqi Zeng <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(multichallenge): mask a judge reply without a verdict instead of defaulting it to NO Before: _extract_verdict returned "NO" for a judge reply with neither [[YES]] nor [[NO]], and its plain-text fallback matched "NO" as a substring of the last line, so "NOT", "CANNOT", "UNKNOWN" or an empty reply (a judge cut while reasoning) also read as NO. The row was trained, and every rubric item whose pass criterion is NO passed on it. Now: the fallback accepts only a last line that is the bare verdict (optionally bracketed, emphasised or labelled, e.g. "**No**", "Verdict: yes"); any other reply raises JudgeError(judge_unparseable), which judge_failsafe turns into a masked row. Judge transport failures already masked through call_judge and are unchanged. Also: an empty final answer (nothing left once reasoning is stripped) now scores 0 without a judge call, as abstention and jailbreak_detection already do. Judged, it passed NO-criterion items (reward 1.0 on a single-item NO rubric). It stays trained (model's fault). Tests: resources_servers/multichallenge/tests (22 passed). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Jiaqi Zeng <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(inverse_if): mask a judge reply without a verdict by default Before: _extract_verdict returned FAIL for a judge reply with no PASS/FAIL verdict (prose, or an empty reply from a judge cut while reasoning), so the criterion scored FAIL and the row was trained at that score. Now: _extract_verdict returns no verdict for such a reply, and a new knob, fail_on_unparseable_judge_response (default true), raises JudgeError(failure_kind=judge_unparseable); judge_failsafe turns it into a masked row routed to the failures sidecar. Setting the knob to false keeps the old FAIL scoring. A parsed FAIL verdict is unchanged and still trained. Also: an empty final answer (nothing left once reasoning is stripped) now scores 0 without a judge call, as abstention and jailbreak_detection already do; judged, it could pass criteria that only forbid something. It stays trained (model's fault). Tests: resources_servers/inverse_if/tests (25 passed). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Jiaqi Zeng <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * feat(verification): let a server choose the placeholder reward of a judge failure judge_failsafe hard-coded the masked row's placeholder reward to 0.0. A masked row does not train, but its placeholder still reaches reward metrics. For a server whose scores sit around a neutral value other than 0, a burst of judge failures then reads as a drop in the mean reward. judge_failsafe takes a keyword-only placeholder_reward (default 0.0), and SimpleResourcesServer passes judge_failure_reward(), which returns 0.0 unless a server overrides it. Every existing server keeps 0.0. Masking, failure routing and the sidecar row are unchanged. Tests: tests/unit_tests/verification. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Jiaqi Zeng <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * test(server_runtime): check that /verify uses the server's placeholder reward A SimpleResourcesServer whose verify raises JudgeError returns a masked row with reward 0.0 by default, and with judge_failure_reward() when the server overrides it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(eval): plan a re-judge for a judge failure that names its own kind Collection saves a judge_failsafe row whose failure names its own kind (judge_unparseable, or a provider stop) under that kind, and keeps the producer's judge_failed only as _ng_failure_legacy_class. Recovery planning matched only the exact class judge_failed, and the remote evidence projection dropped the legacy class. So such a row ended as stop/unknown, although gym eval reverify --judge-failed-only selects it. Now: - decide_recovery treats a row as a judge failure when its class or its legacy class is judge_failed, the predicate that the re-judge uses. This covers the sidecar row and the result-row check. - The evidence projection keeps _ng_failure_legacy_class. - The default recovery outcome policy verifies judge_unparseable, as it verifies judge_failed. A provider stop saved through collection now gets its designed handling: it waits for the quota reset, then its saved answer is judged again. Tests: tests/unit_tests/eval/recovery/test_judge_failure_kind_recovery.py runs judge_failsafe, collection and recovery planning for both judge_unparseable forms, a plain judge failure and a quota stop. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * test(opencode_multimodal_benchmarks): expect a masked row for an unusable math-judge reply math_tool_rewards inherits math_with_judge's judge parsing, which now raises JudgeError for a judge reply that is cut off or names no verdict (NVIDIA-NeMo#6673). Route the test through judge_failsafe, as the /verify route does, and assert that those cases come back masked (judge_failed / judge_unparseable). Usable verdicts are still graded and shaped as before. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Jiaqi Zeng <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(abstention): read only grades the judge gave, and mask a cut judge reply The grade parser read grades that the judge never gave: - The stated-grade rule ignored case, so the article in "a clear B" read as grade A. The letter is now case-sensitive, and "a" or "an" before it is skipped. - A negated label ("not CORRECT", "isn't CORRECT") read as that label. It is now skipped. - A reply that named two labels graded by the last one, so "INCORRECT. It would be CORRECT only if ..." graded A. A label now counts only when the reply names exactly one distinct label. - A leading letter in bold, italics, code marks, quotes or brackets did not count. It does now. A judge reply cut at its output limit was graded from its unfinished text. _call_judge now raises JudgeError(judge_unparseable) for it, so the row is masked, as math_with_judge and equivalence_llm_judge already do. The README now gives the empty-answer and masking rules. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(jailbreak_detection): keep a known zero, and score a refused judge prompt as unsafe - A row whose safety judge said UNSAFE was masked when another judge gave no verdict, so a harmful answer escaped its 0. When a product reward already has a factor of 0, a judge failure on another factor now keeps the 0. This covers the legacy safety x quality flow and the policy-aware verifiers under reward_combination product. A SAFE row still masks. gather now waits for every verifier, so no judge call keeps running. - A reply cut before any output token means that the judge server refused the prompt for its length. A long jailbroken answer reaches this path. It now scores as the answer's failure (negative, unsafe or low quality) instead of a mask. - A reply cut at the judge's output limit now masks even when it already holds a label, because the label can come from unfinished reasoning. - The single safety judge path joins VERIFY_PATHS in the tests. - reward_if_unclear is removed. The config ignores unknown keys, so a configuration that sets it still loads. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(equivalence_llm_judge): score a refused judge prompt 0, and keep the first pass 0 after a rescue without a verdict - A reply cut before any output token means that the judge server refused the prompt for its length (vllm_model returns such a reply for a prompt longer than the judge's window). The policy controls the answer length, so the pass now scores not equal instead of masking the row. - The rescue pass only adds partial credit to a first pass that said not equal. A rescue reply without a verdict now keeps the first pass's 0. A failed rescue call still masks. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(multichallenge): mask a cut judge reply, and fail an item whose judge prompt was refused - A judge reply cut at its output limit was read for a draft verdict, so a cut reply could pass a rubric item. It now raises JudgeError(judge_unparseable) before the verdict is read. - A reply cut before any output token means that the judge server refused the prompt for its length. The item now fails instead of masking the row. This check runs before the cut-reply check. - Tests pin the end anchor of the bare verdict line ("Not enough information to decide." is no verdict). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(inverse_if): mask a cut judge reply, and fail a criterion whose judge prompt was refused - With fail_on_unparseable_judge_response (the default), a judge reply cut at its output limit now raises JudgeError(judge_unparseable) before the verdict is read. With the setting off, scoring is unchanged. - A reply cut before any output token means that the judge server refused the prompt for its length. The criterion now receives FAIL, with the setting on or off. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(math_with_judge): score a wrong answer that breaks math-verify 0, and a refused judge prompt 0 - With the judge off, a wrong answer that made math-verify time out (for example a large power tower) was masked as verifier_error. When math-verify fails, the server now checks that it still grades the gold against itself. If it does, the answer caused the failure and scores 0. A bad gold or a broken library still masks the row. - A judge reply cut before any output token means that the judge server refused the prompt for its length. The answer now scores as not equal instead of masking the row. This check runs before the cut-reply check. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * docs: describe the masking rules in the GenRM README and reward-profiling manifests - genrm_compare: the failsafe's placeholder reward is default_score, not 0.0. - The abstention notes in the reward-profiling manifests said that parse_judge_grade falls back to INCORRECT. A reply without a grade, or a cut reply, now masks the row. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(rollouts): count a judge failure as 0 whatever placeholder it carries count_failure_classes_as_zero promises zero-valued metric inputs. First collection drops the reward from a judge-failure row, so it counts as 0. But when the judge fails again in the end-of-run re-judge, the re-judge saves the /verify reply, which carries the failsafe's placeholder reward. _counted_failure_row kept that reward, so a server that overrides judge_failure_reward() (genrm_compare returns 3.0) was counted at its placeholder. _counted_failure_row now counts a row whose class or legacy class is judge_failed as 0.0. Every other class still counts as it stands. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * docs(verification): describe the judge_unparseable kind and the placeholder reward - The judge.py module docstring still told a parser to score an unparseable verdict and not raise. It now names JudgeError(..., failure_kind="judge_unparseable"). - The judge_failsafe docstring said the placeholder reaches reward metrics but no training signal. It now says what each side does: Gym leaves the row out of its aggregates, and a trainer that reads the /run reply gets the placeholder, which NeMo RL's default masked_reward_policy include counts in the group baseline. - The judge guide names SimpleResourcesServer.judge_failure_reward(). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * test: run judge_unparseable through collection, recovery and re-judge - The saved-generation recovery test also runs for judge_unparseable and provider_credentials_rejected. - The collection and re-judge test also runs a JudgeError(failure_kind="judge_unparseable") and a judge_unparseable event. - The failsafe test asserts the kind on the selected failure event, which recovery reads first. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(inverse_if): read only a whole PASS or FAIL word in the keyword fallback The keyword fallback of _extract_verdict tested `"PASS" in line` before FAIL on the last lines. So a reply whose last lines held "passenger", "passport", "passing" or "0 out of 3 passed" read as PASS, and the criterion scored 1.0. In a replay of real inverse_if judge replies, 41 of 177 replies used this fallback, and 15 of those got PASS only from such a word. The fallback now reads only the whole word PASS or FAIL, latest line first. A line that names both words is ambiguous, so the reply has no verdict and the row is masked, as for any reply without a verdict. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(inverse_if): read the keyword fallback verdict only in capitals The keyword fallback matched PASS and FAIL in any case. A lowercase word is prose ("Since 5 of 6 criteria pass") and can describe other criteria than the one asked. In a replay of real inverse_if replies, 11 of the 37 replies that used the fallback got their verdict only from a lowercase word, and 2 of those contradicted what the reply said about the asked criterion. Only the whole word PASS or FAIL in capitals counts now, so "Result: Pass" in mixed case also gives no verdict, and the row is masked. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(judges): mask ambiguous, filtered and inconclusive verdicts Signed-off-by: yaoyu-33 <[email protected]> * fix(abstention): reject conflicting grades anywhere in a judge reply Signed-off-by: yaoyu-33 <[email protected]> * fix(math): check the reference after a library grading deadline Signed-off-by: yaoyu-33 <[email protected]> * test(ether0): verify invalid predictions receive a measured zero Signed-off-by: yaoyu-33 <[email protected]> * fix(abstention): give the shipped judge room for more than a bare letter A judge reply cut at max_output_tokens masks the row (judge_unparseable). The shipped configuration gave the judge 64 output tokens, which fits a bare letter only, so a judge that reasons or explains its grade masked every row. The shipped budget is now 8192 tokens, as in the reward-profiling manifests and the multichallenge and inverse_if configurations. A test checks the shipped budget. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * docs(verification): describe the placeholder under NeMo RL's exclude_infra default NVIDIA-NeMo/RL#4968 makes masked_reward_policy: exclude_infra the default. Under it, a judge failure is not a policy fault, so a masked judge-failure row leaves the group baseline, and its placeholder does not change the other rollouts' advantages. The judge_failsafe docstring and the judge guide said that the placeholder counts in the baseline under the default include. They now say that it counts only under include, or when a recipe adds the judge's failure kind to policy_failure_kinds. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * refactor(server_runtime): rename judge_failure_reward() to judge_failure_placeholder_reward() The hook and the judge_failsafe argument named one concept twice. The hook now carries the same name as the argument it supplies, placeholder_reward. Both are new in this PR, so no alias is needed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * refactor(genrm_compare): override judge_failure_placeholder_reward() NVIDIA-NeMo#6675 renamed the hook judge_failure_reward() to judge_failure_placeholder_reward(). Rename the GenRM override with it, so a cohort that the judge failed to score still carries default_score. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(abstention): a quoted question mark is not the judge's doubt An explicit leading grade whose explanation quotes the question, such as 'A: Paris answers the question "What is the capital of France?" exactly.', was masked: the doubt check read the quoted question mark as uncertainty. The parent scored this reply 1.0. Quoted text is now removed before the doubt check. 'maybe', 'perhaps' and 'I cannot' outside quotes still give no grade. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(inverse_if): a cut judge reply scores FAIL when fail_on_unparseable_judge_response is off With the option off, a reply cut at the judge's output limit was still read for verdict words, so one ending 'A bare yes would PASS, however the' scored 1.0. The README says such a reply scores FAIL. A cut reply now scores FAIL without being read; with the option on it still raises judge_unparseable. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> * fix(inverse_if): the keyword fallback reads only a line that states the verdict 'I cannot assign a PASS without further evidence.' got an unmasked 1.0: the fallback took any of the last lines with exactly one capital PASS or FAIL. That line must now state the verdict: the word alone, or after a label such as 'Result:' or 'Verdict:' (also a JSON "result" line whose block does not parse), with an optional reason after it. A verdict word inside a sentence gives no verdict, so the row is masked by default. On the 167 saved real judge replies of the NVIDIA-NeMo#6673 replay, 2 replies change (one FAIL that belonged to another criterion, one PASS inside prose), both in a row that is already masked; no row outcome changes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]> --------- Signed-off-by: Yi-Fu Wu <[email protected]> Signed-off-by: Jiaqi Zeng <[email protected]> Signed-off-by: yaoyu-33 <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Jiaqi Zeng <[email protected]> Co-authored-by: yaoyu-33 <[email protected]>
What and why
Adds a third
grpo.masked_reward_policyvalue,exclude_infra, and makes it the default. With it, a rollout that the environment masked for an infrastructure reason, or with nofailure_kindat all, no longer moves the baseline and advantages of the valid rollouts in its group. This is the follow-up promised in #4160, which said that environment-masked rows would not count by default, except for failure kinds the policy caused. A recipe that wants the earlier behavior setsinclude.Problem. #4160 added
grpo.masked_reward_policy: include | exclude, withincludeas the default. Underinclude, a masked rollout is still part of its group's baseline and std. It never trains, but its reward still moves the advantages of its valid siblings, including when that reward measured nothing.Example: an environment masks an evaluator error. Take a group with rewards
[1, 1, 0], where the 0 is that evaluator error. Underinclude, the two valid rollouts get raw advantages[0.5, 0.5]instead of[0, 0].excludeavoids this, but it also drops masks that the policy itself caused (timeouts, step limits, context overflow) and trainer-filtered rows. Those rewards are real measurements of the policy.Change.
exclude_infra, now the default (it wasinclude). A masked rollout still counts in its group's baseline and std only if its top-levelfailure_kindis in the newgrpo.policy_failure_kinds. The default list isagent_timeout,agent_command_not_allowed,agent_limit,agent_invalid_outputandmodel_context_limit.MODEL_FAULT_KINDSofnemo_gym/core/failure_kinds.pythat a producer emits, without the model-call kindsmodel_request_errorandmodel_policy_response_timeout. Gym's evaluation counts a failed or timed-out policy call as the model's result, but in training the policy server is part of the setup. RL cannot import the list at config time (the driver of a Gym run starts without thenemo_gymextra), so the default list is a copy innemo_rl/experience/interfaces.py, next to the other copied Gym names, and a Gym-lane test fails when the two drift apart. Today's Gym main (d1f6955e4) gives the same five kinds. It has two kinds that are newer than RL's Gym pin,git_worktree_commit_rejectedandmodel_server_queue_timeout, and both are infra kinds, soexclude_infradrops them from the statistics.<server>:<kind>names. Only that rollout leaves; the rest of its group still trains.OmegaConf.mergereplaces lists. So a recipe that adds a name must also list the defaults.exclude_infra, one Gym actor checks each name with Gym'srequire_failure_kind, so a misspelled kind stops the run instead of moving real policy rows out of the statistics. Any namespaced<server>:<kind>name passes.test_shipped_configchecks that every shipped config that setsgrpo.policy_failure_kindslists all the default kinds.mask_sample.includeandexcludebehave exactly as before.env.should_mask_flagged_samples: false, nothing is masked, so nothing is treated as infra.includeexclude_infra(default)excludepolicy_failure_kindsThe guide section "Masked rewards in advantage statistics" in
docs/guides/grpo.mdandexamples/configs/grpo_math_1B.yamldocument the new value and key.How it works
No new data-plane or trainer column is needed.
loss_multiplier), the same as an unusable over-length prompt. Theincludepopulation from feat(grpo): configurable masked-reward participation across the four trainers #4160 (_include_valid_mask) then leaves it out on all four trainers: legacy sync, async, TQ and SingleController.grpo.py:_votes_by_dataset_weight()is true forincludeandexclude_infra. The estimator, dynamic-sampling admission and the logprob mask use it.exclude_infra_policy_kinds()returns the policy list only underexclude_infra.rollouts.infra_failure_flags()marks the rows. The group builder sets theirloss_multiplierto 0 and logsinfra_failure_sample_rate.record_to_train_batchsetssample_maskto 0.TQReplayBuffercarries the policy list and logsinfra_failure_sample_rate.failure_kindinto the recovery ledger.ReassemblyRequest.infra_failuremakesfinalize_groupwritesample_mask0 and loginfra_failure_sample_rate. Withforest_training, every segment row of a flagged rollout gets the 0, and the rate counts rollouts, not rows.includepath now also coversexclude_infra.dynamic_sampling.voting_rewards) leaves the infra rows out too, so it sees the same voters as the advantage stage. The native path computes the flags inRolloutManager._voting_rewards; the token-capture path carries them asFinalizedGroup.reward_infra_failure.grpo.agent_overrides, feat(grpo): per-environment GRPO settings (grpo.agent_overrides) #5321): they work withexclude_infraunchanged. Its voters do not depend onoverlong_filtering, so the check for a per-environmentoverlong_filteringunder dynamic sampling stays limited toexclude.A search of
nemo_rl/found no other reader that treatsloss_multiplier == 0as "prompt too long".Worked example (GRPO estimator, leave-one-out baseline,
normalize_rewards: true)The group has five rollouts:
agent_timeout.includeexclude_infraexcludeinclude, the valid rollouts' advantages depend on E, which measured nothing.exclude_infradrops E and keeps D, because a timeout is a real failure of the policy.What changes with the new default
Every recipe that does not set
masked_reward_policynow usesexclude_infra. Training changes wherever a group contains masked rollouts without a policy kind; elsewhere it is the same as underinclude. A recipe that wants the earlier behavior setsinclude.Known cases:
failure_kind: judge_failed; their reward is a 0.0 placeholder.agent_timeout,agent_limitormodel_context_limit, so those rows count underexclude_infra, as underinclude. Their sandbox failures and anyterminal's eval-command timeout (anyterminal_agent:eval_timeout) are infra.critpt_custom_grader:response_incompleteandpartner_if:evidence_too_large. A recipe can list them ingrpo.policy_failure_kinds, together with the defaults.agent_timeout: listed as a policy kind, although wall time also includes slow model servers or VMs.Usage
Issues
Related to #4061 and follows up on #4160. On the Gym side, NVIDIA-NeMo/Gym#4882 is adding
failure_kindto masked results that lack one.Convergence / perf / functionality proof
This PR changes training for every recipe that does not set
masked_reward_policyand whose environment masks rollouts without a policy kind. The checks below show that it changes the advantages as intended. They do not show convergence.Same-seed run for the new default (
includeagainstexclude_infraat425888bc4): Qwen3-1.7B on GSM8K through Gymequivalence_llm_judge, which sends every answer to the judge. A proxy refuses a fixed 10% of judge prompts, so 9.9% of rows are masked asjudge_failed.exclude_infrashowed no regression: validation accuracy 0.777 against 0.758 at step 150 (ahead from step 50 on), higher train reward from step 26 on, and the same KL. One seed per arm. Details and the full table are in the C1 thread. Still open: @mehraakash and @aroshanghias-nvd, the #4160 reviewers, confirm the new default.Training check (a small real run, with injected masks)
Two GRPO jobs ran this PR at
dfe2133bd. Qwen3-0.6B trained on GSM8K through NeMo Gym'smath_with_judgeserver, with the legacy sync trainer: 16 prompts × 8 samples, 5 steps, one GB200 node per job, the same seed and data. The jobs differ only ingrpo.masked_reward_policy:includeorexclude_infra(defaultpolicy_failure_kinds).At RL's Gym pin at that time, no environment put a policy kind on a masked row. So a local test patch in
math_with_judge(not part of this PR) masked about a third of the rows with a reward of 0. A hash of the prompt and the sample index picked the rows, so both jobs masked the same rows. The kinds took the normal Gym → RL path.exclude_infrainfra_failure_sample_ratetoken_mult_prob_error(1.011 to 1.014) were about the same in both jobs.Local results (CPU workstation, at
425888bc4, merged withmainineb698bc62)test_config_validation.pythat do not apply to a given recipe.--nemo-gym-only tests/unit): 1,377 passed and 19 errors. The 19 errors are environment errors on this workstation, in tests this PR does not change. 14 tests start Gym servers whose local venvs predate the current Gym pin, and this machine'suvis older than that pin requires. 5 tests start a real vLLM worker, whose local venv predates main's vLLM version. The tests for the default kinds against Gym's list and for the setup name check pass.Tests added and mutation checks
test_trainers_infra_masked_reward_never_moves_valid_siblings:grpo_train,async_grpo_trainandgrpo_train_syncunder all three values.include.test_advantage_stage_infra_masked_reward_never_moves_valid_siblings: the same check on the SingleController advantage stage, with the GRPO, GDPO and Reinforce++ estimators (9 cases).grpo.policy_failure_kindson: legacygrpo_train, the async collector, the TQ sync actor, SingleController setup,RolloutManager, both places inside the rollout code, and the prompt-group seal.infra_failure_flags;infra_failure_sample_rateon the SingleController native and token-capture paths;exclude_inframatchingincludeon every row that is not infra;[0 (infra), 1, 1]has no signal underexclude_infra, and the record and finalized adapters pick the same voters;policy_failure_kindsmatching Gym's shared kind list (Gym lane).exclude_infratrainer cases and the ingestion test fail.voting_rewards, in the finalizer or in the finalized adapter makes a dynamic-sampling test fail. Removing a kind from the default fails the Gym-lane test.Needs upstream changes
None. RL already reads the top-level
failure_kindfrom Gym at its current pin. NVIDIA-NeMo/Gym#4882 gives more masked results a kind, but this PR does not need it. The same holds for the open NVIDIA-NeMo/Gym#6673 (stacked on NVIDIA-NeMo/Gym#6675), which gives judge replies with no verdict a kind. Those are infra kinds, soexclude_infradrops those rows.PR commands and CI
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./review: automated review comments. Addmode=strictfor a stricter review,reset=truefor a fresh full review./resolve-conflict: Autobot mergesmaininto this PR and resolves the conflicts. PRs from forks must allow edits by maintainers./review-pr-team <pr-number>for a team review before you ask for human review.🤖 Generated with Claude Code