Skip to content

feat(eval): record every failure and count failed rollouts as 0 by default - #4845

Closed
AdamRajfer wants to merge 4 commits into
NVIDIA-NeMo:arajfer/stack/retry-rulefrom
AdamRajfer:eval/scoring-defaults
Closed

AdamRajfer wants to merge 4 commits into
NVIDIA-NeMo:arajfer/stack/retry-rulefrom
AdamRajfer:eval/scoring-defaults

Conversation

@AdamRajfer

@AdamRajfer AdamRajfer commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Part 3 of 9, merge in order. Stacked on #4844; the diff shows only this part's changes.

What and why. A failed agent /run ended the run, or left the score, which was then reported over fewer rollouts than dispatched. The gym eval defaults now record every failure and keep it in the denominator: route_failures_to_sidecar: true and count_failure_classes_as_zero: null (every class). [] leaves every retryable failure out of the score, but a final failure still counts as 0 (except a data gap); route_failures_to_sidecar: false ends the run on the first failed call. Data gaps stay out of the score. A counted failure scores 0 on every score channel the benchmark reports, not only on reward, so math's symbolic_accuracy counts it too. MCQA scores it 0 on its strict and normalized components instead of failing aggregation with a mixed-score error. A run in which no rollout succeeded and only retryable failures landed still fails, so a resume runs them; their placeholder zeros do not count as a result.

Methodology. A rollout that was dispatched and failed counts as 0, so the score is over the rollouts the run attempted.

Eval scores. Runs with failed rollouts move down, on reward and on each benchmark score channel such as math's symbolic_accuracy; others do not move.

Training and RL: no change. These are fields of the gym eval run and gym eval aggregate configs. run_examples has its own route_failures_to_sidecar parameter, still False by default, and no scoring. Checked by test_run_examples_keeps_its_own_failure_routing_default.

Unit tests. test_failure_retry_rule.py::TestScoringDefaults, test_rollout_collection.py (defaults scored and opted out, run and aggregate paths, test_with_the_default_scoring_a_run_of_retryable_failures_still_fails, test_run_examples_keeps_its_own_failure_routing_default), resources_servers/math_with_judge/tests/test_app.py::test_a_failure_counted_as_zero_scores_zero_on_symbolic_accuracy_too, resources_servers/mcqa/tests/test_app.py::test_a_failure_counted_as_zero_does_not_break_dual_scores.

🤖 Generated with Claude Code

…fault

A failed agent `/run` ended the run, or left the score, which was then
reported over fewer rollouts than dispatched. The `gym eval` defaults
now record every failure and keep it in the denominator:
`route_failures_to_sidecar: true` and `count_failure_classes_as_zero:
null` (every class). `[]` and `false` opt out. Data gaps stay out of the
score. A run in which no rollout succeeded and only retryable failures
landed still fails, so a resume runs them; their placeholder zeros do
not count as a result.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
@AdamRajfer AdamRajfer self-assigned this Oct 21, 2026
@AdamRajfer

Copy link
Copy Markdown
Contributor Author

/ok to test 3a3a642

@copy-pr-bot

copy-pr-bot Bot commented Oct 21, 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.

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

@svcnvidia-nemo-ci svcnvidia-nemo-ci added area:evaluation Evaluation, rollout collection, reward profiling, comparison, and exporters bug Something isn't working labels Oct 21, 2026
@AdamRajfer
AdamRajfer changed the base branch from main to arajfer/stack/retry-rule October 21, 2026 14:48
@AdamRajfer
AdamRajfer marked this pull request as ready for review October 21, 2026 15:00
@AdamRajfer
AdamRajfer requested a review from ananthsub October 21, 2026 15:00

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

HOLD — BLOCKER: the new default includes failure rows in aggregation without making them compatible with benchmark-specific scoring hooks. Math headlines can still exclude failures, and dual-score MCQA aggregation can fail entirely. There is also a NOTE about the documented opt-out semantics.

Completed inspection of all four changed files and the directly affected dispatch, resume, aggregation, benchmark-hook, and regression-test paths. Validation was source-only; tests could not be executed in this read-only review.

Note: formal approval is not available for this request, so this review is posted as a comment only.

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

