Skip to content

fix(eval): bind every judge failure that ordinary recovery selects - #6373

Merged
AdamRajfer merged 3 commits into
NVIDIA-NeMo:mainfrom
AdamRajfer:arajfer/bind-judge-failures-legacy-class
Nov 23, 2026
Merged

AdamRajfer merged 3 commits into
NVIDIA-NeMo:mainfrom
AdamRajfer:arajfer/bind-judge-failures-legacy-class

Conversation

@AdamRajfer

@AdamRajfer AdamRajfer commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Recovery selects records with _is_judge_failure, but the automatic re-verification binding checked only the canonical class. A judge_unparseable record that keeps judge_failed as its retained class was selected, then dropped, so re-verification printed "Nothing to be re-verified" and the run stayed incomplete.

  • bind_judge_failures in nemo_gym/eval/rollout_reverification.py: both checks use _is_judge_failure.
  • is_rejudgment_of and is_rejudgment_failure_of in nemo_gym/rollouts/rollout_records.py, and settle_rejudgments, also match the retained class.

Tested: new unit tests in tests/unit_tests/eval/test_rejudge_saved_judge_failures.py, including a batch through the real re-verification path.

bind_judge_failures compared _ng_failure_class to judge_failed in two
places, while ordinary recovery selects a judge failure through
_is_judge_failure, which also accepts the retained classification
(_ng_failure_legacy_class) and leaves out omitted rollouts. A record
classified judge_unparseable that keeps judge_failed as its retained
classification was therefore selected by ordinary recovery and left out
of the automatic re-verification binding, so the re-verification found
nothing to settle and the run stayed incomplete.

Both checks now use _is_judge_failure, so the failure cap and the binding
cover the same records the ordinary selection does.

Signed-off-by: Adam Rajfer <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Nov 18, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added risk:low Autobot PR risk: low bug Something isn't working area:evaluation Evaluation, rollout collection, reward profiling, comparison, and exporters labels Nov 18, 2026
@AdamRajfer
AdamRajfer marked this pull request as ready for review November 18, 2026 15:48
@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team November 18, 2026 15:48
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the needs-review PR is ready for code review and waiting on a reviewer label Nov 18, 2026

@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 binding now includes retained judge-failure classifications, but settlement still rejects them after the judge call.

I inspected both changed files and traced the affected selection, admission, settlement, and reload paths. I did not execute tests in this read-only review.


Inline comments (escaped v1):

  • nemo_gym/rollouts/rollout_records.py line 515: RISK: Allow newly bound judge failures through settlement validation

    The newly bound judge_unparseable rows still cannot settle. Using the new fixture, let /verify return the same saved response with reward=1.0. The binding now sends that row to the judge, but is_rejudgment_of requires the predecessor's canonical class to be judge_failed or None. is_rejudgment_failure_of likewise requires canonical judge_failed.

    Consequently, check_rejudgment raises ConfigError saying the result does not settle the saved judge failure. Cleanup withdraws the admission, and the original failure stays due. A mixed batch cannot save its other grades either because settlement validates every row before writing. These restrictions predate this PR, but widening the binding makes them reachable through automatic recovery, which now calls the judge and then fails.

    Could you align both predecessor checks with the binding's retained-class contract? matches_failure_class is already imported in this module. The focused replacement is:

    @@ is_rejudgment_of
    -        failure.get("_ng_failure_class") in ("judge_failed", None)
    +        (failure.get("_ng_failure_class") is None or matches_failure_class(failure, {"judge_failed"}))
    @@ is_rejudgment_failure_of
    -        failure.get("_ng_failure_class") == "judge_failed"
    +        failure.get("_ng_failure_class") is not None
    +        and matches_failure_class(failure, {"judge_failed"})

    Keep the remaining answer, identity, and grade guards unchanged. Saved results with no failure class must still support successful regrading without becoming eligible predecessors for saved failed rejudgments.

    Proposed acceptance checks, not executed:

    • Parameterize the real reverify-path test over canonical judge_failed and the new retained classification. Both should make one /verify call, settle reward 1.0 with the original answer/run/attempt, survive a fresh RolloutStore.read, clear pending admissions and due work, and make no call on a second pass.
    • For the retained predecessor, return another canonical judge_failed outcome with a distinct failure ID and the same answer. It should persist as the selected failure, consume one additional failure attempt, and reload without conflict.
    • Retain the saved-result regrading assertions: one verify call, the same answer and attempt, and no remaining due work. Verify that a classless saved result still cannot satisfy is_rejudgment_failure_of.
    • Keep spent failures excluded with skip_spent=True, omitted/non-judge rows unbound, and changed-answer or foreign-identity results rejected.

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

@yaoyu-33
yaoyu-33 requested a review from marcromeyn November 18, 2026 22:07

@giuliolovisotto giuliolovisotto 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 reproduced the settlement failure at 35d28c37 with two rollouts in the same automatic recovery pass. One had _ng_failure_class=judge_failed. The other had _ng_failure_class=judge_unparseable and _ng_failure_legacy_class=judge_failed. Both reached the mock verifier, which graded the original saved answers with reward=1.0. Settlement raised ConfigError on the second rollout and withdrew both admissions. After reopening the source store, neither grade was saved and both rollouts were due again.

