Repository navigation
fix(resources_servers): record verifier failures that are scored as model results - #6984
oyilmaz-nvidia wants to merge 9 commits into
Conversation
…m as model results Seven resources servers scored a failure of the verifier, the judge reply handling or the task data as a model result. Each now masks the sample with a failure_kind, or raises where the grader failed, so the sample is left out of scores and training and its cause is visible. - critpt: an Artificial Analysis response without a numeric accuracy scored 0.0. It is now rejected as judge_failed, like a batch with too many grader errors. - officeqa: score_answer caught every exception and returned 0.0. It still scores 0 for an answer the matcher cannot parse (ValueError); any other exception is masked as verifier_error. - big_finance: the catch-all around judge scoring returned reward 0.0 with only judge_error set. It is now masked as verifier_error. Judge call and unreadable-verdict failures already raise and are unchanged. - image_tools: the catch-all in the pivot verifier and a row without a usable expected action scored 0.0. Both are now masked as verifier_error. A wrong tool call, a wrong target and a low argument score stay real zeros. - lc_niah: an expected_answer that is not a JSON list was graded as an empty gold set, so an empty prediction scored 1.0. The row is now masked as verifier_error. An empty gold list stays a valid task. - asr_with_pc: a Hallucination row without a positive audio_duration counted as a correct row. It is now masked as verifier_error. - denovo_swe: a verify of a session whose base commit was already consumed, or whose patch could not be extracted, graded an empty patch. It now returns a masked response (session_lost or verifier_error) without grading. Part of #6983 (work package 1), under #3180. Signed-off-by: Onur Yilmaz <[email protected]>
…ed zeros in image_tools and denovo_swe Review of the previous commit found two masks that hid a real model or agent failure. - image_tools: every exception in the pivot verifier was masked, so a model call with arguments that are not an object, or values of the wrong type, left the scores. The task's expected action is now checked by scoring it against itself first, and only a failure there (bad task data) is masked. A malformed model call is a zero with the new failure_reason malformed_tool_call and is not masked. - denovo_swe: every patch-extraction exception was masked, but the agent controls its checkout and can move .git. A git command that ran in the sandbox and failed is now the agent's result: the empty patch is graded, as before. A raising sandbox call, or a command that reported no exit code, is still masked as verifier_error. Part of #6983 (work package 1), under #3180. Signed-off-by: Onur Yilmaz <[email protected]>
…odel results The previous two commits of this PR masked samples whose verifier, grader reply or task data had failed. That changes scores and the training loss, which needs a decision on how Gym treats such failures (#6983, D3). This commit replaces it with a record: every case keeps the score and mask it had before, and each is now reported through observe_scored_despite_failure, so the rollout is no longer indistinguishable from a normally graded one. The event is saved beside the row (_ng_failure_events) and counted by the rollout_scored_despite_failure health check. - critpt: a grader response without accuracy is scored 0.0 as before and recorded as judge_failed. - officeqa: an unexpected scorer exception is scored 0.0 as before and recorded as verifier_error. An answer the matcher cannot parse (ValueError) is a wrong answer and records nothing. - big_finance: an unexpected exception after the judge replied is scored 0.0 as before and recorded. - image_tools: a row without a usable expected action, or one that cannot be scored against itself, is scored 0.0 as before and recorded. A malformed model call (arguments that are not an object, values of the wrong type) is a wrong answer and records nothing. - lc_niah: an expected_answer that is not a JSON list is graded as an empty set as before, so an empty prediction still scores 1.0, and the row is recorded. - asr_with_pc: a Hallucination row without audio_duration still counts as correct, and the row is recorded. - denovo_swe: a patch that cannot be extracted is graded as an empty patch as before. A consumed session (session_lost) and a sandbox failure (verifier_error) are recorded. A git failure in the agent's own checkout is the agent's result and records nothing. Part of #6983 (work package 1), under #3180. Signed-off-by: Onur Yilmaz <[email protected]>
|
/ok to test 1287e33 |
…rader falls back to the empty set The record added for an unreadable expected_answer used its own check (is it a JSON list), which differed from the parse the grader uses. A list with unhashable items such as [[1]] is graded as an empty set but was not recorded, and a JSON object, which the grader reads as the set of its keys, was recorded although it is graded normally. The record and the grader now share one parse, so the row is recorded when it is graded against the fallback set and not otherwise. No score changes. Part of #6983 (work package 1), under #3180. Signed-off-by: Onur Yilmaz <[email protected]>
…nd big_finance A re-scan against current main found four more cases in servers this PR already covers, with the same pattern: the failure is scored as before and now recorded through observe_scored_despite_failure. No score, mask or retry changes. - denovo_swe: a verification that never completes after its retries (scored 0, evaluation_completed=False) is recorded. Seeding also records a failed seed prep (the agent may still see the source), a failed git init, and a failed git rev-parse HEAD (no base commit to diff against), each at the seed stage, and seeding goes on as before. - big_finance: a row without rubric points in a reward mode that uses them (rubric_points) scores 0.0 as before and is recorded. The final_answer mode does not use rubric points and records nothing. An empty-reference row in asr_with_pc is not recorded: the code documents dropping such rows from the corpus metrics as the Open ASR Leaderboard convention, so it is not a failure. Part of #6983 (work package 1), under #3180. Signed-off-by: Onur Yilmaz <[email protected]>
|
/ok to test 7cc2eb6 |
The listing of files that are untracked before the agent starts printed its failure to stderr and returned an empty set, so the run was graded without dropping those files from the patch and nothing in the saved row said so. A non-zero exit, a result without an exit code and a raised exception are each recorded as verifier_error at the seed stage, and the empty set is returned as before. No score, mask or retry changes. Part of #6983 (work package 1), under #3180. Signed-off-by: Onur Yilmaz <[email protected]>
| from nemo_gym.core.failure_kinds import JUDGE_SKIPPED, PROVIDER_CREDENTIALS_REJECTED, PROVIDER_QUOTA_EXHAUSTED | ||
| from nemo_gym.core import FailureBoundary, observe_scored_despite_failure | ||
| from nemo_gym.core.failure_kinds import ( | ||
| JUDGE_FAILED, |
There was a problem hiding this comment.
[P2] Import JUDGE_FAILED through the public API
Please import JUDGE_FAILED through nemo_gym.core. It is already a public export, and the existing test_code_outside_the_library_imports_exported_names_from_the_public_api test fails solely on this new internal-module import. Moving this name into the public import above should resolve the core test failure.
There was a problem hiding this comment.
Verified at 457fbb3: JUDGE_FAILED now comes from nemo_gym.core, and the previously failing public-import test passes. This addresses the comment.
| observe_scored_despite_failure( | ||
| boundary=FailureBoundary.RESOURCES_SERVER, | ||
| failure_kind=VERIFIER_ERROR, | ||
| failure_reason=f"seed prep (wipe and README) failed for {body.instance_id}: {prep_result.stderr}", | ||
| stage="seed", |
There was a problem hiding this comment.
[P2] Make the setup observation detect actual script failures
The generated seed_prep_script swallows cleaner failures with || echo ... and masks the README/git status with || true, so actual wipe/README failures return 0 and never reach this new observation. I reproduced a failing cleaner through seed_session: it returned a normal session with source still present and no event.
Please expose the preparation failure status/receipt while keeping seeding nonfatal, and exercise the generated script in the test; the current mocked exit code of 1 does not represent this failure. The underlying cleanup behavior predates this PR; this comment concerns the new observation missing it.
There was a problem hiding this comment.
Verified with the actual generated script through seed_session: a failed cleaner still leaves source present and exits 0, but now produces the seed-stage event. README-copy failures are recorded too, while healthy setup records nothing. Seeding remains nonfatal as requested. This addresses the observation gap.
| if "accuracy" not in result: | ||
| # The batch is scored 0.0 below, as before; the missing value is recorded. | ||
| observe_scored_despite_failure( | ||
| boundary=FailureBoundary.RESOURCES_SERVER, | ||
| failure_kind=JUDGE_FAILED, | ||
| failure_reason="The CritPt grader response has no accuracy; the batch is scored 0.0", | ||
| stage="verification", | ||
| ) |
There was a problem hiding this comment.
Nonblocking [P3]: record only accepted fallback scores
Could this observation be emitted after the accuracy is None rejection guard? A reply without accuracy whose grader errors exceed the limit—or cover the whole batch—is excluded by judge_failsafe, but this event still marks it as scored and reaches the health report. I reproduced a one-item batch with judge_error_count=1: the row remains masked but carries this event.
Keeping the event on accepted fallback scores, with a rejected-batch test asserting no scored-despite-failure event, would preserve that distinction. This is a diagnostic correction; the score exclusion already works.
There was a problem hiding this comment.
Verified at 457fbb3: rejected batches remain excluded and no longer carry a scored-despite-failure event or its health finding. Accepted missing-accuracy replies still record the zero-score fallback. The HTTP reproduction and regression tests pass. This addresses the nonblocking comment.
| f"&& git -C {shlex.quote(workdir)} --no-pager diff {shlex.quote(base_commit)}" | ||
| ) | ||
| if result.error_type is not None or result.return_code is None: | ||
| raise RuntimeError(f"The sandbox did not report the git exit code ({result.error_type})") |
There was a problem hiding this comment.
Nonblocking [P3]: preserve the provider error details
Please retain result.stderr in this error as well as error_type. Daytona reports provider failures with a synthetic return code and puts the useful cause, such as a 503 response, in stderr. Main preserves that detail; this branch replaces it with a generic message, so both the saved row and the new event lose the information needed to troubleshoot the run. Scores are unchanged.
There was a problem hiding this comment.
Verified at 457fbb3: the provider cause is retained alongside error_type. The new regression test confirms a 503 message reaches both the saved-row error and the diagnostic event. This addresses the nonblocking comment.
…in critpt and denovo_swe - critpt: import JUDGE_FAILED from nemo_gym.core, which fixes the public-API import test that failed on it. Record a missing accuracy only for a batch that is accepted and scored: a rejected batch (grader errors over the limit or covering the whole batch) is excluded, so it no longer carries a scored-despite-failure event. - denovo_swe: the seed prep script exits 0 whatever happens, so a failing cleaner or README copy never reached the record. The script still exits 0 and runs the same steps, and now prints a receipt naming the failed steps, which seed_session reads. A failed git commit --amend is not reported: it is expected on an image with no git history. The tests run the generated script with bash, including through seed_session. - denovo_swe: keep the provider's stderr in the error for a command that reported no exit code, so the saved row and the event keep the cause (for example a 503). No score, mask or retry changes. Part of #6983, under #3180. Signed-off-by: Onur Yilmaz <[email protected]>
yuhezhang-ai
left a comment
There was a problem hiding this comment.
Re-reviewed 457fbb3 against main at 34bb0d8. All four earlier findings are addressed, including the two nonblocking diagnostic comments; no new actionable issue found in the update.
Validation: 149 focused tests passed, generated-script/seed-session and CritPt HTTP reproductions passed, and lint, formatting and diff checks passed. Live grading, model rollouts and an actual sandbox provider were not exercised in this follow-up. Scores, exclusions and retries remain unchanged; broader defaults remain the separate #6983 policy discussion.
What
Work package 1 of #6983, under #3180. Seven resources servers score a failure of the verifier, the grader reply or the task data as a model result, and nothing in the saved row says so. This PR does not change any of those scores: every case keeps the reward and mask it had. Each is now reported through
observe_scored_despite_failure(#6393), so the rollout is no longer indistinguishable from a normally graded one. The event is saved beside the row (_ng_failure_events) and counted by therollout_scored_despite_failurehealth check.critptaccuracyand the batch is accepted: it scores 0.0. A batch the grader errors reject is excluded and records nothing.judge_failedofficeqaValueError) is a wrong answer and records nothing.verifier_errorbig_financejudge_errorset. A row without rubric points inrubric_pointsmode scores 0.0 (thefinal_answermode does not use them and records nothing).verifier_errorimage_toolsverifier_errorlc_niahexpected_answerthat cannot be read as a set of node ids (not JSON, not iterable, or unhashable items such as[[1]]) is graded as an empty set, so an empty prediction still scores 1.0. A JSON object is read as the set of its keys and records nothing.verifier_errorasr_with_pcaudio_durationstill counts as correct (reward 1.0).verifier_errordenovo_sweevaluation_completed=False. Seeding goes on after a failed seed prep (the cleaner or the README copy; the script still exits 0 and now prints a receipt of the failed steps),git init,git rev-parse HEAD(no base commit) or listing of the untracked files (the patch then keeps files that were already untracked).session_lost,verifier_errorWhy
#4883 lists failures scored as model results, and #6393 added a way to record them without changing the outcome. Whether Gym should mask, retry or keep such a sample is an open decision (#6983, D1-D4) and affects training, so this PR only makes the failure visible. A later change can act on these events through the shared outcome policy.
Not in this PR
asr_with_pcrows whose reference normalizes to empty: the code documents dropping them from the corpus metrics (Open ASR Leaderboard convention), so they are not recorded as failures.status=failedscored 0 inofficeqaandui_generation(D1).denovo_swesamples that stayevaluation_completed=Falseafter their retries, which belong to the shared coding-server helper (work package 2).image_tools/base.pytool failures shown to the model (work package 7).Compatibility
Scores, masks and retries are unchanged, so benchmark results and training data do not move. A row that hit one of these cases gains a
_ng_failure_eventsentry, and therollout_scored_despite_failurehealth check reports it as an issue (it does not fail a run on its own).Validation
.venvplus the server's extra dependencies (gym env testcould not build venvs here: it needs uv >= 0.13.4 and this machine has 0.11.26):critpt91,officeqa88,big_finance123,image_tools41,lc_niah50,asr_with_pc172,denovo_swe57 passed. These include every test that was already there, which is the check that behavior is unchanged.verify(orscore_answer) and asserts the unchanged reward and mask, the recorded event, and that a real wrong answer or a model's malformed call records nothing. With only the source files reverted, the new tests fail in every server.ruff check,ruff formatandpre-commit run --filespass on the changed files. The private guardwords hook was skipped (catalog unavailable).Rollout evidence
Smoke runs for
lc_niah,image_toolsandasr_with_pcwith a real model (Qwen2.5-7B-Instruct served bylocal_vllm_model, vLLM 0.29.0) throughgym env startandgym eval run --no-serve. Coverage for all three: every rollout completed and measured, none masked. The events appear only on the rows with a verifier or task fault, and therollout_scored_despite_failurehealth check reports them (2 issues on theasr_with_pcrun, one per row withoutaudio_duration).The same saved responses replayed through the verifier on
mainand on this branch (sameis the reward and mask comparison):mainlc_niah[]lc_niahlc_niahoops-not-json(two rows)verifier_errorimage_toolsimage_toolsimage_tools"arguments": [1](the model's malformed call)image_tools"bbox_2d": "abc"image_toolsverifier_errorasr_with_pcaudio_durationasr_with_pcaudio_duration(two rows)verifier_errorEvery row has
same=True. The unit test forlc_niahalso pins the case this makes visible: an empty prediction against an unreadable gold still scores 1.0, and is now recorded.Not covered by a smoke run:
critpt(needs a live Artificial Analysis API key),officeqa(needs the external document workspace and a sandbox),denovo_swe(needs the benchmark's container images and a sandbox) andbig_finance(needs search and SEC credentials and a tool-calling model). They are covered by theverify-level tests above only. This is why the PR stays a draft until a maintainer decides whether that is enough.Reproduce
Needs uv >= 0.13.4 on
PATH, one GPU, and the model in the Hugging Face cache. Run from the repo root.image_toolssystem prompt demands the literal<tool_call>tags: with a looser prompt the 7B model drops them and every row scoresno_tool_call_in_rollout.The rows with a fault carry a
scored_despite_failureentry in_ng_failure_events, andquality_summary.jsonlists them underrollout_scored_despite_failure.main's verifier for the before columns. Run the script with each server's own venv (resources_servers/<server>/.venv/bin/python), from that server's directory, withPYTHONPATH=$OUT/old:<repo root>:replay.py: