Repository navigation
feat(data): support materialized task dataset metrics - #4060
Conversation
30d4f84 to
82702d9
Compare
82702d9 to
81c54b7
Compare
There was a problem hiding this comment.
Thanks for pulling this out of #3800.
One item blocks the merge: keep Number of examples in the metrics file (see the comment on model_dump_for_output).
Without it, gym env test can't validate UserSim's committed example data.
The other comments are smaller fixes:
- Remove the "native" terminology, which #4070 removed from the rest of the code.
- Load the hook once per server, under a module name that can't collide, and test its error branches.
- Cap the category metric.
- Add a test for the one routing change.
81c54b7 to
3e4c058
Compare
ananthsub
left a comment
There was a problem hiding this comment.
Thanks for the quick turnaround. I checked all five round-one fixes against the code, and they hold.
One new issue blocks the merge: the Number of examples fix also drops four metrics that 17 committed benchmark metrics files rely on (see the inline comment).
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
3e4c058 to
e9e2dab
Compare
ananthsub
left a comment
There was a problem hiding this comment.
Verified the fix against all 17 committed benchmark metrics files that record zeroed prompt metrics; collation no longer reports a conflict for any of them. LGTM.
|
/ok to test e9e2dab |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/37500561890 |
…to `r0.7.0` (#4115) beep boop [🤖]: Hi @ffrujeri 👋, we've cherry picked #4060 into for you! 🚀 Please review and approve this cherry pick by your convenience! Signed-off-by: Felipe Vieira Frujeri <[email protected]> Signed-off-by: NeMo Bot <[email protected]> Co-authored-by: Felipe Vieira Frujeri <[email protected]>
main with #4053 and #4060 merged, plus the simplified #3800 (UserSim's resources server, preparation, and simple_agent changes; no shared data code). #3801, #4080, and #3802 are left out until they are restacked onto the simplified #3800, because they still carry the previous #3800. This branch only previews that base for review of the task-schema stack. It is replaced by main once the UserSim stack merges. Signed-off-by: Ananth Subramaniam <[email protected]>
Integrate current main and use the production metrics serializer in the committed-statistics regression. Exclude taskset routing metadata, matching NVIDIA-NeMo#3818, and omit materialized-task-only statistics for Responses-style datasets, matching NVIDIA-NeMo#4060. Keep the existing fixture and full equality assertion intact. Signed-off-by: Yuhe Zhang <[email protected]>
## What changed and why Adds the paired NeMo User Sim runtime on the materialized `resolved_row` contract, tracked by NVIDIA-NeMo#985. - Adds `resources_servers/nemo_user_sim` for immutable-row validation, bounded verification, scorer classification, and conformant session cleanup. - Adds `environment_servers/nemo_user_sim`, which owns `ProbeEpisodeRuntime`, participant dispatch, tool simulation, embeddings, evidence capture, and cleanup. - Pins both servers to the same public UserSim revision: `a5f676bf6dc5a73914c8a0860f97c10dd2c214ee`. - Routes `nemo_user_sim:example` and `nemo_user_sim:validation` through `nemo_user_sim_environment`. - Uses the multi-agent environment bindings and materialized-row metrics already merged through NVIDIA-NeMo#4053 and NVIDIA-NeMo#4060. - Adds five synthetic example rows, matching metrics, and compact live rollout evidence so this PR passes changed-server data validation at its own head. - Adds Resources and Environment Server READMEs so both servers participate in the scheduled full suite. ## Review fixes - Assistant activation failures retain the prepared `trajectory_id` and are verified by the real Resources Server as unmasked reward zero. - UserSim contract rejection after an assistant activation is scored as a policy failure; Agent 404 and 409 responses remain retryable infrastructure failures. - Stable source `task_id` is accepted, and per-role overrides use `role_request_params` rather than the reserved `responses_create_params` row key. - Guarded health rows are rejected clearly at seed time for this pinned UserSim revision, while evaluator `reasoning_effort` is forwarded. - Resources session seed and close behavior passes Gym's session-conformance test, including idempotent seed/close and closed-session tombstones. - UserSim no longer forces global taskset routing mode. - Verifier evidence remains single-copy: invocations and the UserSim result are stored only at the top-level episode result. ## Validation - `uv run gym env test --resources-server nemo_user_sim` — 22 passed. - `resources_servers/nemo_user_sim/.venv/bin/pytest -q environment_servers/nemo_user_sim/tests` — 26 passed. - `uv run gym env resolve --config resources_servers/nemo_user_sim/configs/nemo_user_sim.yaml ...` — passed. - Scoped pre-commit, secret baseline validation, and `git diff --check` — passed. ## Rollout evidence Five live examples were generated with `meta/llama-3.2-11b-vision-instruct` as the user/policy model and `openai/gpt-oss-20b` as the judge/support model. All 5 completed with `mask_sample=false`; rewards were 0.8, 0.8667, 0.7333, 0.8, and 0.0. The committed rollout artifact is approximately 316 KiB and does not duplicate verifier evidence. ## Compatibility and benchmark impact This is a new pre-release runtime. Integration paths, component names, and tasksets use `nemo_user_sim`; upstream package imports and UserSim-owned data fields retain `usersim`. Infrastructure failures remain retryable and masked, while assistant-caused invalid responses are measured as unmasked reward zero. --------- Signed-off-by: Felipe Vieira Frujeri <[email protected]>
size. Any other row without a valid responses_create_params, such as a task row for an environment server with its own input in a dataset that does not declare taskset:, was still marked offending, so its dataset's metrics sidecar reported zero examples and drift went undetected. Every JSON object row is now an example, and require_responses is gone. Run request rows keep their Responses API metrics and their sidecars keep the same keys. Other rows report their size through #4060's task-input size metric, so a change inside nested task fields is a metrics conflict, and datasets have one size metric instead of two. Schema validation, not metrics, decides whether a row is valid for its environment server. Signed-off-by: Ananth Subramaniam <[email protected]>
What changed
Teach dataset validation to recognize materialized task rows with
task_idandtask_input, report example/task counts and taskset distributions, and optionally load a dependency-lightcompute_task_metrics(task_input)hook from the owning server directory.The hook loader validates the owner export, caches one hook per server, uses collision-safe module names that include the server type, and translates import failures into actionable dataset-validation errors. Categorical output is bounded to 100 labels plus an
Otherbucket. Malformed materialized rows retain taskset routing and fail validation instead of falling through to the legacy run-request path.Generic unit fixtures and direct loader tests keep this change independent of UserSim;
environments/usersim/**and its metric implementation remain in #3800.Why
Materialized Environment Server datasets do not necessarily use
responses_create_params, so existing collation metrics cannot describe their task identity or environment-owned input fields. This generic support is extracted from #3800 rather than being owned by one benchmark.No separate issue is necessary; this was identified while integrating #3800.
Validation
uv run --extra dev pytest tests/unit_tests/test_dataset_metrics.py tests/unit_tests/test_train_data_utils.py tests/unit_tests/test_episode_types.py -q(62 passed)uv run --extra dev pytest tests/unit_tests/test_task_data.py -q(passed)uv run --extra dev pytest tests/unit_tests/test_rollout_collection.py::TestEnvironmentServerRouting -q(33 passed)uv run pre-commit run --from-ref origin/main --to-ref HEAD(passed)git diff --check origin/main(passed)Rollout evidence
N/A: this changes offline dataset validation and metric aggregation, not model, agent, or verifier execution.
Compatibility
Responses-style datasets retain their existing metrics. Every row continues to count toward
Number of examples; the four existing response metric keys remain present for compatibility even when their values are zero. Materialized task datasets additionally report task/taskset metrics and may add owner-defined metrics, so regenerated metric sidecars can contain additional fields. Environments withoutdataset_metrics.pyrequire no migration.