Repository navigation
feat(eval): count expected, failed and missing rollouts in the run health summary - #4788
Conversation
…alth summary quality_summary.json only checked each rollout on its own, so a run could lose rollouts or fail most of them and still look fine, and a run that Slurm stopped (scancel, time limit, preemption) wrote no summary at all. - run.artifacts counts the run against its _materialized_inputs.jsonl inventory: expected; failed from the _failures.jsonl sidecar (the last attempt of each owed rollout that never landed, split into final and not final by is_terminal_failure, with counts by class); missing; and a healthy verdict with unhealthy_reasons. A run is unhealthy when a rollout is missing, two records share a rollout identity, or final or non-final failures reach their limit, 2% of expected by default (health_check_max_infra_failure_fraction and health_check_max_final_failure_fraction, or the matching --health-max-*-failure-fraction flags). - The summary is also written when collection fails. A run stopped by SIGTERM unwinds like Ctrl-C and writes a provisional summary from the keys collection holds in memory, without reading rollouts.jsonl, so it finishes well within Slurm's KillWait; gym eval health-check writes the full one later. - A run or resume deletes the previous job's quality_summary.json and rollout_verdicts.jsonl when it starts. - gym eval aggregate counts the failures and inventories next to each shard. - After SIGTERM the run exits with status 143, or 1 (EVAL FAILED) when require_complete is on. No score, metric or rollout changes; the existing summary fields are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
There was a problem hiding this comment.
Two changes I'd like here:
-
Make this part of the health-check suite, with a run-level check ID such as
run_excessive_failures, the usual findings/coverage, and support for ignoring the check. Keep the fast provisional shutdown path: it can evaluate this check from the inventory, failures and saved-result IDs while marking the other checks as not evaluated. The counts should remain available independently of the check. Consumers can still consume an acceptance verdict derived from the configured checks. -
Put the acceptance thresholds and their defaults in shared Gym health-check config. Keep separate configurable ratios for infrastructure failures and other failures, each over expected rollouts. I see the two config fields and run/aggregate flags already exist; please make the shared config the source of truth for defaults, and use the same configuration for normal reporting, provisional reporting and
gym eval health-check. The standalone command currently falls back to the 2% function defaults, so rechecking the same artifacts can change the verdict. Persist the effective thresholds so the decision is reproducible.
For the two failure groups, please keep cause separate from retry eligibility: _ng_failure_terminal alone does not establish infrastructure versus other/model failure. #4834 illustrates this: an authentication error can be terminal, while a service error is retryable.
Review feedback on NVIDIA-NeMo#4788. Both failure limits defaulted to 2% of expected rollouts, so any run with two failed rollouts in a hundred was reported unhealthy, whatever the benchmark. They are now unset by default: the run accounting still writes expected, failed (final and not final, by class) and missing, and a failure limit judges the run only when one is configured. Missing rollouts and duplicated records still make the run unhealthy. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
…sist them Review feedback on NVIDIA-NeMo#4788. The limits were declared twice, on the collection and the aggregation configs, and gym eval health-check had none, so rechecking a run fell back to the function defaults and could flip its verdict. RunHealthConfig now declares the limit settings once for both configs, and RunHealthLimits carries them to gym eval run, gym eval aggregate, the provisional summary after SIGTERM and gym eval health-check. quality_summary.json records the effective limits and their source (config, persisted or override). gym eval health-check judges a run by the limits its summary recorded; its new limit flags override them, and the summary says so. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
…heck Review feedback on NVIDIA-NeMo#4788. The failure limits were applied inside the run accounting, outside the health-check suite, so they had no findings, no coverage and no way to be ignored. They are now the run-scope check run_excessive_failures: one finding per group of failed rollouts that reaches its limit (in run.findings and run.issues), coverage like the other checks (unobserved with no limit or no inventory), and health_check_ignored_checks can exclude it. The accounting counts stay in run.artifacts whatever the check does. The provisional summary after SIGTERM evaluates only this check, from the inventory, the failures sidecar and the saved-record identities, and lists the other checks in not_evaluated. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
Review feedback on NVIDIA-NeMo#4788. The failure groups are split by is_terminal_failure, which says whether a resume retries a failure, not who caused it, yet the not-final group was called infra and the final group model-caused. The limit setting, its CLI flag, the check's finding group and the unhealthy reason now say not final (retryable) and final (not retried): health_check_max_infra_failure_fraction becomes health_check_max_not_final_failure_fraction and --health-max-infra-failure-fraction becomes --health-max-not-final-failure-fraction. The docs state that the split carries no cause. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
|
Thanks for the review. All of it is in four commits; here is what changed and what did not. 1. Part of the health-check suite (7d2495d). 2. One shared config for the limits (52f019c). Defaults (37ce73a). As we agreed, both limits are unset by default, so failures alone do not make a run unhealthy until a limit is configured. Missing rollouts and duplicated records still do. 3. Cause kept separate from retry eligibility (98d1aba). Agreed: Not in this PR:
Each commit adds tests that fail without it. The full unit suite has the same failures as before these commits, none new. |
giuliolovisotto
left a comment
There was a problem hiding this comment.
If you prefer each flag to override only its own limit, I can change that.
I would prefer that.
gym eval health-check replaced both persisted run-health limits when either limit flag was given, so a limit left out became no limit. Each flag now overrides only its own limit, and a limit whose flag is not given keeps the value the run's quality_summary.json recorded. Without a flag the behaviour is unchanged. The limits block in quality_summary.json now records its source per limit, as a map from limit name to config, persisted or override, so a recheck shows which limit was overridden and the verdict stays reproducible. Every path that writes limits uses the same shape. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
|
Done in 65c1388. Each flag now overrides only its own limit. A limit whose flag is not given keeps the value the run's
One consequence: New tests: |
Since each limit flag of gym eval health-check overrides only its own limit, a recheck could no longer remove a recorded limit. A flag value of none, in any case, now removes that one limit; any other value must still be a fraction in [0, 1]. A flag that is not given still keeps its persisted value: the flags default to argparse.SUPPRESS, so an absent flag and none stay distinct. In the Python API, a limit set explicitly on RunHealthLimits overrides the persisted one, and None removes it; a limit that is not set keeps its persisted value (model_fields_set). A removed limit is recorded as null with source override, and a later recheck keeps it removed. gym eval run and gym eval aggregate define their limit flags separately and do not change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
|
Added the explicit no-limit value in 7e915d4.
New tests are in |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/39766335753 |
Brings in the run health counts (NVIDIA-NeMo#4788) and the exporter changes (NVIDIA-NeMo#4852, NVIDIA-NeMo#4873), which the time-limit diagnostics now build on. No conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
…ting does `gym eval aggregate` merges runs from different environment servers, and each numbers its tasks from 0. The duplicate check grouped records by task and rollout index alone, so two such runs flagged every overlapping rollout as a duplicate. Since the run verdict counts duplicates (NVIDIA-NeMo#4788), the whole run was then reported unhealthy. The run accounting already keys rollouts by input; the check now does the same. A duplicate inside one input is still flagged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
…eMo#4996) * fix(health): recheck a merged run directory from its shards `gym eval aggregate` checks the health of the shards it reads: each shard's rows, its failure sidecar and its materialized inputs. The merged rollouts.jsonl holds only the rows, so `gym eval health-check` of the merged directory checked those rows alone. Every failure and every inventory was lost, and the recheck overwrote the aggregation's quality summary with one that counted none of them. Aggregation now lists the shards it merged, in its order, in rollouts_sources.json next to the merged file, with the merged file's size. A recheck of that directory without --rollouts-file reads the listed shards, as the aggregation did, so it counts the same rollouts. It refuses when a shard is gone or the merged file is not the one the aggregation wrote. An explicit --rollouts-file still checks that file alone. The shards are listed relative to the merged directory, so the tree can move as a whole. The merged file is written aside and moved into place after the list, so it never stands without one. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]> * fix(health): name the merged contents by hash and keep shard file names Two gaps in the shard list, found in review: - Equal sizes do not make equal contents. A second aggregation into the same directory that stopped before its merged file took its place could leave a list whose size matched the first merged file. A recheck would then read the second aggregation's shards for the first one's rows. The list now records the merged file's SHA-256 as well, and the recheck checks it after the size. - A shard reached through a file link was recorded by its target. A recheck then looked for the sidecars beside the target, while the aggregation had read the ones beside the link. Only the directories are resolved now, and each shard keeps its file name. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]> * fix(health): verify each shard and drop stale shard lists Review of the shard list found four gaps: - A run that writes an output an aggregation merged into left the list behind: a fresh or resumed `gym eval run`, `gym eval reverify`, and the GDPval multistage driver. A recheck of that directory then refused the run's own rollouts. Each now removes the list when it takes over the output. - A shard changed after the aggregation, for example by a resume, was read as it is now, while the merged rows and metrics hold what it held then. The list now records each shard's size and SHA-256 from the read the merge makes anyway, and a recheck refuses a changed shard. - Merging onto one of several shards replaced a shard the merge had read and listed the merged file as that shard, so a recheck counted its rows twice. That is now refused before anything is written. A single run merged onto itself, the in-place metrics repair, still works and needs no list. - The merged file replaced a symlinked output instead of writing through it as before. The temporary file now sits beside the link's target and replaces the target. The docs and help now say that --rollouts-file checks that file alone, so a merged file not named rollouts.jsonl is rechecked shard by shard. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]> * fix(health): keep the shard list until a run writes to the merged output Review found two gaps in when the shard list goes: - A run that takes over a merged output dropped the list before its own validation. A run that then stopped, for example on a missing input or batch manifest, left the merged rows unchanged but without their shards' failures and inventories. `gym eval run`, `gym eval reverify`, recovery seeding and the GDPval multistage driver now drop the list where they start writing. A fresh run still drops it with the output it deletes, and the GDPval driver sets it aside with the output it quarantines. - A run merged onto itself kept a list that an earlier aggregation into it left. A recheck then followed shards that the merge did not read, or refused the re-sorted file. The merge now drops that list once the merged rows are in place. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]> * fix(health): count duplicate rollouts within one input, as the accounting does `gym eval aggregate` merges runs from different environment servers, and each numbers its tasks from 0. The duplicate check grouped records by task and rollout index alone, so two such runs flagged every overlapping rollout as a duplicate. Since the run verdict counts duplicates (NVIDIA-NeMo#4788), the whole run was then reported unhealthy. The run accounting already keys rollouts by input; the check now does the same. A duplicate inside one input is still flagged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]> * fix(health): drop the shard list with the first row a run writes, and keep the merged file's mode Review of the shard list found three more gaps: - A run dropped the list when it opened the output, before it wrote anything. A resume with nothing left to run, a fully cached reverification, or a GDPval batch of rows that are not persisted therefore lost a list that still described the merged rows. Collection and reverification now drop it with the first row they persist (for ATIF, its kill-shaped diagnostics too). GDPval drops it only for a batch that holds a persistable row. - GDPval also rewrites the output without routing rows: when it prunes rows after a restart stage, and when it publishes the final rollouts. Each rewrite now drops the list once it succeeds; a prune that removes nothing keeps it. - Aggregation replaced the merged file through a new file and reset its mode to the umask default, so a 0600 output became 0644. The merged file now keeps the existing output's mode, as GDPval's rollout writer already does. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]> * fix(health): keep merged rows private while staged, and keep the shard list's checks Three gaps in how an aggregated output and its shard list are handled: - The merged rows were staged in a new file with the default mode and given the output's mode only after they were written, so a 0600 output's rows were briefly readable by others. The staging file is now created exclusively, under an unguessable name, and owner-only when it replaces an existing output. - GDPval dropped the shard list before it opened its output files, so a run that could not open them lost the list without writing a row. It now drops the list just before its first write. - A collection resume with nothing left writes no row, so the aggregation still owns the output, yet its own health check read the run's inventory beside the output and overwrote the shard-backed reports. It now checks the listed shards, as a recheck does. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]> * fix(health): resolve the shard list off the collector's event loop Resolving an aggregated output's shard list hashes the merged file and every listed shard. The collector's health check did that on the event loop, so a large run or slow storage stalled every coroutine. It now runs in a worker thread, like the collector's other artifact scans. The staging-mode test now records the mode when the staging file is opened, instead of mapping descriptors through /proc, so it also runs where procfs is absent. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]> * fix(eval): preserve shard accounting across resume summaries Reject in-place file aliases whose sidecars live beside another name. Use source shards for the post-run health report and avoid replacing shard-backed accounting with a single-file provisional report on stop. Document the supported in-place path and cover the affected boundaries. Signed-off-by: Adam Rajfer <[email protected]> --------- Signed-off-by: Adam Rajfer <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
quality_summary.jsononly checked each rollout on its own, so a run could lose rollouts or fail most of them and still look fine, and a run that Slurm stopped (scancel, time limit, preemption) wrote no summary at all. Anyone gating on the summary had no way to tell whether a score covers the whole run.Changes:
run.artifactscounts the run against its<output stem>_materialized_inputs.jsonlinventory:expectedfailedtotal,final(not retried by a resume),not_final(still retryable),by_class; the split is by retry only and does not say whether the model or the infrastructure caused a failure; null without a failures sidecarmissinghealthy,unhealthy_reasonsexpected. The failure limits are unset by default, so failures are counted but do not make the run unhealthy until a limit is set; null without an inventorypartialtrueonly on the provisional summary written after SIGTERMlimitsmax_not_final_failure_fraction,max_final_failure_fraction, null for no limit) and, insource, where each limit came from:config,persistedwhengym eval health-checkreused it, oroverridewhen its own flag replaced or removed itThe limits are
health_check_max_not_final_failure_fractionandhealth_check_max_final_failure_fraction, or the--health-max-not-final-failure-fractionand--health-max-final-failure-fractionflags ofgym eval runandgym eval aggregate.gym eval health-checkjudges a run again by the limits itsquality_summary.jsonrecorded; each of the same two flags there overrides only its own limit,noneremoves it, and a limit whose flag is not given keeps its recorded value.The summary is also written when collection fails. A run stopped by SIGTERM unwinds like Ctrl-C and writes a provisional summary from the keys collection holds in memory, without reading
rollouts.jsonl, so it finishes well within Slurm's KillWait even on very large runs;gym eval health-checkwrites the full one later. The provisional summary has norun.verdictsand norollout_verdicts.jsonl. It evaluates onlyrun_excessive_failures, lists the other checks inrun.artifacts.not_evaluated, and itshealthyis null unless the accounting already has a reason. A run with a customrollout_collection_driverkeeps no landed keys, so if it is stopped it gets the full check instead.A run or resume deletes the previous job's
quality_summary.jsonandrollout_verdicts.jsonlwhen it starts, so an old report never stands for a new run.gym eval aggregatecounts the failures and inventories next to each shard.The failure limits are judged by a new run-scope health check,
run_excessive_failures: one finding per group that reaches its limit inrun.findings, a count inrun.issuesand coverage inrun.artifacts.coverage. It is unobserved when no limit is set or there is no inventory.--health-check-ignore run_excessive_failuresturns it off and keeps the counts.The rollout health and CLI docs describe the new fields and flags.
Behaviour to note:
run.issuesandrun.artifacts.coveragegain arun_excessive_failuresentry. A reader that ignores the new keys sees no difference.EVAL FAILED) whenrequire_completeis on, whichgym eval submitsets;gym eval run --no-serveexits with 143 either way. Before, the process died by the signal.Tested with unit tests in
test_rollout_health.py,test_rollout_collection.pyandtest_cli_main.py(864 pass), including a subprocess test that sends SIGTERM mid-collection with an unreadable rollouts file and checks the provisional summary and exit status 143.🤖 Generated with Claude Code