Skip to content

fix(verification): mask judge replies without a verdict, not score them 0 - #6673

Merged
yfw merged 46 commits into
mainfrom
yifuw/mask-judge-replies-without-verdict
Dec 2, 2026
Merged

yfw merged 46 commits into
mainfrom
yifuw/mask-judge-replies-without-verdict

Conversation

@yfw

@yfw yfw commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

What changed

Several resources servers scored a row 0, or a fixed fallback grade, when the judge gave no verdict or the judge call failed. In training, that row was trained as if the policy failed. In evaluation, it counted as a wrong answer. This PR masks those rows instead. A masked row has mask_sample: true and a failure_kind (judge_failed, judge_unparseable or verifier_error). A judge_failed or judge_unparseable row goes to the failures sidecar, and gym eval reverify --judge-failed-only judges it again from the saved answer. A verifier_error row (math_with_judge without a judge, ether0, and equivalence_llm_judge without expected_answer) stays in the rollouts file as a masked row. Recovery does not grade it again, and the acceptance gate reports such a run as not complete.

A wrong answer, a missing answer and a parsed negative verdict still score 0 and stay in training. So does an answer too long for the judge's context window: the judge server refuses that prompt, and the reply is cut before any output token.

These changes were written by Jiaqi Zeng (@HeyyyyyyG). New in this PR: the port of the inverse_if change onto the inverse_if server on main, and the review fixes in the last seven commits. The opencode_multimodal_benchmarks test fix is Jiaqi's commit from #6676.

