nemo_gym.eval.rollout_reverification
nemo_gym.eval.rollout_reverification
Module Contents
Classes
Functions
Data
API
Bases: RemovedRolloutOptionsMixin, UploadRolloutsConfigMixin, BaseNeMoGymCLIConfig
Bases: BaseModel
Call /aggregate_metrics on each resource server after rollouts complete.
Writes a single _aggregate_metrics.json with one entry per agent (same shape as the old _agent_metrics.json). Returns the file path.
Query GET /reverify_mode on each unique resource server referenced by agent_to_rs.
Returns a sorted list of RS names that reported ReverifyMode.UNSUPPORTED or ReverifyMode.UNKNOWN.
Leave out the bound saved results whose verifier is not stateless: only a STATELESS verifier grades a saved
answer again. Judge failures stay bound as before.
Validate selected routes before ATIF reverification touches output paths.
Check reverify_mode for every RS in the config before reverification starts.
Returns a warning string when the user runs full re-verification (not judge-failed-only) and force=True and at least one RS is UNSUPPORTED or UNKNOWN (caller must print it and apply the unsafe_ output prefix). Raises ConfigError when force=False and at least one RS is UNSUPPORTED or UNKNOWN. Returns None when all RS are STATELESS.
Whether a failures-sidecar row is a judge failure, the class --judge-failed-only recovers.
A record_omitted_rollouts row records a rollout that produced no result, so there is nothing to judge.
Load the full main jsonl (cached + newly re-verified successes), sorted by (task, rollout).
Returns (results, rows): results are the parsed rows — the source of truth used for both
the W&B rollouts export and the aggregate-metrics payload; rows is a minimal
{agent_ref, task_source} projection used only to route each result to its resources server
(with the same resolver as /verify). Read once and reused for both so the file is never read twice.
A row cached by a reverification that did not keep collection’s identity stamps gets the stamps its source
rollout (same task and rollout index, from identity_sources) carries, so a resumed output groups as a fresh
one does. Only missing stamps are filled, in memory; the output file is not rewritten. A row whose source
rollout has no stamp groups as that rollout does. If an unstamped row has no source rollout at all while other
rows are stamped, its identity cannot be established and aggregating would split one run, so this raises
ConfigError before anything is exported or aggregated; the output file keeps every row.
Build verifier payloads from an explicit ATIF-to-materialized-task manifest.
Retain source provenance without claiming ownership of its recovery history.
Build the row filter for --judge-failed-only recovery.
Keeps only judge-class failures, skips any whose (task, rollout) key is in skip_keys (the keys
already present in the output: seeded successes + rows a prior recovery already appended) so a
key-in-both is never re-verified/duplicated and re-runs are idempotent — this dedup is done here,
independent of the resume/cache machinery — and dedups on the key so a sidecar with multiple failure
attempts for one key re-verifies it exactly once.
Refuse --judge-failed-only on multi-stage rows before any file is written.
Multi-stage rows carry stage_index. Recovering them outside the multi-stage collection
would lose stage identity and the adaptive reference set. Recovery reads the failures sidecar.
Bind a re-score to its saved answer, independently of changes to the source grade.
Read the selected resources server’s MCP exposure flag from Gym config.
Whether a selected saved result is graded again from its saved answer (reverification_cause).
Return the response a rollout’s verifier scored, or explain which result type lacks one.
The resources server that verifies this row.
A task_source naming a resources server is authoritative (it is the declaring instance the dataset was stamped with — no agent indirection needed). Otherwise fall back to the rollout’s agent_ref via the config’s agent->rs edges.
Copy the already-successful rollout rows into the output file so the final aggregate covers
successes + recovered rows, and return the set of (task, rollout) keys ALREADY PRESENT in the output
afterward. Rows whose key is in exclude (saved results that are re-verified) are not seeded.
Resolve each ATIF row through the same routing policy used by /verify.
Read answers on demand so a bounded re-score does not materialize the whole run.
An exit callback for a pass that raised in-process after admitting its re-judgments, run under the run lock.
The outcomes the pass already received are settled as usual, then each admission still without a saved outcome
is withdrawn: its row stays selected, so a later pass grades it again and recovery decides REVERIFY instead of
stopping on an outcome it cannot know. At worst a /verify call that did reach its server is made again for the
same saved answer. An interrupted or killed pass leaves its admissions for recovery as before. record gets
the pass’s settlement counts, so its failed receipt says what it settled and withdrew.
How many selected results of the run a re-judgment settled.
Collection’s identity stamps of each source rollout by (task, rollout), and the keys of every source rollout.
Rollouts without stamps have a key but no stamps entry.
A resume that finds neither the output nor its failures sidecar starts the output anew, so the exporters, which reopened the run recorded next to it, start a new run too. Append recovery continues its output.
Whether a re-verification answered without a usable grade: a failure, a mask or no finite reward.
Keep a malformed verifier reply out of a managed source’s separate scoring output.
Refuse stale successes and failure-budget entries before cache filtering or any dispatch.
Snapshot the source run’s selected judge failures and provenance before any judge call; the caller holds run_lock.
A failed re-judgment spends the run’s failure budget (attempt_counts against the saved
max_rollout_attempts); a rollout that has spent it, or a run without a saved cap, is refused before judging.
With skip_spent a rollout that has spent it is left out of the binding, and the others are bound. An admitted
re-judgment with no saved outcome is refused, unless withdraw_unresolved: the caller ruled out a live job of
the run, so the pass that admitted it died, and it is withdrawn and its row bound again.
The selected saved results whose grading failed for a judge or verify-transport cause, or was never recorded
(_reverifiable_saved_result), are bound too, under saved_results: a failed re-verification of one saves
nothing, so it spends no failure attempt.
Refuse to send a saved patch (saved_model_patch) to a resources server that does not replay one.
The rollouts of a managed run whose selected judge failure, or saved result to grade again
(_reverifiable_saved_result), a re-judgment can still settle.
A judge failure whose saved failure attempts are spent, a run without a manifest and a run without a saved failure cap have none.
The receipt at path, as write_settle_receipt wrote it.
Re-judge the saved judge failures of the run output in place; return how many rollouts it settled.
The saved results whose grading failed for a judge or verify-transport cause, or was never recorded, are graded
again from their saved answers too (bind_judge_failures); only stateless verifiers grade them.
A run’s driver calls it at the end of collection, and so again at the end of each resumed collection, while the
run’s servers are up. Only the saved answers go to /verify again: no policy call, no new model attempt. It is the
gym eval reverify --judge-failed-only --settle-into-source path: each re-judgment is admitted in the run
manifest before its judge call and spends one of the rollout’s saved failure attempts, so an interrupted pass is
not judged twice, and a rollout that has spent them keeps its masked row. The judged rows are kept under
reverification/<pass>/ beside the run, and each settled row names its admission and the failure it settles.
A run with no due judge failure returns 0 and judges nothing.
Settle the bound judge failures with the results judged in this run; returns how many were added.
The caller holds the run lock taken for the binding, so no other writer ran in between. The source must still match
the binding. A judged identity that the binding does not hold, a changed manifest or materialized input, or a
failure that is no longer the selected outcome is refused. A bound saved result replaces its grade only with a
result that binds the same saved answer and attempt (is_rejudgment_of); one whose re-verification answered
without a grade keeps its saved row, and its admission is withdrawn.
Each settlement is recorded in binding["settled_operations"] (this pass’s admission operation ids) as soon as
it is fsynced, and each completed withdrawal in binding["withdrawn_operations"], so a pass that raises
afterwards, for example on the Store’s exit-time coverage write, still counts them, each once. Settling again
after such an error (the failed pass’s exit callback) skips what this pass already settled or withdrew, closes a
settled admission that is still open, and expects only the pass’s other admissions to be open.
Recheck the queued artifact snapshot under the caller’s existing run lock, before judging.
Write the judge-only recovery job’s receipt at path (settle_receipt_fpath) and return it.
state is completed or failed. The counts are the pass’s settlement record (zeros when the pass ended
before it settled anything): the saved answers selected for grading again, those judged, those settled with a
grade bound to the same saved answer, run and attempt, those re-verified without a grade and left as they were,
and those not re-verified because their verifier is not stateless. coverage is the settled run’s
RolloutStore.coverage() (its counts only), due_after how many saved answers a later pass would still grade
again, and refreshed whether the run’s aggregate metrics and quality summary were recomputed. The receipt is
written whole and moved into place, so a reader never sees a partial one.