Skip to content

fix(equivalence_llm_judge): do not abort the run on a judge failure - #2805

Merged
bxyu-nvidia merged 2 commits into
mainfrom
fix/judge-failure-nonfatal
Sep 10, 2026
Merged

bxyu-nvidia merged 2 commits into
mainfrom
fix/judge-failure-nonfatal

Conversation

@jubick1337

@jubick1337 jubick1337 commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

A JudgeError is propagated out of the verify path, which aborts the whole evaluation and discards every rollout already generated.
Observed on HLE: a transient 500 error from the judge ended a run.

The judge is a separate service, so its availability is not a property of the rollout being scored. Record the failure on the rollout instead: response becomes optional and verdict_label is set to JUDGE_ERROR, the rollout scores not-equal, and the run completes. The judge-error rate is then visible in the artifacts, so a caller can decide whether it is low enough to trust the score.

A JudgeError propagated out of the verify path, which aborts the whole
evaluation and discards every rollout already generated. Observed on HLE:
a transient 500 from the judge service ended a run that had produced
1,597 rollouts, and the work could not be resumed because the failure
surfaced as a pydantic ValidationError rather than a recorded outcome.

The judge is a separate service, so its availability is not a property of
the rollout being scored. Record the failure on the rollout instead:
`response` becomes optional and `verdict_label` is set to JUDGE_ERROR, the
rollout scores not-equal, and the run completes. The judge-error rate is
then visible in the artifacts, so a caller can decide whether it is low
enough to trust the score.

Signed-off-by: Matvei Novikov <[email protected]>

Copilot AI 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.

Pull request overview

This PR updates the equivalence_llm_judge resources server so transient judge-service failures no longer abort an entire evaluation run. Instead, judge-call failures are recorded on the rollout (with an explicit label) and scored conservatively, keeping long-running evaluations from being discarded due to external judge outages.

Changes:

  • Adds a JUDGE_ERROR_LABEL sentinel to distinguish judge-service failures from “no parseable verdict”.
  • Makes JudgeEvaluation.response optional to support recording judge failures without a response payload.
  • Changes _generate_judge_evaluation() to catch JudgeError and return a non-equal evaluation record instead of re-raising.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +501 to +505
return False, JudgeEvaluation(
responses_create_params=responses_create_params,
response=None,
verdict_label=JUDGE_ERROR_LABEL,
)
Comment on lines +139 to +143
# None when the judge could not be reached or returned an unusable payload.
# The rollout is still recorded so the failure is visible in the artifacts
# rather than taking down the run that produced it.
response: Optional[NeMoGymResponse] = None
# Extracted verdict token from judge output, e.g., "[[A=B]]" or "[[A!=B]]",
@bxyu-nvidia
bxyu-nvidia merged commit 39fd631 into main Sep 10, 2026
30 checks passed
@bxyu-nvidia
bxyu-nvidia deleted the fix/judge-failure-nonfatal branch September 10, 2026 17:03
jkyi-nvidia pushed a commit that referenced this pull request Sep 11, 2026
…2805)

A `JudgeError` is propagated out of the verify path, which aborts the
whole evaluation and discards every rollout already generated.
Observed on HLE: a transient 500 error from the judge ended a run.

The judge is a separate service, so its availability is not a property
of the rollout being scored. Record the failure on the rollout instead:
`response` becomes optional and `verdict_label` is set to `JUDGE_ERROR`,
the rollout scores not-equal, and the run completes. The judge-error
rate is then visible in the artifacts, so a caller can decide whether it
is low enough to trust the score.

Signed-off-by: Matvei Novikov <[email protected]>
Signed-off-by: Junkeun Yi <[email protected]>
bxyu-nvidia pushed a commit that referenced this pull request Sep 18, 2026
…3538)

## What does this PR do?

Retry HTTP 404 and 408 by default in Gym's shared OpenAI-compatible
client. Transient model-routing failures can recover without
benchmark-specific configuration; permanent errors fail after the
bounded attempt budget. The default remains three total attempts,
configurable per model server through `max_http_attempts`, with the
existing fixed 0.5-second delay between retries.

Route exhausted equivalence-judge errors through Gym's shared
`judge_failed` handling so saved policy answers can be recovered with
`gym eval reverify --judge-failed-only`. This preserves the
no-lost-rollouts intent of #2805 using the shared failsafe from #2113,
instead of recording an unavailable judge as a completed incorrect
answer.