Core (in #6675)

This PR stacks on #6675. That PR adds the two core options that these servers use:

  • JudgeError(..., failure_kind="judge_unparseable"): judge_failsafe masks the row under that kind, and recovery judges it again.
  • judge_failsafe(verify_fn, *, placeholder_reward=0.0) and SimpleResourcesServer.judge_failure_placeholder_reward(): a server can choose the placeholder reward on its masked rows.

This branch has the core commit first and a merge of the #6675 branch, so its diff against #6675 shows only the server changes. Merge #6675 first.

Servers

Server Before Now
abstention A reply that was not a bare letter matched any capital A, B or C, so C: NOT_ATTEMPTED graded CORRECT. A reply without a grade scored INCORRECT. A cut reply was graded from its text. The judge graded an empty final answer. The parser reads a leading letter (also in bold, quotes or brackets), a stated grade ("The grade is B", not the article in "a clear B") or a single label word that is not negated. A reply that names two different labels has no grade. A reply without a grade, or cut at the judge's output limit, is masked (judge_unparseable). An empty final answer scores INCORRECT without a judge call.
genrm_compare The masked rows of a cohort that the judge failed to score carried reward 0.0. A burst of judge failures looked like a drop in the mean GenRM reward. The masked rows carry default_score (3.0 by default), the score that an unparseable verdict already gets. They stay masked.
math_with_judge A judge reply without [[A=B]] or [[A!=B]], or cut off at the judge output limit, scored 0. A math-verify timeout, crash or exception scored 0. Such a judge reply is masked (judge_unparseable). A reply cut before any output token (a refused prompt) still scores 0. When math-verify fails, the server checks that it still grades the gold against itself. If it does, the answer caused the failure and scores 0. If not (a bad gold or a broken library), the row is masked (verifier_error) without a judge, and with a judge the judge grades in its place. polymath and math_tool_rewards inherit this. physics_judge, ugphysics_judge and math_with_autograder keep their own grading.
equivalence_llm_judge (also lc_judge) A judge pass without a verdict label scored 0 or went to the rescue pass. A cut-off reply kept any label it held. A row without expected_answer was judged against an empty string. The first and swap passes mask the row when the reply is cut off or has no label (judge_unparseable). A reply cut before any output token (a refused prompt) scores not equal. A rescue pass without a verdict keeps the first pass's 0. A row without expected_answer is masked (verifier_error) without a judge call.
ether0 A grader exception other than OracleError, a solution that does not parse, or an unknown eval function scored 0. Each of these is masked (verifier_error).
jailbreak_detection _request_judge caught every judge failure and returned the "unclear" reward (0.0 for safety_check). A complete reply without a verdict label also got that reward. The judge call goes through call_judge, so 408, 429 and 5xx replies, timeouts and lost connections are retried. A call that still fails, a reply without text, a cut-off reply (even one that holds a label) and a reply without a label are masked. When a product reward already has a factor of 0 (UNSAFE), a judge failure on another factor keeps the 0. A reply cut before any output token (a refused prompt) scores as unsafe or low quality. The server no longer has reward_if_unclear. A configuration that sets it still loads, and the server ignores the key.
multichallenge A reply without [[YES]] or [[NO]] read as NO, and the fallback matched NO inside NOT, CANNOT or UNKNOWN. Every rubric item whose pass criterion is NO passed. The judge graded an empty final answer. Only a last line that is the bare verdict counts. Any other reply, and a reply cut at the judge's output limit, is masked (judge_unparseable). A reply cut before any output token (a refused prompt) fails the item. An empty final answer scores 0 without a judge call.
inverse_if _extract_verdict returned FAIL for a reply without a verdict. Its keyword fallback read PASS inside any word ("passenger", "passport", "passing", "passed"). The judge graded an empty final answer. A new config field, fail_on_unparseable_judge_response, defaults to true, so such a reply, or a reply cut at the judge's output limit, is masked (judge_unparseable). Set it to false to keep the FAIL score. A reply cut before any output token (a refused prompt) receives FAIL. The keyword fallback reads only the whole word PASS or FAIL in capitals, and a line that names both is no verdict. An empty final answer scores 0 without a judge call.

inverse_if keyword fallback

When a judge reply has no JSON verdict, _extract_verdict reads PASS or FAIL from its last lines. It tested "PASS" in line before FAIL, so "C1 fails because no passenger capacity is given. C2 fails. The response scores 0." read as PASS (score 1.0). In an interim count of the replay of real inverse_if rows with a hosted judge (177 judge replies), 41 replies used this fallback, and 15 of those 41 got PASS only from a word that contains PASS. In the final replay sample under "Rollout evidence" (167 inverse_if replies at 638bdb56b9), 31 replies used the fallback, and 14 of its 27 fallback PASS grades came 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. The match is also case-sensitive: a lowercase or mixed-case word ("Since 5 of 6 criteria pass", "Result: Pass") is prose, not a verdict. In the final replay sample, 37 of the 167 inverse_if replies at 0495436970 used the fallback. 11 of them got their verdict only from a lowercase word, and 2 of those 11 contradicted what the reply said about the asked criterion. No row outcome changes in that sample, because those rows are masked by other replies.

Why

A judge reply without a verdict measures nothing about the answer. A 0 for it trains the policy against a judge failure, and it lowers benchmark scores for a reason outside the model. A masked row keeps the saved answer, so recovery can judge it again.

Benchmark and training effect

Training:

  • Rows that got 0, the unclear reward, FAIL or NO after a judge failure or a reply without a verdict are now masked. NeMo RL leaves a masked row out of the loss when env.should_mask_flagged_samples is on, which is its default.
  • A masked row still carries a placeholder reward: 0.0, or default_score for genrm_compare. Under NeMo RL's default grpo.masked_reward_policy: exclude_infra (feat(grpo): add exclude_infra masked-reward policy for infra-masked rollouts RL#4968), rows with these kinds (judge_failed, judge_unparseable, verifier_error) leave the group baseline and standard deviation, so the placeholder does not change the other rollouts' advantages. Under include, the placeholder still counts there, and the effect is largest for inverse_if and multichallenge: one rubric item without a verdict puts 0.0 for the whole row into its group's baseline. In one example with 8 rollouts, the advantage of the worst real answer moves from -2.45 to -0.32.
  • inverse_if now defaults fail_on_unparseable_judge_response to true. Before, inverse_if had no such field and always scored FAIL.
  • In abstention, multichallenge and inverse_if, an empty final answer scores 0 without a judge call and stays in training. Before, the judge sometimes gave it the abstention reward, or passed rubric items that only forbid something.

Evaluation: a masked row leaves the aggregate. Only the judge_failed and judge_unparseable rows go to <output>_failures.jsonl. A verifier_error row stays in the rollouts file as a masked row. In Gym's evaluation, when no reward is below 0, removing a row that scored 0 can only raise or keep a mean score. A cut-off judge reply that held a label used to be graded by that label, sometimes 1.0, so on configurations with a judge a mean can also go down. NeMo RL validation averages every row's reward, placeholders included. There a masked inverse_if or multichallenge row counts 0.0, and a masked genrm_compare row counts 3.0, which pass_k counts as a pass. The configs that use these servers:

Benchmark configs Server What changes in the numbers
aime24, aime24-x, aime25, aime25-x, aime26, apex25, apex_shortlist, gsm8k, hendrycks_math, hmmt_feb25, hmmt_nov25, indic/aime_2026, indic/math_500, math-500 math_with_judge, judge off A math-verify failure that also fails on the gold (a bad gold or a broken library) leaves the aggregate instead of counting as wrong. A failure caused by the answer still counts as wrong. Scores change only where such failures happened.
polymath polymath (inherits math_with_judge), judge off Same as the row above.
arxivmath_0526, arxivmath_0626 math_with_judge, judge on A judge reply without a verdict, or cut off, leaves the aggregate instead of counting as wrong.
financebench, hle, hle_diamond, hle_verified, secque equivalence_llm_judge A judge reply that is cut off or has no verdict, and a row without expected_answer, leave the aggregate instead of counting as 0.
ether0 ether0 Grader exceptions and rows without a usable solution leave the aggregate.
resources_servers/equivalence_llm_judge/configs/nl2bash-equivalency.yaml (verified: true) equivalence_llm_judge A first or swap judge reply that is cut off or has no label is masked instead of scoring 0, so the verified baseline can change.
nemotron_3.5_super/reward_profiling, nemotron_3.5_super/batch_configs, nemotron_3.5_super/benchmark_configs abstention, multichallenge, inverse_if, math_with_judge, equivalence_llm_judge, ether0 The reward profiles count fewer zeros from judge failures and more masked rows. The abstention profile also changes because the parser reads only grades that the judge gave (C: NOT_ATTEMPTED no longer grades CORRECT), and an empty answer no longer gets the abstention reward.

No config under benchmarks/ uses genrm_compare or jailbreak_detection. nl2bash-equivalency.yaml is the one verified: true configuration whose grading changes.

Compatibility

Related PRs and merge order

Suggested order: #6675 first, then this PR. Then #5919 with a one-line rebase, and #5403 closes. #5330, #5923, #6260 and #6263 can merge in any order.

Validation

All runs used Python 3.13.14 on CPU, at the head of this branch (with the review fixes).

pre-commit run --all-files
# passed (every hook)

pytest tests/unit_tests/verification
# 94 passed

ng_test +entrypoint=resources_servers/<server> +should_validate_data=true
# abstention 43 passed, genrm_compare 394 passed, math_with_judge 145 passed,
# equivalence_llm_judge 221 passed, ether0 128 passed (4 skipped), jailbreak_detection 68 passed,
# multichallenge 26 passed, inverse_if 39 passed. Example data validated for each.
# Servers that reuse the changed ones: polymath 10, math_tool_rewards 16, physics_judge 31,
# ugphysics_judge 23, math_with_autograder 27, llm_judge_tool_rewards 85 passed.
# opencode_multimodal_benchmarks: 645 passed, 17 skipped.

opencode_multimodal_benchmarks builds a math_tool_rewards server in test_math_judge_records_final_shaped_grade. PR CI does not run it, because that folder does not change. Without the test fix from #6676, 9 of its 18 cases fail on this branch.

Before the review fixes, the full core run (pytest tests/unit_tests -n 8) gave 25155 passed, 127 failed (125 tests and 2 subtests) and 10 errors. The same tests also fail on main at d711cd1577 in this environment, because they need packages or services that the local dev environment does not have, for example opensandbox, mlflow, tenacity and cloudpickle. The review fixes change only resources servers, their tests and docs.

The new tests fail without the code change. Examples: the refused-prompt tests in equivalence_llm_judge, math_with_judge, multichallenge, inverse_if and jailbreak_detection (4 paths), the two jailbreak_detection tests that keep a known zero, and 5 of the first inverse_if tests.

Merge check: with #5330 merged on top of the branch before the review fixes, ng_test +entrypoint=resources_servers/genrm_compare gave 414 passed. The review fixes change only the genrm_compare README.

Rollout evidence

Replay of real judge replies (C8). 796 training rows of the 8 changed server configurations, with answers mostly from hosted Nemotron models. One hosted LLM judge used the training judge settings (65,536-token cap, temperature 1.0) and gave 900 replies. Each reply was saved once and then graded by main (a9e73574a2) and by this head (0495436970).

  • 758 of 796 rows got the same outcome. No masked row was unmasked, and no row changed its failure kind.
  • 27 rows had an empty final answer and now score 0 without a judge call. At main, the judge graded the empty answer and paid it: abstention 18 rows at 0.5 (NOT_ATTEMPTED), multichallenge 6 and inverse_if 3 rows at 0.125 to 1.0.
  • 11 rows are newly masked as judge_unparseable. 9 inverse_if rows have a reply in another score format. In 7 of them, main read PASS or FAIL from inside a word such as "passed" or "fails". 1 multichallenge reply gave its verdict in another language, and 1 jailbreak_detection reply was cut at its output cap.
  • equivalence_llm_judge (both configurations, 132 judged rows), math_with_judge (43 judged rows, and 149 rows with the judge off) and ether0 (88 rows) did not change.
  • No judge reply was cut before its first output token, so the refused-prompt rule did not apply in this sample.
  • The 27 judge replies saved in the committed example_rollouts.jsonl files parse the same at main and at this head.
  • The fallback then became case-sensitive. In this sample, 11 replies lose a verdict taken only from a lowercase word (2 of them contradicted the reply), and no row outcome changes.

Issue

No issue. Each commit message names the bug that it fixes.

🤖 Generated with Claude Code

yfw and others added 11 commits November 23, 2026 14:58
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]>
…wer 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]>
…g 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]>
…al 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]>
…erify 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]>
…erdict

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]>
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]>
… 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]>
…erdict 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]>
…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]>
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]>
@copy-pr-bot

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

@yfw yfw added area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers bug Something isn't working needs-review PR is ready for code review and waiting on a reviewer labels Nov 23, 2026
@yfw

yfw commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 73a2a3c

@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 23, 2026 23:15
HeyyyyyyG and others added 2 commits November 23, 2026 15:17
…udge 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]>
…r 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]>
@github-actions

Copy link
Copy Markdown
Contributor

…eplies-without-verdict

Stack this branch on the core PR #6675, which adds the JudgeError
failure_kind and the judge_failsafe placeholder_reward that these
servers use.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Yi-Fu Wu <[email protected]>
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the risk:high Autobot PR risk: high label Nov 23, 2026
@yfw
yfw changed the base branch from main to yifuw/judge-error-failure-kind November 23, 2026 23:21
@yfw

yfw commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 1536fe3

@yfw

yfw commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. On the two points outside the diff, and the crash case:

  • Abstention judge cap: agreed. 08fee2c raises the shipped cap to 8192, the same as the reward-profiling manifests, with a test that reads the shipped config.
  • Math with the judge off, a crashed grading process: we keep this one masked on purpose. A crash can come from the machine rather than the answer, and a wrong 0 would train against a right answer. Timeouts and errors inside the process now score 0 when the reference grades (88b9d08, 3b4fb14).
  • nl2bash-equivalency: we have no saved nl2bash judge replies, so there is no measured before and after. From the code, a complete [[A=B]] or [[A!=B]] reply grades the same as on main. Only a reply with no label, a cut reply, or an empty expected answer changes, and each goes from scored to masked, so rows that stay scored keep their reward. Separately, this config's inline bash prompt has been unused since Upstream Super 3 dev 20260205 #654 (the server reads only judge_prompt_template_fpath): equivalence_llm_judge: nl2bash-equivalency's bash judge prompt is ignored #6985.