Please update the predecessor checks in is_rejudgment_of and is_rejudgment_failure_of to recognize the retained judge-failure class the binding now accepts. Keep the existing distinction for classless saved results, which can be regraded successfully. The answer and attempt identity checks should still apply.

Please add a regression test that runs the mixed batch through automatic recovery, reopens the source store, and checks that both grades persisted and that a second pass makes no verifier calls. The two new binding tests and the existing canonical recovery test all passed in my run.

…ned class

The settlement predicates still required the canonical judge_failed class, so a
failure classified judge_unparseable that keeps judge_failed as its retained
class was selected and bound, then refused at settlement, which withdrew every
admission of the pass. Both predicates now match the retained class too, and a
saved result with no class still settles as before.

Signed-off-by: Adam Rajfer <[email protected]>
@AdamRajfer

Copy link
Copy Markdown
Contributor Author

🤖 Adam’s AI assistant

Thanks, reproduced. is_rejudgment_of and is_rejudgment_failure_of in rollout_records.py still required the canonical judge_failed class, so a record classed judge_unparseable that keeps judge_failed was bound and then refused at settlement, which withdrew the whole pass. Both now match the retained class as well, and a saved result with no class settles as before, with the answer and attempt identity checks unchanged.

Two new tests. test_a_pass_settles_judge_failures_of_both_classes_in_one_batch runs the mixed batch through the real re-verification path, reopens the store, checks that both grades persisted and that a second pass makes no verifier call. test_a_judge_failure_of_either_class_binds_its_rejudgment_and_a_repeat_failure covers both predicates for either class and the classless case. Both fail without the change.

@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team November 19, 2026 16:16
@svcnvidia-nemo-ci svcnvidia-nemo-ci added risk:high Autobot PR risk: high and removed risk:low Autobot PR risk: low labels Nov 19, 2026
@github-actions github-actions Bot added the sla:review-overdue Review response is over the one-business-day SLA label Nov 19, 2026
@giuliolovisotto

Copy link
Copy Markdown
Contributor

@AdamRajfer, thanks. I verified your fix at 15aa00f9. When the verifier grades both saved answers in the mixed batch, both grades survive reopening the source store, and a second recovery pass makes zero verifier calls. That resolves my original finding.

I found one remaining issue when the verifier returns another judge failure. Here's how I reproduced it using the same test helpers:

  1. Set NEMO_GYM_MAX_ROLLOUT_ATTEMPTS=2 before creating the run. Use _run with one rollout, one saved failure, and failure_fields=_UNPARSEABLE_JUDGE_FAILURE. The saved failure has already used the first attempt.
  2. Have _verifier return the same saved answer with a fresh failure ID, _ng_failure_class="judge_unparseable", _ng_failure_legacy_class="judge_failed", failure_kind="judge_failed", mask_sample=True, and reward=0.0.
  3. Run rejudge_saved_judge_failures, reopen the source store, then run recovery again.

I saw one verifier call on each pass. After the first retry, the source still held the original failure ID, the failure count was 1, and the rollout was still due. I expected the new failure ID to persist, the count to reach 2, and the next pass to make zero calls.

The withdrawal check in settle_rejudgments checks only the canonical class, so it withdraws this result before the updated repeat-failure predicate sees it. Could you make that check recognize the retained judge-failure class too, keep the existing withdrawal behavior for saved results, and cover the two-attempt case through recovery and reload?

… when settling a re-judgment

The withdrawal check in settle_rejudgments compared only the canonical failure class
with judge_failed, so a repeat judge failure whose canonical class is judge_unparseable
was withdrawn before the repeat-failure predicate saw it. It now recognizes the retained
judge_failed classification too, and a test covers the two-attempt case through recovery
and reload.

Signed-off-by: Adam Rajfer <[email protected]>
@AdamRajfer

Copy link
Copy Markdown
Contributor Author

@giuliolovisotto thanks for verifying the first fix and for the exact repro. The withdrawal check in settle_rejudgments compared only the canonical class with judge_failed, so a repeat failure classed judge_unparseable was withdrawn before it was counted. It now uses the same class match as the rest of the recovery path. I added a test for your two-attempt case: the new failure is saved and linked to the first one, the rollout is no longer due, and a second pass makes no verifier call. It fails without the change.

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

Verified both fixes at c34f3b8. The mixed batch keeps both grades after reload. With a two-attempt cap, a repeat judge_unparseable failure now persists under its new failure ID, the count reaches two, and the next recovery pass makes zero verifier calls. All 76 tests in the two focused recovery test files passed.

@AdamRajfer
AdamRajfer added this pull request to the merge queue Nov 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

Merged via the queue into NVIDIA-NeMo:main with commit 4adea12 Nov 23, 2026
68 checks passed
@AdamRajfer
AdamRajfer deleted the arajfer/bind-judge-failures-legacy-class branch November 23, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:evaluation Evaluation, rollout collection, reward profiling, comparison, and exporters bug Something isn't working needs-review PR is ready for code review and waiting on a reviewer 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.

3 participants