count_failure_classes_as_zero: List[str] = Field(
default_factory=list,
count_failure_classes_as_zero: Optional[List[str]] = Field(
default=None,

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.

BLOCKER — Math headline metrics still exclude the failures now counted by default.

Failure / blast radius: For one task with two repeats, let repeat 0 return reward=1, library_reward=1 and repeat 1 fail with a retryable connection error. The default now supplies both rows to aggregation, but _counted_failure_row adds only the scalar reward. Math's _math_score_fn returns no symbolic_accuracy for that row, and compute_pass_majority_metrics excludes absent score channels. Consequently pass@1[avg-of-2]/symbolic_accuracy remains 100, not 50. The corrected scalar mean is not a math headline. This reaches supported math evaluations such as AIME24, online and offline.

Correction: Preserve an explicit metrics-only counted-failure marker through aggregation, and make the math hook supply zero for a missing symbolic score only on those rows. A small suggested implementation, to verify before adoption:

# _counted_failure_row, immediately before return scored:
scored["_ng_counted_failure_zero"] = True

# _math_score_fn, after its library_reward branch:
elif r.get("_ng_counted_failure_zero"):
    scores["symbolic_accuracy"] = 0.0

The marker survives _call_aggregate_metrics, while the generic profiler ignores underscore-prefixed fields. Do not fabricate a judge_evaluations value: genuinely unperformed judge measurements must retain their existing exclusion behavior. Keep measured library_reward values, real judge scores, sidecar contents, and successful-retry deduplication unchanged.

Acceptance — proposed, not executed: Route the two-repeat example through the real math aggregation hook in both collection and standalone aggregation; assert symbolic pass@1 and pass@1[avg-of-2] are 50, with no invented judge accuracy. With count_failure_classes_as_zero=[], the retryable failure remains excluded and symbolic accuracy is 100; a final model failure must still count as zero. After that failed repeat succeeds on resume, assert 100 with exactly two scored rows. Retain the existing empty-response failure regression: its measured library_reward=0 must still yield 50 across eight failed and eight correct repeats.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 990e27b (fix(eval): score a counted failure as 0 on every benchmark score channel), with a test that fails without the fix.

count_failure_classes_as_zero: List[str] = Field(
default_factory=list,
count_failure_classes_as_zero: Optional[List[str]] = Field(
default=None,

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.

RISK — Default failure counting breaks dual-score MCQA aggregation.

Failure / blast radius: Aggregate a shard containing one correct boxed_and_normalized result and a retryable agent_request_failed sidecar row without a verifier result. Previously the default excluded that failure; now it contributes a scalar-only zero. MCQAResourcesServer.compute_metrics sees dual fields on the successful row but none on the placeholder and raises ValueError("Mixed single/dual MCQA scores: reverify all rows before aggregation"). The collector writes an aggregation error and raises instead of producing the intended two-row score. This affects both run and aggregate defaults, including the supported MILU-1.5 configuration.

Correction: Give _counted_failure_row an explicit metrics-only indication of a no-verifier placeholder, preserve it through aggregation, and teach the dual-component branch of compute_metrics to represent those placeholders as zero strict/normalized rewards with null component answers. Do not simply remove the mixed-schema guard or default every missing component to zero: genuine single-score verifier results mixed with dual results must still be rejected. The precise placeholder contract needs to be chosen, so a blanket replacement patch would be unsafe. Keep both persisted artifacts unchanged; component normalization belongs only in metric input or the hook's local copies.

Acceptance — proposed, not executed: Use one successful dual row with both rewards 1 and both answers B, plus one connection-failure placeholder with a different rollout identity. Under default run and aggregate configs, assert no aggregation error, scalar and both component pass@1 accuracies of 50, and 50% component no-answer rates. With [], the retryable placeholder must disappear and those accuracies remain 100. Preserve the existing dual-score regression: normalized accuracy stays 200/3, normalized majority@3 stays 100, and adding an ordinary single-score verifier row still raises the mixed-schema error. Also retain successful aggregation of ordinary single-score MCQA rows.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in aa5d352 (fix(mcqa): score a counted failure as 0 on both dual components), with a test that fails without the fix.

- **Failed agent calls.** By default a failed agent `/run` ends the run, because the alternative is a score reported over fewer rollouts than were asked for. Pass `+route_failures_to_sidecar=true` to let the run continue instead: the call is then recorded in the same sidecar as one attempt, with no reward. Every rollout that leaves the score is logged as it happens, whichever layer classified it, and the totals appear with the closing artifact paths. The class says whether the rollout ran: `agent_run_error` when the agent itself answered, since a NeMo Gym agent returns 500 when its handler raises, and `agent_request_failed` for a gateway status (429, 502, 503, 504) or no usable reply, neither of which says anything about the rollout. Other rollouts keep running, the score is computed over completed rollouts only, and resume re-dispatches the row up to `NEMO_GYM_MAX_ROLLOUT_ATTEMPTS`. A run in which nothing produced a result fails instead of reporting an empty score, unless an option below counts its rollouts as zeros.
- **Counting failures in the score.** Metrics are computed over completed rollouts only. `+count_failure_classes_as_zero=[<class>]` includes the named sidecar rows in `/aggregate_metrics` so they land in the denominator: `[agent_run_error]` counts the rollouts that reached the agent and broke, which is what a model emitting unparsable tool calls looks like from here, and needs `+route_failures_to_sidecar=true` to have anything to count. A row that carries no reward is scored zero for the metric input only, so neither the sidecar nor the rollouts JSONL records a verdict that no verifier gave. It works the same in `gym eval run` and `gym eval aggregate`.
- **Failed agent calls.** By default a failed agent `/run` is recorded in the same sidecar as one attempt, with no reward, and the run continues. Pass `+route_failures_to_sidecar=false` to end the run on the first failed call instead. Every rollout that leaves the score is logged as it happens, whichever layer classified it, and the totals appear with the closing artifact paths. The class says whether the rollout ran: `agent_run_error` when the agent itself answered, since a NeMo Gym agent returns 500 when its handler raises, and `agent_request_failed` for a gateway status (429, 502, 503, 504) or no usable reply, neither of which says anything about the rollout. Other rollouts keep running, the failed rollout is scored as zero (see below), and resume re-dispatches a retryable failure up to `NEMO_GYM_MAX_ROLLOUT_ATTEMPTS`. A run in which nothing produced a result fails instead of reporting an empty score, unless an option below counts its rollouts as zeros.
- **Counting failures in the score.** By default every sidecar row, whatever its class, is included in `/aggregate_metrics` so it lands in the denominator, except a benchmark data gap, which is never scored (see **Retry or final**). `+count_failure_classes_as_zero=[<class>]` counts only the named classes, and `+count_failure_classes_as_zero=[]` counts none, so metrics cover completed rollouts only. A run in which no rollout succeeded and only retryable failures landed still fails, so that a resume runs them, unless `+count_failure_classes_as_zero` names their class. A row that carries no reward is scored zero for the metric input only, so neither the sidecar nor the rollouts JSONL records a verdict that no verifier gave. It works the same in `gym eval run` and `gym eval aggregate`.

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.

NOTE — The advertised opt-out does not exclude final failures.

Failure: This paragraph says a class list counts only named classes and [] counts none. In fact _counts_failure_class always includes final failures unless they are data gaps. For example, tau2_malformed_tool_call still contributes zero with [] or an unrelated class list. The newly added tests explicitly require that behavior, so users following this advice cannot obtain the promised completed-only denominator.

Correction: Replace the two selection claims with: “Final failures always count as zero, except benchmark data gaps. +count_failure_classes_as_zero=[<class>] additionally counts retryable failures in the named classes; +count_failure_classes_as_zero=[] excludes retryable failures only.” Make the same correction in both config field descriptions in rollout collection and aggregation, rather than changing the established scoring rule.

Preservation / acceptance — static checks: Documentation must distinguish final model failures, retryable infrastructure failures, and unscored data gaps. Retain the tests asserting that [] counts the final malformed-tool-call row but excludes judge_failed, a list naming judge_failed counts both rows, and data gaps remain excluded even when explicitly selected. No test execution is claimed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in cf57d41 (docs(eval): say that final failures count as 0 whatever the class selection).

AdamRajfer and others added 3 commits October 21, 2026 19:43
Bot finding 4339065574, PR NVIDIA-NeMo#4845 (part 3, scoring defaults). A failure counted as 0 by default
reached aggregation with only a reward, so a benchmark scorer that reads its own channel (math's
symbolic_accuracy from library_reward, and other score_fn hooks) left the row out and the
headline pass@k stayed at the solved share. The metrics-only copy is marked
_ng_counted_failure, and compute_pass_majority_metrics scores it 0 on every channel the other
rows report. Measured rows without a judge call keep their judge channel out, as before; the
sidecar and the rollouts file are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
Bot finding 4339065593, PR NVIDIA-NeMo#4845 (part 3, scoring defaults). With failures counted by default, a
failure without a verifier result reached MCQA's dual-score branch, which raised Mixed
single/dual MCQA scores and failed aggregation. A row marked _ng_counted_failure is now 0 on the
strict and normalized components with no answer; a real single-score result mixed with dual
results is still rejected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
…ection

Bot finding 4339065608, PR NVIDIA-NeMo#4845 (part 3, scoring defaults). The docs and both config field
descriptions said count_failure_classes_as_zero=[] counts no failure, but a final failure always
counts as 0 (except a data gap). They now say the selection only adds or leaves out retryable
classes. No scoring change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team October 21, 2026 17:44
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the blocked Work cannot move forward until an external dependency is cleared label Oct 21, 2026
@github-actions github-actions Bot added the sla:review-overdue Review response is over the one-business-day SLA label Oct 22, 2026
@AdamRajfer

Copy link
Copy Markdown
Contributor Author

Closing this version to consolidate review on #5072 (failure reporting) and #5073 (saved-state recovery). This does not mean those PRs implement every proposal from this earlier stack; scoring policy and persistence follow-ups remain separate.

@AdamRajfer AdamRajfer closed this Oct 26, 2026

This branch was previously deployed

1 inactive deployment
public — cf57d41a Deployed Oct 21, 2026 by copy-pr-bot[bot] via release / finalize / notify #6325
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 blocked Work cannot move forward until an external dependency is cleared bug Something isn't working 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.

2 participants