yfw and others added 4 commits November 30, 2026 17:41
…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]>
…ure_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]>
…eplies-without-verdict

Bring in #6675's exclude_infra wording and the rename of judge_failure_reward()
to judge_failure_placeholder_reward().

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Yi-Fu Wu <[email protected]>
#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]>
@yfw

yfw commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 5f6e046

yfw added a commit that referenced this pull request Dec 1, 2026
…ache-pack-stop-masks

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Yi-Fu Wu <[email protected]>
yfw and others added 2 commits November 30, 2026 17:55
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Yi-Fu Wu <[email protected]>
…eplies-without-verdict

Bring in #6675's merge of main dd09637. Resolve jailbreak_detection with
main's #6393: the judge-failure paths that #6393 marked as scored despite a
failure no longer exist here, because a failed judge call now masks the row.
The one judge failure this branch still scores, a known zero kept when
another judge fails, is recorded as scored despite a failure.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Yi-Fu Wu <[email protected]>
@yfw

yfw commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test d4d0b65

@yaoyu-33 yaoyu-33 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I replayed synthetic judge replies through the verifiers. Abstention masked an explicit grade, and Inverse IF awarded full credit in two cases where the judge gave no verdict.

Comment thread resources_servers/abstention/app.py Resolved
Comment thread resources_servers/inverse_if/app.py Resolved
Comment thread resources_servers/inverse_if/app.py Resolved
yfw and others added 4 commits December 1, 2026 20:48
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]>
…le_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]>
…he 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 #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]>
@yfw

