Repository navigation
feat(eval): give the in-process API a typed rollout outcome - #5595
Conversation
|
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. |
9be3665 to
218836d
Compare
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP
LGTM — no concerns found. I inspected all seven changed files and traced the outcome mapping through the collector and verifier response contracts. The new fields preserve reward/result alignment, and the public exports and documentation match the additive API change.
Static review only; I did not execute tests.
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.
218836d to
ff84b8d
Compare
ff84b8d to
2bc04ab
Compare
2bc04ab to
8746497
Compare
8746497 to
41b9a2d
Compare
…and the raw result A task is always run once, so run_task drops num_repeats and the repeat suffix of the rollout id, and TaskResult holds the typed outcome and the raw /run result instead of parallel lists. Signed-off-by: Ingo Guehring <[email protected]>
3f94ccf to
b4e2adc
Compare
Signed-off-by: Ingo Guehring <[email protected]>
…Result A task runs one rollout, so TaskResult only wrapped the outcome, the task id the caller already has, and the raw /run response. The raw response is now a field of RolloutOutcome that is left out of repr and comparison. Signed-off-by: Ingo Guehring <[email protected]>
… which exceptions propagate Signed-off-by: Ingo Guehring <[email protected]>
|
/review |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP
No qualifying findings in this follow-up. I checked single-rollout dispatch and cleanup, the outcome and failure contracts, and the public exports against the documentation and regression assertions. One delegated report wasn't available; I inspected its outcome-mapping topic directly.
The previous review was clean, so there were no unresolved findings to verify. Its reviewed tree isn't mounted, and the supplied diff is the full PR diff, not the inter-review delta. I couldn't independently establish that delta and found no qualifying regression proven introduced since the previous review. This approval is limited to the follow-up scope.
Static review only; I did not execute tests.
Review generated by codex. This was a findings-only review. Request a full review with /review reset=true.
run_outcomes takes max_num_tries and connect_grace_s and forwards them; run_task passes 2 and 60 s, the bounds of gym eval run. A dead environment server now fails the trial as a typed failure after a minute instead of being retried for ever, and the failure record can say not_sent. Found by killing the environment server during an end-to-end run. Signed-off-by: Ingo Guehring <[email protected]>
AdamRajfer
left a comment
There was a problem hiding this comment.
Verdict: no formal blockers, but I would fix findings 1 to 3 before merge, because they decide whether a caller can tell a model result from an evaluation fault. The direction is good: a failed /run no longer raises, reward=None for it is the right choice (not a zero), raw is kept out of the contract, and the retry bound on the connection mirrors gym eval run. I checked out the head (deffb89), ran the PR's tests plus test_failure_kinds and the run_outcomes test (201 passed), and called _outcome directly with Gym's own lost_session_verification(...) result. Not verified: a live failed /run, the connect-grace loop against a real refused connection (the tests only check that the bounds are forwarded), the full suite, import-linter.
Lens tags: [contract] failure handling, [day-0] genericity and docs, [quality] general.
-
[contract] A masked, evaluation-side result still surfaces
reward=0.0.nemo_gym/environment/in_process.py:337-358.lost_session_verification()(server_runtime/base_resources_server.py, "a reward of 0 would read as a policy that solved nothing") returnsreward 0.0, mask_sample True, failure_kind session_lost._outcomepasses it through asRolloutOutcome(reward=0.0, masked=True, failure=session_lost). I ran this. The docs example isprint(outcome.reward)and the docstring says "an infrastructure failure is not a score of zero", but a caller that averages.rewardand ignores.maskedcounts a lost session as a model zero. The new test case forsession_lost(test_in_process.py:126) has nomask_sample, so it does not cover the realistic shape. Suggest eitherreward=Nonewhenmask_sampleis true (the verifier says that reward is not a measurement), or keep the value but document it loudly and add a singlescoredproperty (reward is not None and not masked) used in the example. Add a test withmask_sample: True. -
[contract]
domainis not a fault-side signal, and the docs tell callers to group by it.in_process.py:129-137,index.mdx:135.model_request_error(the model's own outcome, inMODEL_FAULT_KINDS) andmodel_transport_error(a server fault, evaluation-side) are both domainmodel.agent_timeout(model fault) andagent_run_error/agent_request_failed(evaluation-side) are bothagent. Gym already has the classification (core/failure_kinds.py:is_evaluation_side,MODEL_FAULT_KINDS), but the outcome does not expose it. A caller that wants to retry environment faults and keep model results has to re-derive this, and grouping by domain will retry model-caused failures or count evaluation faults as the model's. Suggest a field or property onTaskFailuresuch asevaluation_side: bool | None(None for unregistered or namespaced kinds), and rewrite the "group by domain" sentence so it does not imply domain is a fault class. -
[contract] The retry-relevant evidence is dropped.
in_process.py:360-369, PR description "ignoresdelivery". For a failed/run,delivery(not_sent/possibly_delivered/delivered) is the only thing that says whether resending could start a second episode.run_taskitself now producesnot_sentafter the 60 s grace. With it removed, andterminal=Falseas the default, a caller cannot distinguish "the reporter did not say" from "safe to retry", so a retry decision can go wrong in either direction. Suggest exposingdeliveryonTaskFailure(it is already on the record), or at least makingterminaltri-state / documenting thatFalseis not a retry hint. Also,maskedisFalsefor a failed/runeven though it has no usable sample, while the same fault reported by the environment ismasked=True; a caller counting masked rows misses these. Document it or derive it. -
[quality] Backward compatibility.
index.mdxandin_process.pypreviously promised additive-only changes with deprecation first (from #5593); this PR removesTaskResultandnum_repeatsand rewrites that promise as experimental. It is disclosed, and fine if #5593 has not shipped in a release (not verified), but please say so in the description. Stale text remains intests/unit_tests/test_public_api.py:83and:115("needs a deprecation first"). The refused-connection bound (2 tries, 60 s) is also a behaviour change forrun_task(it usedrun_examples, unbounded), but it is not in the "Behaviour change" list. -
[quality] Tests prove shape, not behaviour of the new retry path.
test_rollout_recovery.pyonly checks thatrun_outcomesforwards_max_num_triesand_connect_grace_s; nothing exercises the loop atrollout_collection.py:5252-5280(refused until grace ends givesnot_sent; connected then dropped givespossibly_delivered) throughrun_task. A small fake server or patchedserver_client.postraisingClientConnectorErrorwould cover it. -
[day-0] Docs are readable for a newcomer, but two things are missing. (a)
kindvalues are only described by example; link tonemo_gym/core/failure_kinds.pyas the vocabulary and say that<server>:<kind>kinds are an environment's own. (b)promptandoutputare JSON text ofresponses_create_params.inputandresponse.output; say they are None for environments that do not use that shape (native episode results), as the code does. Style: the long unwrapped lines inindex.mdx(the failed-/runparagraph and therawparagraph) and the oddly wrapped module docstring atin_process.py:29-33should be reflowed. -
[quality] Minor.
@experimentalonplan_benchmark,serve_benchmarkandTaskRunner.__init__prints a stderr warning on every call;run_task, the method that changed, does not warn. If the point is to mark the API, consider warning once per process. The__qualname__change inutils/decorators.pyis fine and affects only methods.
No internal or sensitive material seen in the diff; nothing here changes the training or evaluation reward path (run_examples is untouched).
TaskFailure exposes evaluation_side and delivery, and the docs say that domain is a layer, not a fault class, and that terminal is not a retry hint. A masked rollout keeps the reward the verifier returned and the docs tell a caller that computes scores to leave masked rollouts out. Tests send a refused and a dropped connection through run_outcomes. The in-process API warns once per process through experimental(once=True), which leaves the other experimental commands warning on every call. The docs, the pins and the module docstring are corrected and reflowed. Signed-off-by: Ingo Guehring <[email protected]>
|
@AdamRajfer thank you for the thorough review. All of it is in one commit,
Not run: the full suite, import-linter, a live exporter. |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42685852660 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42688313529 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42688402886 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42688677725 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42689113714 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42690948056 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42693496575 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42693956482 |
Gives the in-process API a typed outcome per rollout, so a caller outside Gym reads one stable shape instead of the raw keys of
/runresponses. A failed/runcomes back as an outcome too, instead of raising.What changed
run_taskruns one rollout per task (num_repeatsis gone) and returns itsRolloutOutcome:reward,failure,masked,prompt,outputandraw, Gym's/runresponse (left out ofreprand comparison).TaskResultis gone.rewardis None when none exists, as for a failed/run. A masked rollout keeps the reward the verifier returned;maskedsays it is not a valid measurement, and a caller that computes scores must leave it out.TaskFailurereports what Gym observed:kind,source,delivery,stage,terminal,reason,http_status,exception_type.domain(the layer) andevaluation_side(an evaluation fault, or the model's own outcome) are properties derived fromkind.kindis always set: the named cause, elseenvironment_server_failedoragent_request_failed.run_taskusesrun_outcomes, so a failed/runno longer raises.run_outcomestakesmax_num_triesandconnect_grace_s;run_taskpasses the bounds ofgym eval run(2 tries, 60 s).plan_benchmark,serve_benchmark,TaskRunnerandrun_taskcarry@experimental(a warning once per process), and the docs say the in-process API is experimental.Decisions
deliveryis the evidence for a retry decision;terminalis only the reporter's statement.deliveryis Gym's inference from the status and the connection evidence, not something the agent server reports.failurefollowsfailure_kind, as before: a result with a kind and a reward carries both.Behavior changes
run_taskno longer raises for a failed/run, and a refused connection is now resent for a minute (a dropped one twice) instead of for ever.num_repeatsis gone, andTaskResultis replaced byRolloutOutcome.Validation
tests/unit_tests/environment,test_public_api.py,rollouts/test_rollout_recovery.py(including the refused-connection and dropped-connection paths ofrun_outcomes),utilsandcore/test_failure_kinds.py: 1269 passed. One test,test_benchmarks.py::...test_every_repo_benchmark_appears_in_listing, fails here and on the base because it needs a host name this machine cannot resolve.ruffis clean.not_sentafter the grace. Not run: the full suite, import-linter.