Skip to content

feat(verification): let a JudgeError name its failure kind and a server choose its placeholder reward - #6675

Merged
yfw merged 11 commits into
mainfrom
yifuw/judge-error-failure-kind
Dec 1, 2026
Merged

yfw merged 11 commits into
mainfrom
yifuw/judge-error-failure-kind

Conversation

@yfw

@yfw yfw commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

What changed

This PR adds two small options to the judge failsafe in nemo_gym/verification/judge.py, and makes recovery and failure counting handle them. Every existing server keeps its current behavior.

Change Effect
JudgeError(..., failure_kind="judge_unparseable") A parser that finds no verdict in a judge reply can name that kind. judge_failsafe masks the row under it, and the routing class stays judge_failed, so recovery judges the row again from its saved answer. JudgeError refuses any other kind. Without failure_kind, it still means judge_failed.
judge_call_failed(..., failure_kind=...) and is_judge_failure The resources server event carries the parser's kind. is_judge_failure also accepts a resources server event with kind judge_unparseable.
judge_failsafe(verify_fn, *, placeholder_reward=0.0) and SimpleResourcesServer.judge_failure_placeholder_reward() A server can choose the placeholder reward on the rows that judge_failsafe masks. The default stays 0.0.
Recovery planning (nemo_gym/eval/recovery/) Collection saves a failsafe row under its own kind and keeps judge_failed as _ng_failure_legacy_class. The planner behind gym eval resubmit --recover and the Slurm job chain now treats a row whose class or legacy class is judge_failed as a judge failure, as gym eval reverify --judge-failed-only already does. The evidence projection keeps the legacy class, and the default recovery outcome policy maps judge_unparseable to verify. Before, such a row stopped the plan as "nobody owns them".
Failure counting (_counted_failure_row) With count_failure_classes_as_zero, a judge-failure row counts as 0.0 whatever placeholder it carries. Before, a row that the end-of-run re-judge saved again kept the placeholder.
Docs The judge guide names the new JudgeError kind and judge_failure_placeholder_reward(). The judge.py module docstring no longer tells a parser to score an unparseable verdict.

Commits:

  1. feat(verification): let a parser's JudgeError name judge_unparseable (Yi-Fu Wu)
  2. feat(verification): let a server choose the placeholder reward of a judge failure (Jiaqi Zeng, @HeyyyyyyG)
  3. test(server_runtime): check that /verify uses the server's placeholder reward (Yi-Fu Wu)
  4. fix(eval): plan a re-judge for a judge failure that names its own kind (Yi-Fu Wu)
  5. fix(rollouts): count a judge failure as 0 whatever placeholder it carries (Yi-Fu Wu)
  6. docs(verification): describe the judge_unparseable kind and the placeholder reward (Yi-Fu Wu)
  7. test: run judge_unparseable through collection, recovery and re-judge (Yi-Fu Wu)
  8. docs(verification): describe the placeholder under NeMo RL's exclude_infra default (Yi-Fu Wu)
  9. refactor(server_runtime): rename judge_failure_reward() to judge_failure_placeholder_reward() (Yi-Fu Wu)

Commit 1 matches the judge.py and test_judge.py hunks of #6145.

Why

Before, every JudgeError was recorded as judge_failed. A judge that answered without a verdict then looked the same as a judge that did not answer. judge_unparseable is already a registered failure kind, and recovery already judges such rows again, but a parser had no way to raise it.

A masked row adds no loss in a trainer that honors mask_sample, and Gym leaves it out of its aggregates. But a trainer that reads the /run reply gets the placeholder as the row's reward. Under NeMo RL's default masked_reward_policy: exclude_infra (NVIDIA-NeMo/RL#4968), a judge-failure row leaves the group baseline. Only under include, or with the judge's failure kind in policy_failure_kinds, does the placeholder count in the baseline and reach the reward metrics. There, for a server whose scores sit around a neutral value other than 0, a burst of judge failures reads as a drop in the mean reward. judge_failure_placeholder_reward() lets such a server use its neutral value there.

#6673 uses both options in several resources servers, and it stacks on this PR.

Compatibility and benchmark effect

  • JudgeError without failure_kind behaves as before.
  • judge_failsafe gets a keyword-only parameter with default 0.0. SimpleResourcesServer.judge_failure_placeholder_reward() returns 0.0 unless a server overrides it. No server on main overrides it.
  • is_judge_failure now also accepts a resources server event with kind judge_unparseable. No server on main raises one today.
  • Provider stops change in recovery planning. Collection saves them with the class provider_quota_exhausted or provider_credentials_rejected and the legacy class judge_failed. Before, gym eval resubmit --recover stopped on them as "nobody owns them". Now a provider_credentials_rejected row, or a quota stop whose reset time is past or not given, plans a re-judge of its saved answer. A quota stop with a future reset time stops with a message to wait for the reset.
  • The default recovery outcome policy gets the entry judge_unparseable: verify. A run's recovery_outcome_policy can override it.
  • No benchmark result changes, because no server uses the new options in this PR.

Related PRs

Validation

All runs used Python 3.13.14 on CPU, at the head of this branch.

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

pytest tests/unit_tests/verification
# 94 passed

pytest tests/unit_tests/eval tests/unit_tests/verification tests/unit_tests/rollouts \
  tests/unit_tests/orchestration tests/unit_tests/server_runtime \
  tests/unit_tests/test_moved_paths.py tests/unit_tests/test_fern_docs_links.py -n 8
# 9815 passed, 10 failed, 1 error

The 10 failures and 1 error also fail on main at d711cd1577 in this environment. They need packages or network access that the local dev environment does not have, for example cloudpickle. The supervisor install tests in that set fail a different number of times from run to run. None of them tests a module that this PR changes.

The new tests fail without the code change:

  • The 3 JudgeError kind tests in tests/unit_tests/verification/test_judge.py fail on main.
  • The override case of the /verify placeholder test fails without the base_resources_server.py change.
  • tests/unit_tests/eval/recovery/test_judge_failure_kind_recovery.py runs judge_failsafe, collection, the Store and the recovery planner for a plain judge failure, both judge_unparseable forms and a quota stop. Its 4 judge_unparseable and quota cases fail without the recovery fix. Without only the evidence projection change, all 4 fail. Without only the policy entry, the 2 judge_unparseable cases fail.
  • The counting test fails without the _counted_failure_row change.

Rollout evidence

N/A. This PR changes only the shared failsafe and adds options that no server uses yet. Unit tests cover the masked row and the /verify route. No model compute ran for this PR.

Issue

No issue. #6673 needs these options.

🤖 Generated with Claude Code

yfw and others added 3 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]>
…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]>
@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:core Shared APIs, servers, telemetry, health, and registries feature New capabilities, enhancements, or enablement work 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 adca4ce