yfw commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 323532d

yfw added a commit that referenced this pull request Dec 2, 2026
@yfw
yfw added this pull request to the merge queue Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/46939222208

Merged via the queue into main with commit 11c6f88 Dec 2, 2026
69 checks passed
@yfw
yfw deleted the yifuw/mask-judge-replies-without-verdict branch December 2, 2026 18:41
katherineh123 pushed a commit to katherineh123/Gym that referenced this pull request Dec 2, 2026
…ack and failure kinds for budget-stop masks (NVIDIA-NeMo#6676)

* feat(browsecomp): read-only pack behind the flat search cache

The search cache keeps one flat file per entry. A long-lived cache of millions
of entries is then millions of small files, which a shared filesystem handles
badly (metadata load, file-count quota, slow copies). This adds a read-only
pack of the same entries in 512 shard file pairs, behind the flat cache.

- search_cache_pack.py: the pack format and its reader. One shard holds the
  flat files of one <kind>/<ab>/ directory. Reads use pread on long-lived file
  descriptors. Any read or corruption error is a counted miss, never an error
  in a rollout.
- search_cache.py: a read tries the flat file first and goes to the pack only
  when the flat file does not exist. A corrupt flat file stays a miss, and a
  pack entry passes the same shape check. Writes always go to flat files. The
  pack is on only when pack/MANIFEST.json exists. New stats: search_pack_hits,
  browse_pack_hits and pack_errors.
- build_cache_pack.py: an offline tool that builds, verifies and finalizes the
  pack, reports its status, unpacks it again (rollback), and lists the flat
  files that are byte-identical to their packed copy.
- app.py: the startup log names the pack generation.

A cache root without a pack behaves 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]>

