Repository navigation
feat(eval): rescore selected answers from resumed runs - #3879
Conversation
bb7de75 to
94f086c
Compare
|
/ok to test 94f086c |
94f086c to
99c41e0
Compare
99c41e0 to
0914103
Compare
0914103 to
a575f9e
Compare
|
/ok to test a575f9e |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP WITH CARE — one RISK.
A bounded managed-source re-score can fail on an unrequested completion because the iterator fingerprints the next answer before checking --limit.
The earlier stale-cache and eager-materialization findings are fixed: cache validation rejects changed source bindings, and selected answers are loaded lazily.
I completed the broad review across all five changed files and their affected selection, persistence, verifier, settlement and aggregation paths. Tests were inspected, not executed in this read-only review.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
| with open(rollouts_jsonl_fpath) as r_f: | ||
| with nullcontext(selected_rollouts) if selected_rollouts is not None else open(rollouts_jsonl_fpath) as r_f: | ||
| for line in tqdm(r_f, desc="Reading rollouts"): # never holds the whole file | ||
| if limit is not None and n_yielded >= limit: |
There was a problem hiding this comment.
RISK — Check the limit before requesting the next selected row
Failure: Save two selected managed results: task 0 with response={} and a numeric reward, followed by task 1 without response. Run ordinary re-scoring with limit=1. This loop requests task 1 before checking the limit. The new _selected_rescoring_rows fingerprints it before yielding, so _rollout_response raises and task 0 never reaches /verify. Native completions without a response are supported saved results; a row outside the requested limit shouldn't invalidate task 0. The previous file iterator checked the limit before interpreting the next row.
Correction: Could you check the yielded-pair count before advancing the iterator? In _yield_inputs_and_rollouts_paired, replace the for header and its limit check with the following, leaving the remaining pairing body unchanged:
rows = iter(tqdm(r_f, desc="Reading rollouts"))
while limit is None or n_yielded < limit:
try:
line = next(rows)
except StopIteration:
breakThis suggested replacement needs author verification. It keeps the limit counted after the predicate and prevents decoding or fingerprinting an unrequested selected row.
Preservation: Keep latest-attempt selection, aliases, missing-input errors for requested rows, and unlimited iteration. Requested rows without a response must still raise the existing explanatory error. Predicate-rejected rows must not consume the limit.
Acceptance — proposed, not executed: Add the two-result setup above. With limit=1, only task 0 must be verified successfully; without a limit, task 1 must still raise the missing-response error. Retain the predicate-limit assertion yielding tasks 0 and 2. Update the lazy-loading regression to expect exactly [0] decoded with limit=1, all six without a limit, and unchanged source bytes.
There was a problem hiding this comment.
Already fixed at this head: the limit is checked before the next row is read. test_rescore_limit_does_not_interpret_unrequested_completion covers the response-less second row.
…e shard A recorded shard prefixes each row's rollout id with its run id, after removing the prefix an earlier shard put on a row it returned. A row fed back as `<earlier run>.0` and a new row whose own id is `0` therefore both became `<this run>.0` in the same call. They would then share capture files and one manifest identity. A training framework hits this when a step resubmits a returned row next to fresh rows whose numbering restarted. run_examples now refuses such a call before dispatch, and before the existing shard is replaced. The error names both rows and both of their own ids, so the caller can give each row a distinct _ng_rollout_id or distinct task and rollout indices. Test: `<earlier run>.0` beside `0` is refused with both ids named, nothing is dispatched and the existing shard is kept. `<earlier run>.0` beside `1` still dispatches, as `<run>.0` and `<run>.1`. It fails without the change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
The capture key, a rollout id with its attempt suffix, also names the model server's capture files. The longest of them is `<key>.capture.incomplete`, and a file name holds at most 255 bytes. A recorded shard adds a 33-character run-id prefix to each row's id, so a long explicit id could pass that limit and fail only when the first model call was captured, mid-rollout. A shared check, check_rollout_id_length in nemo_gym.core.episode_context, allows a rollout id of up to 230 bytes. That leaves room for attempt suffixes up to -a9999 and the longest capture file suffix, and also keeps a key under a 256-character id limit. run_examples applies it to each recorded row's id after the prefix is added, before dispatch and before the existing shard is replaced. The error names the id, its length and the limit. Test: an id one byte over the limit, after the prefix, is refused with nothing dispatched and no shard written. The longest id that fits dispatches, and its capture file name at attempt 9999 is exactly 255 bytes. It fails without the change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
The library reference page generated from the judge_profile module failed
to parse: its module docstring wrote the pool node variable as
``${GYM_POOL_<POOL>_NODES}``, and the generated MDX read `<POOL>` as a tag.
The docs preview of any change that rebuilds the full reference failed on
it.
The docstring now names the variable as ``GYM_POOL_*_NODES``. No other
docstring combines a ${...} reference with an angle-bracket placeholder,
and the other pages built from docstrings parsed in the same build.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
…stant
The library reference page for the judge_profile module failed to parse.
The page generator writes each field's default into an MDX attribute as
its Python repr, and JudgeExecutionProfile.qos_source defaulted to the
string "the partition's default". Because of the apostrophe, the repr is
double-quoted, so the generated line was
<ParamField path="qos_source" type="str = "the partition's default"">
and MDX stopped at the `'` ("Unexpected character `'` in attribute name").
The default is now the module constant PARTITION_DEFAULT_QOS, with the same
text, so the page shows `str = PARTITION_DEFAULT_QOS`, as it does for
`kind: str = CPU_PROFILE`. The two other places that set the same source
use the constant too. The text in the operator's log does not change. No
other plain string default in nemo_gym contains an apostrophe.
Verified by generating the page locally with the docs CLI and compiling it
with MDX 3: the old page fails with the error above, the new one compiles.
The judge profile tests pass unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
A selected-row iterator fingerprints its answer while advancing. Check the post-predicate limit before requesting another row so an unrequested completion without a response cannot reject a bounded rescoring pass. Keep unlimited iteration and missing-response errors for requested rows. Test the boundary through direct and aliased managed sources, and require exactly one decoded answer with limit=1. Validation: 868 recovery/reverification tests and all-files pre-commit pass. The three relevant boundary regressions fail against 3824557; unlimited controls pass. The shared generated judge_profile docs issue is unchanged. Signed-off-by: Yuhe Zhang <[email protected]>
|
/ok to test 0716472 |
Signed-off-by: Adam Rajfer <[email protected]>
|
Rechecked Server CI passed; combined core coverage and the final test aggregate are still finishing. The docs-preview and nonblocking conformance failures match the shared failures on the base, including the library reference generated from main. @AdamRajfer, this looks ready for your final code review while the remaining checks finish. Thanks! |
AdamRajfer
left a comment
There was a problem hiding this comment.
I ran this too. The re-scoring and reverify tests pass on this head (337 across the reverify, rejudge, CLI and ATIF files), 39 of the new ones fail against the previous layer's source, and the three tests for the newest commit fail without it. I also checked the limit change directly: with limit=2 the source iterator is advanced exactly twice, and with limit=0 not at all, so a bounded re-score no longer consumes a row it won't use. The health, store and records tests of the layer below still pass here (852).
The binding of each re-scored row to the saved answer it came from (run id, rollout id, attempt, answer hash) is a good way to make stale cache entries impossible. Two questions inline about how it fails.
…recovery-health Brings in the #5443 commits that landed after this branch last merged it, so the merge with main sees the shared history. No conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
…ealth No conflicts; git merged every file on its own. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
…ez/2135-judge-recovery No conflicts; git merged every file on its own. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
|
/ok to test c444f4b |
|
Merged main after #5443 landed. The resolution kept main's manifest helpers and carried the digests: this PR's own diff against main is unchanged, and git merged every file on its own. |
Signed-off-by: Yuhe Zhang <[email protected]>
Signed-off-by: Yuhe Zhang <[email protected]>
…eview-20261104 Signed-off-by: Yuhe Zhang <[email protected]>
|
/ok to test 6866cd6 |
No conflicts; git merged every file on its own, following the test files #5589 moved. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
Main now mirrors nemo_gym's packages in tests/unit_tests (#5589). The journal health test covers nemo_gym/rollouts/rollout_health.py, so it moves to tests/unit_tests/rollouts/, and its import of the re-judge test helpers follows that module to tests/unit_tests/eval/. Without the import change the settled-judge-answer test fails with ModuleNotFoundError on the merged tree. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
…very No conflicts; git merged every file on its own. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
No conflicts; git merged every file on its own. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
…st tree Main now mirrors nemo_gym's packages in tests/unit_tests (#5589). The journal re-verification test covers nemo_gym/eval/rollout_reverification.py, so it moves to tests/unit_tests/eval/, and its import of the re-judge test helpers follows that module to the same folder. Without the import change the settled-judge test fails with ModuleNotFoundError on the merged tree. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
One conflict, in fern/versions/latest/pages/evaluation/resume.mdx: the sentence on aliases, which #3881 rewrote and this branch rewrote again on top of #3881's version. Kept this branch's sentence; every other file merged on its own. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
|
/ok to test 7ea5bfd |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42030925105 |
What does this PR do?
Ordinary
gym eval reverifycan now re-score the currently selected completed answers from a resumed run directly into a separate output. Previously it refused a history containing replaced outcomes, including a judge failure settled by #5343, and required an exported projection first.For example, when an initial attempt fails and its retry succeeds, re-scoring uses the retry's saved answer once. If a newer attempt failed or was interrupted, an older success is excluded. The policy model is not called.
Stacked on #3881 in Adam's failure and recovery stack, above #5443/#5343/#5072. Follow-up to #3302 for #2135. Judge-only recovery and its admission/budget policy are provided by #5343.
Separate outputs carry
_ng_reverification_source_run_idas provenance without claiming ownership of the source run's recovery history. Successful rows seeded during judge recovery also use the selected history and retain that provenance. Partial re-scoring can resume from its separate output. Malformed verifier completions are rejected before being saved as successes; declared failures and omissions keep their existing handling. Source-artifact protections remain enforced.Validation
Python 3.13.14, Linux, dedicated CPU allocation. The final combined tree passed 2,335 tests, plus 24 subtests:
--forceand produced the documentedunsafe_output. This does not validate judge accuracy, production workloads, native session restoration or training-token capture.Full sandbox/server CI remains pending for this rewritten head.
Compatibility and scope
Ordinary re-scoring always writes separately and can use a different verifier configuration. It does not update source outcomes, attempt reservations or retry budgets. Managed judge settlement retains #5343's original-attempt identity and admission-before-dispatch behavior. Legacy JSONL, legacy append and ATIF retain their existing contracts.
Checklist