@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 23, 2026 23:20
yfw added a commit that referenced this pull request Nov 23, 2026
…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]>
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

@svcnvidia-nemo-ci svcnvidia-nemo-ci 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.

SHIP WITH CARE

One RISK: the newly preserved judge_unparseable kind stops automatic saved-answer recovery after collection canonicalizes the failure row.

I reviewed all five changed files, trusted repository conventions, surrounding code, failure-report consumers, recovery paths, tests and existing feedback.

Validation evidence

  • CI on adca4cef: lint, all four core shards, all eight server-suite shards, the latest session-routing job and Nemo_CICD_Test passed. CI logs show the added tests passed. Non-blocking harness conformance was still red, with its mini-SWE retry running; this is not an all-green CI claim.
  • Purpose-built probes ran against the admitted source in 766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:main-offline, Python 3.13.14. judge_route_matrix.py passed 10 HTTP cases covering custom rewards, failure kinds, cause preservation, observability, successful scores and scorer errors. judge_boundary_matrix.py passed six boundary cases and checked request preservation and exception serialization.
  • judge_sidecar_recovery.py reproduced the finding: ordinary judge failures produced reverify / judge_recoverable; both unparseable forms produced stop / unknown after collection. Manual judge-only selection still recognized those rows.

I did not rerun repository suites locally.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

Comment thread nemo_gym/verification/judge.py Resolved
yfw and others added 4 commits November 23, 2026 16:46
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]>
…ries

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]>
…holder 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]>
- 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]>
@yfw yfw changed the title feat(verification): let a JudgeError name its failure kind feat(verification): let a JudgeError name its failure kind and a server choose its placeholder reward Nov 24, 2026
@yfw

yfw commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test b2cfc0d

@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 24, 2026 19:43
yfw added a commit that referenced this pull request Nov 24, 2026
…eplies-without-verdict

Bring in the #6675 review fixes: recovery plans a re-judge for a
judge_unparseable row, a counted judge failure counts as 0 whatever
placeholder it carries, and the docs for the new kind and placeholder.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Yi-Fu Wu <[email protected]>
@github-actions github-actions Bot added the sla:review-overdue Review response is over the one-business-day SLA label Nov 25, 2026
@yfw

yfw commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test a887726

yfw added a commit that referenced this pull request Nov 30, 2026
…eplies-without-verdict

Bring in #6675's merge of main 228a16b.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Yi-Fu Wu <[email protected]>
@yfw
yfw added this pull request to stack #6968 November 30, 2026 20:15
yaoyu-33
yaoyu-33 previously approved these changes Nov 30, 2026
@yaoyu-33 yaoyu-33 added ready-to-merge PR is approved, current, and waiting for final CI or merge and removed needs-review PR is ready for code review and waiting on a reviewer labels Nov 30, 2026
ffrujeri
ffrujeri previously approved these changes Nov 30, 2026

@ffrujeri ffrujeri 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.

Thanks. A small, consistent hook, and the recovery fix has an integration test. One optional naming note inline. LGTM. The failing core shard is a flaky checkpoint test this PR does not touch; it is re-running.

…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]>
@yfw
yfw dismissed stale reviews from ffrujeri and yaoyu-33 via 7a451df December 1, 2026 01:41
@yfw

yfw commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 7a451df

@nemo-pr-automation
nemo-pr-automation Bot requested review from a team December 1, 2026 01:42
…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]>
@yfw

yfw commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 7c5bff2

yfw added a commit that referenced this pull request Dec 1, 2026
…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]>
yfw added a commit that referenced this pull request Dec 1, 2026
#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 added a commit that referenced this pull request Dec 1, 2026
…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]>
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 8c9e22f

yfw added a commit that referenced this pull request Dec 1, 2026
…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]>

@ffrujeri ffrujeri 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.

Thanks for the rename and the corrected NeMo RL default in the docs. The rest of the PR is unchanged since the last approval. LGTM.

@yfw
yfw added this pull request to the merge queue Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

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

Merged via the queue into main with commit 060bdae Dec 1, 2026
78 of 82 checks passed
@yfw
yfw deleted the yifuw/judge-error-failure-kind branch December 1, 2026 19:47
katherineh123 pushed a commit to katherineh123/Gym that referenced this pull request Dec 2, 2026
…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]>
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:core Shared APIs, servers, telemetry, health, and registries feature New capabilities, enhancements, or enablement work 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