* feat(browsecomp): config-gated masks on the agent's /run, and verify timed-out rollouts

This lets a training config mask budget stops and agent errors in the agent
itself, on the legacy /run path:

- mask_stop_reasons (default empty): a row whose response ends with one of
  these stop_reason values comes back with mask_sample true and its judged
  reward kept. A training framework reads mask_sample from the row.
- mask_agent_errors (default false): a row that ended in an agent error
  (scored 0 with agent_error, for example a /verify 500 after a judge that
  never answered) comes back masked instead of as an unmasked 0.
- A timed-out rollout now goes to /verify like any other. The resources
  server already scores it 0 without the judge. On this path no close is
  sent, so the verify is what releases the session's tool sandbox and
  workspace. The old timeout branch skipped that.

The defaults keep the previous scoring.

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(browsecomp): with resets off the agent's history only grows (token-capture prefix)

A training config can run the host loop with max_reset_count 0 and with the
progress board and step nudges on. Token capture links each model call to the
one before it by prefix. This test checks call by call that every input
extends the previous input and output under those settings (prompts over the
reset threshold on every call, nudges at the quarter, half and near-end
steps). It also checks that the same run with resets uncapped does rewrite the
history.

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(opencode_multimodal_benchmarks): train rollouts cut mid-tool by their timeout

Before, trajectory_tool_reward raised ToolEvidenceError for any tool record
left "incomplete", so a rollout that hit its wall-clock timeout while a tool
was running was masked (verifier_error) and never trained. A rollout timeout is
the model's budget, so when the tool's root invocation records the harness
deadline (status "incomplete", error_type "timeout", set by the OpenCode agent
when its process timed out) the cut tool now scores as a failed call, like a
tool's own timeout, and the row is graded normally (usually 0) and trained.