Add an optional `max_answer_chars` guard to the shared equivalence
verifier. It is unset by default. Evaluation, synthetic data generation,
and RL workflows can opt in through the resources-server configuration;
the limit changes reward assignment. When enabled, oversized final
answers receive zero with an explicit length failure and no judge call;
the full response is retained and reasoning is excluded.

Missing assistant messages and empty or whitespace-only final assistant
text now score zero with `failure_reason: empty_final_answer` and no
judge call. The full response is preserved. The check precedes regex
extraction and does not bypass the existing fallback for nonempty
answers.

No separate issue is needed: this addresses observed transient grading
failures and pathological repetitive final answers. There are no
HLE-specific file changes or retry presets in the final diff.

## Validation

On runtime revision `e8cbec0c9e372aff32d84d15898dac668e84b263`
(subsequent changes are documentation-only):

```bash
.venv/bin/python -m pytest --import-mode=importlib -o addopts='' -o log_cli=false -q \
  tests/unit_tests/test_openai_utils.py \
  tests/unit_tests/test_judge.py \
  tests/unit_tests/test_rollout_reverification.py \
  resources_servers/equivalence_llm_judge/tests/test_app.py \
  responses_api_models/openai_model/tests/test_app.py
.venv/bin/pre-commit run --all-files
```

479 tests passed; all pre-commit hooks passed. Tests cover default
404/408 recovery, bounded internal/external failures at attempt budgets
of one/three/five, preserved requests and terminal error bodies,
permanent non-retryable errors, per-model budgets, answer-limit
boundaries, default uncapped grading, reasoning exclusion,
preserved-response recovery, empty final answers, and nonempty answers
whose regex extraction yields an empty match.

The shared core changes give this PR full CI scope. The entire component
suite was not run locally; the affected suites above were run.

## Rollouts

Offline HTTP replay on that runtime revision exercised the actual
updated model server and verifier with saved policy responses and
recorded judge replies:

- Derived reasoning-only and missing-output cases made zero judge calls,
retained their responses, and reported `empty_final_answer`.
- Default 404 and 408 retries each recovered after two injected
failures.
- Three consecutive 404s exhausted the default budget and preserved the
response as `judge_failed`; a later judge-only replay recovered the
grade.
- A response with 341,172 reasoning characters and a 4,925-character
final answer was graded normally.
- A 496,874-character final answer made no judge calls with an explicit
100,000-character limit, and reached the judge normally when the limit
was unset.

All request hashes and policy responses were preserved. Four live
judge-only calls also passed on the earlier revision `083323d99`, before
moving 404 retries into shared defaults and moving the cap out of
benchmark configs. No additional live calls or policy generation were
run for this revision, and no full benchmark was rerun.

## Compatibility and benchmark impact

- HTTP 404/408 retries now apply across datasets to clients using the
shared implementation. Bad routes/model names fail after the configured
budget instead of immediately. The default attempt count remains three;
existing internal rate-limit retry extension is unchanged and does not
apply to 404/408.
- Exhausted equivalence-judge calls become pending failures excluded
from scored aggregates, rather than completed zero scores. A run with
pending grades is incomplete. Legacy in-band `JUDGE_ERROR` rows remain
readable but need migration before judge-failed-only recovery.
- Empty final text is now scored zero deterministically rather than
sending an extraction-failure placeholder to the judge; this applies to
every equivalence-verifier dataset.
- `max_answer_chars: null` is the default everywhere, preserving
existing answer-length behavior. An explicit limit changes grading
semantics, counts the last assistant message before regex extraction,
and does not stop generation early.

## Checklist

- [x] I have read the contributing guidelines.
- [x] The change is focused; no unrelated edits.
- [x] Tests added or updated and pass locally.
- [x] Documentation updated with retry configuration, recovery, and
benchmark impact.
- [x] Pre-commit checks pass locally.
- [x] New source files include the required Apache-2.0 SPDX header.
- [x] All commits have DCO sign-off.

---------

Signed-off-by: Igor Gitman <[email protected]>

This branch was previously deployed

1 inactive deployment
public — 8ca3f41d Deployed Aug 26, 2026 by copy-pr-bot[bot] via release / finalize / notify #2059
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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