Repository navigation
feat(rollout): expose per-rollout enrichment to run_examples callers - #5318
marcromeyn wants to merge 1 commit into
Conversation
|
/ok to test 5bede50 |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP — one documentation NOTE; no confirmed runtime defects found.
Reviewed both changed files and the affected capture, trajectory, episode-identity, and completion/drain contracts. The capture-safety topic was independently inspected because its delegated report was unavailable. This was a static, read-only review; tests were not executed.
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.
| Connections that were never established can still be retried safely. | ||
| It does not convert failures to successful result rows. | ||
|
|
||
| ``enrich_results`` runs :func:`enrich_run_result` on each result before it is returned, so the caller receives |
There was a problem hiding this comment.
NOTE — Suggest documenting the framework enrichment workflow in the user guide.
The new public option is explained here, but the rollout-evidence guide and capture guide do not show how framework callers obtain these attachments through run_examples. This is the PR's principal user-facing feature, for which the review rubric calls for user documentation.
Correction: add a short section to the rollout-evidence guide, after “Enable Collection,” showing shared capture configuration and this usage with prepared rows:
from nemo_gym.rollout_collection import RolloutCollectionHelper
helper = RolloutCollectionHelper()
rows = helper.preprocess_examples(examples)
completions = helper.run_examples(rows, enrich_results=True)
try:
for completion in completions:
row, result = await completion
# Consume the enriched result here.
finally:
await completions.aclose()Explain that the caller must be able to read the deployment's capture directory and that enrichment returns evidence in memory, not run-folder records. This is a proposed documentation example, not executed code; please verify it before adopting it.
Preserve: distinguish raw default-off replies from enriched replies; metadata-only capture from retained bodies; and optional deletion from unconditional cleanup (deletion requires retained payloads, drained writes, and complete readback). Do not imply that enrichment rebuilds training-token responses or changes rewards.
Acceptance: verify the rendered example and links. Against a capture-enabled deployment, the documented enriched call should return ng_model_call_capture and, for a named task with usable evidence, ng_trajectory; document that omitting enrich_results=True returns the raw reply.
5bede50 to
674a8f9
Compare
|
/ok to test 674a8f9 |
run_examples returns the raw /run result, so a training framework that dispatches through it (NeMo RL) never gets what ng_collect_rollouts records for each rollout: the model server's captured calls, the normalized ng_trajectory and ng_perf. enrich_run_result runs the collector's per-rollout steps in place: wait for capture quiescence, merge the captured model calls, project ng_trajectory and assemble ng_perf. ng_collect_rollouts now calls it, so there is one implementation and no behavior change there. run_examples gains an opt-in enrich_results (with include_model_call_payloads and delete_model_call_capture); with it off, results are exactly what /run returned. A row that never started is not joined to calls; an interrupted try keeps the calls it made. A row that names no task gets no ng_trajectory rather than a guessed task id, and deleting the capture without keeping payloads is refused. Co-authored-by: Pranav Thombre <[email protected]> Signed-off-by: Marc Romeyn <[email protected]>
674a8f9 to
7b9ed8d
Compare
|
/ok to test 7b9ed8d |
AdamRajfer
left a comment
There was a problem hiding this comment.
All of this is carried in #5443 with your authorship: enrich_run_result and the enrich_results, include_model_call_payloads and delete_model_call_capture options on run_examples. The one real change in the port to main is that with enrich_results the rows now go through collection's own outcome builder, so under route_failures_to_sidecar a failed /run comes back as the typed RolloutFailureRecord instead of an enriched raw error; rows without a rollout identity keep the plain dispatch. #5443 is in the merge queue now, and once it lands nothing remains here, so this one can be closed.
|
Carried into #5443 (merged), rebased onto the failure stack with authorship kept; closing this one. |
What and why
run_examplesreturns the raw/runresult, so a training framework that dispatches through it (NeMo RL) never gets whatng_collect_rolloutsrecords for each rollout: the model server's captured calls, the normalizedng_trajectoryandng_perf. RL works around that today by dumping Gym state itself (NVIDIA-NeMo/RL#4890). This takes over #5023 (Pranav Thombre, co-author) on currentmain.enrich_run_result(row, result, *, capture_dirs, observability_enabled, include_payloads=True, rollout_latency_ms=None, delete_capture=False)runs the collector's per-rollout steps in place: copy the row's rollout identity onto the result where it is missing, wait for the rollout's in-flight capture writes, merge its captured model calls, projectng_trajectoryand assembleng_perf.ng_collect_rolloutsnow calls it, so there is one implementation and no behavior change there.run_examples(..., enrich_results=False, include_model_call_payloads=True, delete_model_call_capture=False): an opt-in to enrich each result before it is returned, including results recovered byaclose_and_drain(). With it off, results are exactly what/runreturned.Rules carried over from the collector and the run-record work:
ng_trajectoryrather than a guessed task id. An explicit task id no longer needs a task index.delete_model_call_captureremoves a rollout's capture file only when its writes drained, the readback was complete and the bodies were kept; it is refused withinclude_model_call_payloads=False.Not in this PR: Claude Code turns built from captured Anthropic calls (part of #5023, to follow separately), and Gym writing these records and failure rows to the run folder in the RL path (FEP-1907, next).
Validation
telemetryextra:pytest tests/unit_tests/test_rollout_collection.py tests/unit_tests/test_fern_docs_links.py: 638 passed.run_examplesopt-in.pre-commiton the changed files.Rollout evidence
gym env start --resources-server example_single_tool_call --model-type openai_model ++observability_enabled=true ++model_call_capture_dir=...withgpt-6-luna, thenRolloutCollectionHelper().run_examples(rows, enrich_results=...)on two example rows: without the option, the results were the raw/runreplies; with it, each came back with its rollout id, its captured model calls,ng_trajectoryandng_perf. Not run: an Environment Server pairing throughrun_examples.Compatibility
Opt-in only;
ng_collect_rolloutsoutput is unchanged. Withenrich_results,run_examplesfetches the global config once more per call to find the capture directories.Linear: FEP-1907 (part of FEP-1829 / GYM-1170). Supersedes #5023.