Still masked: missing records, "unknown" outcomes, and unfinished tools under a
root that did not record a timeout (cancelled, server error, or no evidence).
Shared by math/mcqa/string_match/llm_judge_tool_rewards and Agent-X.

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(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(browsecomp,opencode_multimodal): mark budget-stop masks with a model-stop failure kind

A trainer can keep a masked row in the group baseline only when the mask
comes from the rollout's own budget. It needs a failure kind to tell that
mask from an infrastructure failure.

- browsecomp_agent: a row masked by mask_stop_reasons carries failure_kind
  agent_limit (max_steps), agent_timeout (timeout), model_context_limit
  (context_full), or browsecomp_agent:<stop_reason>, unless the resources
  server already set a kind.
- opencode_multimodal_benchmarks: a rollout cut mid-tool by its wall-clock
  deadline is masked again (reward 0, as before the earlier fix in this
  series), now with failure_kind agent_timeout. Any other unfinished or
  unknown tool evidence stays a verifier_error mask and takes precedence.

Signed-off-by: Jiaqi Zeng <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Yi-Fu Wu <[email protected]>

* docs(browsecomp): describe the /run masks and the timed-out verify

- browsecomp_agent README: give the legacy /run mask options their own
  paragraph and list each stop's failure kind.
- browsecomp_advanced_harness: a comment said that the agent's /run scores a
  timed-out rollout without a verify. The /run now sends it to /verify too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Yi-Fu Wu <[email protected]>

* fix(browsecomp): keep the timed_out update text that run health greps for

nemo_gym/rollouts/health/timeouts.py lists browsecomp_agent's timed_out field
as a legacy timeout signal. A core test checks that its producer still holds
the text update={"timed_out": int(bool(. The stop-reason mask had moved the
value into a local dict, so the check failed although the field is still
written. Build the stop-reason mask first and pass the timed_out update
inline again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Yi-Fu Wu <[email protected]>

* fix(browsecomp): tighten the /run masks after review

- A timed-out rollout whose /verify fails keeps timed_out: 1 on its
  agent-error row, so run health counts it as a timeout.
- The mask_stop_reasons type comes from STOP_REASON_FAILURE_KINDS, so a
  value without a kind fails when the config loads instead of turning a
  masked row into an agent error.
- mask_stop_reasons and mask_agent_errors are refused when the config
  cannot serve /run (no allow_host_execution or no resources_server).
- The mask_agent_errors example is a /verify 5xx. A failed judge call
  already comes back from /verify as a judge_failed mask.
- The agent README says that these masks also leave rows out of gym eval
  scores. Comments and docs no longer say that nothing reads stop_reason,
  or that /run skips /verify after a timeout.
- The token-capture prefix test also runs with the /tokenize pre-call path
  on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Yi-Fu Wu <[email protected]>

* fix(browsecomp): make the cache pack safer to operate after review

- candidates lists a flat file only when MANIFEST.json serves its shard and
  the shard files still have their recorded sizes. Before, it also listed
  files of verified shards that the server could not yet serve.
- build_cache_index.py also indexes the norms of packed search entries, so
  a rebuild after flat files are deleted keeps those queries visible to
  fuzzy matching.
- The startup error says to run unpack before moving MANIFEST.json aside.
- The README gets a Cache pack section: how to build, verify and finalize,
  when it is safe to delete flat files, and how to roll back.
- The build_cache_pack usage line names this server's venv, and the pack
  hit counters are described as they behave.
- The pack tests build one template pack per module and copy it per test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Yi-Fu Wu <[email protected]>

* test(opencode_multimodal_benchmarks): unusable tool evidence wins over a tool cut by the deadline

A row with a tool cut by the rollout timeout and then a tool with an
unknown outcome is masked as verifier_error, not agent_timeout. This pins
the order that trajectory_tool_reward documents.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Yi-Fu Wu <[email protected]>

* docs(browsecomp): say how a recipe keeps masked max_output_tokens rows in the baseline

browsecomp_agent:max_output_tokens is not one of NeMo RL's default policy
failure kinds. Under exclude_infra, a recipe that masks max_output_tokens
must add that kind to grpo.policy_failure_kinds, and that list replaces
the default list.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Yi-Fu Wu <[email protected]>

* fix(browsecomp): say "shards skipped" in the candidates summary

candidates also skips a verified shard that MANIFEST.json does not serve
yet, or whose files are not at their recorded sizes. The summary line
called all of them "unverified".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Yi-Fu Wu <[email protected]>

* perf(browsecomp): read only a prefix of packed entries in the index rebuild

The rebuild read and inflated every packed search entry to get its norm,
even when the flat file still existed and had already been scanned. On a
pack of 12M search entries that is about 2 TB of reads and hours of work.

Now each shard <ab> is one task:

- It scans the flat files under search/<ab>/ first.
- It skips packed entries that have a flat file.
- For the rest, it reads a prefix of the blob: 4 KB of compressed bytes,
  inflated to the same 8 KB head as a flat file, and the same regex.
- An entry whose norm lies past that prefix is read in full and counted.
  So no norm is lost.
- The rebuild prints the counts.

Timed on a sample of 12,173 search and 8,068 browse entries (2.2 GB pack,
node-local disk, page cache not dropped), same 12,173 norms each time:

- flat files present: 32.8 s before, 0.8 s after (1 worker); 33.2 s and
  0.3 s (32 workers)
- flat files deleted: 31.7 s before, 0.8 s after (1 worker); 31.2 s and
  0.3 s (32 workers), all 12,173 norms from a prefix

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Yi-Fu Wu <[email protected]>

* fix(opencode_multimodal_benchmarks): check the other tool evidence before the deadline kind

A tool cut by the rollout timeout raised RolloutTimeoutToolEvidence before
score_opencode_tools ran its checks. So a trace with a cut tool and a call
with no record, a record under another tool name, or a repeated call ID came
back masked agent_timeout instead of verifier_error. That moved the row from
evaluation-side recovery to the model's own result.

Now those checks run first, in either order of the calls. A trace whose only
gap is the cut tool is still masked agent_timeout.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Yi-Fu Wu <[email protected]>

* fix(browsecomp): make the cache pack tools safe to rerun

- build refuses a shard whose published pack holds entries with no flat
  file. After `candidates` deletions, a rebuild from the flat files alone
  dropped them, and nothing could restore them. The refusal leaves the old
  shard as it was and says to run `unpack` first. The CLI reports refused
  shards and exits 1. The README states the order.
- verify's sample check expects a pack hit only for an entry SearchCache
  accepts. A correctly keyed entry of a rejected shape (for example
  `results: {}`) is a miss from both copies, and no longer blocks finalize.
- unpack stages each restored file under its own exclusively created name
  with a random suffix. A PID-only name repeats across nodes and containers
  that share the root, so two restores could share and truncate one file.
- SearchCache.close() (also a context manager) closes the pack's file
  descriptors. The harness calls it at shutdown.
- The index rebuild skips a packed entry only for a flat file at its
  canonical <ab>/<cd>/<digest>.json. A misplaced copy, which SearchCache
  never reads, no longer hides the packed norm.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Yi-Fu Wu <[email protected]>

* fix(browsecomp): preserve published entries during cache rebuilds

Signed-off-by: yaoyu-33 <[email protected]>

* fix(browsecomp): reserve stop-reason masks for budget stops

Signed-off-by: yaoyu-33 <[email protected]>

* fix(browsecomp): fit the open-file limit to the pack at startup

A pack reader keeps both files of every shard it has read open until
close(). A full pack lists 512 shards, so it needs 2 x 512 files. With a
soft RLIMIT_NOFILE below that, a shard past the limit cannot open, and its
entries become misses that can go to a paid live search. A run's search
source then changes without notice.

open_pack now checks the limit before it returns a reader. It needs 2 per
listed shard plus FD_HEADROOM (256) for the server's sockets, logs and
flat-cache files. A lower soft limit is raised up to the hard limit, and
the server logs one line. If even the hard limit is too low, open_pack
raises PackManifestError with the count needed, the limits found and
`ulimit -n`, so the server refuses to start, as it does for a missing
shard file. An unlimited limit is enough.

The pack tests fake RLIMIT_NOFILE, so they do not change the test
process's real limit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Yi-Fu Wu <[email protected]>

---------

Signed-off-by: Jiaqi Zeng <[email protected]>
Signed-off-by: Yi-Fu Wu <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Co-authored-by: Jiaqi Zeng <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: yaoyu-33 <[email protected]>
yfw added a commit that referenced this pull request Dec 2, 2026
…ed-comparisons

Brings in #6675 (a server chooses the placeholder reward of a judge
failure) and #6673 (genrm_compare's placeholder is default_score, 3.0).
One conflict block, in genrm_compare/README.md: this branch said the
placeholder is 0.0 until #6675 and #6673 land, and main said it is
default_score. Both have landed, so the sentence now names the server's
judge_failure_placeholder_reward() and its value for this server,
default_score (3.0 by default).

One more change: test_failed_comparisons_through_run no longer falls back
to 0.0 when the server has no judge_failure_placeholder_reward(). Main has
the hook, and assert_judge_failure already checks that each masked member
carries 3.0.

No silent clash in app.py: a member masked alone raises JudgeError with
the default judge_failed kind, which main's judge_failsafe keeps, and
/verify now gives it default_score as its placeholder reward.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Yi-Fu Wu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers bug Something isn't working ready-to-merge PR is approved, current, and waiting for final CI or merge risk:high Autobot PR risk: high sla:review-overdue Review response is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants