Repository navigation
feat(eval): count a rollout that produced no row as zero - #3559
Conversation
A rollout that fails and says so leaves a sidecar row, and `count_failure_classes_as_zero` can pull it back into the denominator. A rollout killed mid-flight leaves nothing in either file, so no failure class reaches it and it leaves the denominator as well as the numerator -- the score then reads higher the more of the run went missing. The materialized inputs are the record of what the run was owed, and rollout collection already reads them to print its coverage line. `count_missing_rollouts_as_zero` feeds that same difference into the metrics instead: off by default, so no existing number moves, and available on the offline `gym eval aggregate` path too, where each shard carries its own materialized file. Measured on a 198-task GPQA run with 8 repeats, 1483 rollouts and 101 failures: scoring the successes alone reports pass@1 0.8489 over 195 tasks, because three tasks failed every attempt and vanished. Counting them puts it at 0.8119 over 198, which is what the run earned. Signed-off-by: Matvei Novikov <[email protected]>
`harbor_agent_general` inherited `compute_metrics` from `AggregateMetricsMixin` and returned an empty dict, so every benchmark running through it reported only the RewardProfiler baseline -- mean, min, max -- and no pass@k at all. Anyone wanting pass@k computed it outside the run, from the rollouts file, with the task count supplied by hand. `compute_pass_majority_metrics` already does this for five resource servers, so the override is the same three lines they use. `answer_key` is left unset because Harbor reports a score rather than an extracted answer, which leaves majority@k with nothing to take a majority of. On the GPQA run above the resulting pass@1 and pass@8 match, to four decimal places, what an external script produced from the same rollouts. Signed-off-by: Matvei Novikov <[email protected]>
6dbd2b7 to
5129ee8
Compare
|
Please address these aggregation issues before merging:
Please also warn or fail when the flag is enabled but a shard's materialized inventory is unavailable, and distinguish completed/measured outcomes from imputed zeros in reporting. The flag's default, required artifacts, and interaction with failure-class selection should be documented alongside the validation evidence. For coordination, my #3302 also changes these aggregation paths. It introduces attempt-aware accounting that distinguishes completed, masked, failed, intentionally omitted, and unknown outcomes. This PR does not need to depend on it, but whichever merges second should reconcile the shared paths so optional zero imputation preserves those distinctions and uses the selected latest attempts. |
Thanks for the review! On the metric hooks: your four reproduce, but I think the scope is wider than this PR. There is also no row that satisfies all of them. tau2 wants a I'd put a shared guard in On #3302, assuming this lands first: this PR's headline test uses |
Three defects found in review, all on the same path. A rollout recorded in the failures sidecar looked missing whenever its class was not selected, so the option scored exactly what the selection excluded -- with the flag on, count_failure_classes_as_zero had no effect at all, including under its default. The sidecar is read here now rather than trusted from the caller, which also restores the coverage line that the resurrected rows silenced. Imputed rows were appended after the rows that landed, leaving a missing early repeat behind its own task's later ones. pass@k reads a task's repeats positionally, so the per-sample scores and the spread across runs were wrong. Both paths order rows before aggregation; the inline path reorders its two lists together, since the aggregator zips them positionally. A shard whose materialized inventory is absent is now reported instead of silently contributing nothing, and imputed rows are counted separately from measured ones as coverage/imputed. Signed-off-by: Matvei Novikov <[email protected]>
|
Thanks for the fixes and the additional investigation. I agree that point 2 is a shared problem affecting both flags, and that filling in missing fields could invent measurements. A shared safeguard covering both options makes sense. I’d prefer benchmarks to explicitly declare support for imputed zeros, with an enforced check and a clear error for unsupported use. A separate fix against main is fine with me. Are you planning to add that safeguard here or in a companion PR? We can keep point 2 open until that protection is in place. I also found one regression in the latest commit: with |
`disable_aggregation` skips the branch that counts the imputed rows, but the metrics export runs outside it, so a run with an exporter configured raised UnboundLocalError on coverage/imputed. Initialized next to `counted`, before the branch, and covered by a test that exercises the export with aggregation disabled. Reported in review. Signed-off-by: Matvei Novikov <[email protected]>
@yuhezhang-ai The safeguard makes more sense against main as its own change and it covers both flags and touches every benchmark's metrics hook. I'm not planning to pick that one up. Does point 2 staying open block this PR, or can it merge while that lands separately? |
|
Thanks, I confirmed the exporter fix on Point 2 is non-blocking for this PR. I agree that the existing metric-hook compatibility issue can be handled in a separate fix against main covering both flags. Please document the current limitation and link a follow-up issue so it remains tracked; the shared safeguard does not need to be implemented here. I have no further blocking code findings on this revision. Before merge, please use a Conventional Commit title and complete the PR description with the validation performed, the GPQA rollout evidence, and the scoring impact/known limitation. The full CI checks and final approval are still pending. I’m authorizing CI for this commit below. |
|
/ok to test 5f508c7 |
…ollout is missing Signed-off-by: Matvei Novikov <[email protected]>
Signed-off-by: Matvei Novikov <[email protected]>
|
@giuliolovisotto thanks for review, addressed both comments! |
|
/ok to test cf86513 |
|
CI is running for cf86513. I verified both fixes from Giulio’s review; 386 focused repository tests pass, plus two additional checks with in-memory result retention disabled. One interaction with the newly merged dispatch budget needs clarification. Adding Could we preserve the empty-run error when aggregation is disabled and add a regression test for that combination? Also, should this option intentionally count budget-deferred attempts as zero when aggregation is enabled? If yes, please document that explicitly. The previously agreed metric-hook follow-up remains non-blocking. Once this interaction is settled, @giuliolovisotto could you recheck your two fixes and update your review? |
|
/ok to test fba554b |
yuhezhang-ai
left a comment
There was a problem hiding this comment.
Reviewed fba554b. The empty-run guard is fixed and the policy for budget-deferred attempts is documented and covered by regression tests. Current CI passes, including core/sandbox coverage and all eight server-test groups, and Giulio has approved this revision. No blocking findings remain. The minor empty-aggregation/head-server edge case can be handled separately.
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/37021398188 |
What does this PR do?
A run scored only what it produced. A rollout that vanished, killed partway or dispatched and never heard from again, leaves no row in the rollouts jsonl and none in the failures sidecar. So it fell out of the denominator too, and the score went up when more of the run broke.
count_missing_rollouts_as_zerocounts those from the run's materialized inputs. Off by default. A rollout that is in the sidecar is never counted here, whatever its class, so this does not overridecount_failure_classes_as_zero. Imputed rows are reported separately ascoverage/imputed.The Harbor agent also gets a
compute_metrics, so its runs get pass@k from Gym instead of from a script next to it.Known limitation, tracked in #3593: some benchmark metric hooks cannot score a row that carries only identity and a reward, and a few score it as a measurement. That is already true on main for
count_failure_classes_as_zero, so it is not fixed here.Validation
pytest tests/unit_tests/test_rollout_collection.py, 206 passpytest tests/unit_tests/, run twice, once with these changes stashed: 48 failures both times, same set, none in the files this PR touchespre-commit run --all-filespytest responses_api_agents/harbor_agent_general/tests/test_app.py, 17 passRollouts
No new rollouts were collected for this. The numbers below come from runs we already had.
Five of our BioMysteryBench and BiomniBench runs had rollouts that reached neither file. The clearest is a 360-rollout BioMysteryBench run that lost its allocation partway: 312 scored, 2 in the sidecar, 46 gone.
count_failure_classes_as_zerogives todayThe existing option barely moves the score there, because only 2 of the lost rollouts were in the sidecar. This one covers the other 46.
This does not show up on GPQA. In all four of our GPQA runs the materialized inputs match rollouts plus sidecar exactly, so the option would change nothing.
Compatibility and benchmark impact
Off by default, so no existing run changes. Turned on, a score can only go down, never up: it only adds zeros. Numbers from before will look higher on runs that lost rollouts, and that is the bug.
It needs the run's materialized inputs. A shard without them gets a warning and is skipped, instead of quietly counting for nothing.
Checklist
pre-commit run --all-files) (so CI lint/format checks pass).git commit -s) (so the DCO check passes).