Skip to content

feat(data): support materialized task dataset metrics - #4060

Merged
ffrujeri merged 1 commit into
mainfrom
ffrujeri/native-task-dataset-metrics
Oct 6, 2026
Merged

ffrujeri merged 1 commit into
mainfrom
ffrujeri/native-task-dataset-metrics

Conversation

@ffrujeri

@ffrujeri ffrujeri commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

What changed

Teach dataset validation to recognize materialized task rows with task_id and task_input, report example/task counts and taskset distributions, and optionally load a dependency-light compute_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 Other bucket. 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 without dataset_metrics.py require no migration.

@copy-pr-bot

copy-pr-bot Bot commented Oct 5, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@ffrujeri
ffrujeri force-pushed the ffrujeri/native-task-dataset-metrics branch from 30d4f84 to 82702d9 Compare October 5, 2026 18:40
@ffrujeri ffrujeri added the r0.7.0 Auto-cherrypick to release branch. Apply before merge; cherrypick happens after merge. label Oct 5, 2026
@yaoyu-33 yaoyu-33 added area:data Datasets, preparation, task formats, and materialization complexity:medium Single-domain change with interacting parts or a moderate review surface feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer labels Oct 5, 2026
@ffrujeri
ffrujeri force-pushed the ffrujeri/native-task-dataset-metrics branch from 82702d9 to 81c54b7 Compare October 5, 2026 23:40

@ananthsub ananthsub left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread nemo_gym/train_data_utils.py Resolved
Comment thread nemo_gym/train_data_utils.py Resolved
Comment thread nemo_gym/dataset_metrics.py Resolved
Comment thread nemo_gym/train_data_utils.py Resolved
Comment thread nemo_gym/episode_types.py Resolved
@ffrujeri
ffrujeri force-pushed the ffrujeri/native-task-dataset-metrics branch from 81c54b7 to 3e4c058 Compare October 6, 2026 16:18
@ffrujeri ffrujeri changed the title feat(data): support native task dataset metrics feat(data): support materialized task dataset metrics Oct 6, 2026
@ffrujeri
ffrujeri requested a review from ananthsub October 6, 2026 16:26

@ananthsub ananthsub left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Comment thread nemo_gym/train_data_utils.py Resolved
@ffrujeri
ffrujeri force-pushed the ffrujeri/native-task-dataset-metrics branch from 3e4c058 to e9e2dab Compare October 6, 2026 16:32
@ffrujeri
ffrujeri requested a review from ananthsub October 6, 2026 16:34

@ananthsub ananthsub left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ffrujeri
ffrujeri enabled auto-merge October 6, 2026 16:40
@ananthsub

Copy link
Copy Markdown
Contributor

/ok to test e9e2dab

@ffrujeri
ffrujeri added this pull request to the merge queue Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/37500561890

Merged via the queue into main with commit d6d7685 Oct 6, 2026
43 checks passed
@ffrujeri
ffrujeri deleted the ffrujeri/native-task-dataset-metrics branch October 6, 2026 17:17
ananthsub pushed a commit that referenced this pull request Oct 6, 2026
…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]>
ananthsub added a commit that referenced this pull request Oct 6, 2026
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]>
yuhezhang-ai added a commit to katherineh123/Gym that referenced this pull request Oct 6, 2026
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]>
khazic pushed a commit to khazic/Gym-lao that referenced this pull request Oct 7, 2026
## 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]>
ananthsub added a commit that referenced this pull request Oct 7, 2026
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]>

This branch was previously deployed

1 inactive deployment
public — e9e2dab1 Deployed Oct 6, 2026 by copy-pr-bot[bot] via release / finalize / notify #4438
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:data Datasets, preparation, task formats, and materialization complexity:medium Single-domain change with interacting parts or a moderate review surface feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer r0.7.0 Auto-cherrypick to release branch. Apply before merge; cherrypick happens after merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants