Skip to content

feat(capture): select which model calls to capture by server and rollout group - #6552

Merged
yfw merged 5 commits into
mainfrom
sync/model-call-capture-selection
Nov 30, 2026
Merged

yfw merged 5 commits into
mainfrom
sync/model-call-capture-selection

Conversation

@yaoyu-33

@yaoyu-33 yaoyu-33 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

What

Three opt-in settings choose which model calls the evaluation capture store records. The defaults still record every call.

flowchart LR
  C["rollout-prefixed<br/>model call"] --> S{"server in<br/>model_call_capture_servers?"}
  S -- no --> X["serve the call,<br/>skip evaluation record"]
  S -- yes --> G{"rollout sampled?<br/>crc32 of logical rollout ID mod N is 0"}
  G -- no --> X
  G -- yes --> D{"free space at least<br/>model_call_capture_min_free_gib?"}
  D -- no --> I["serve the call,<br/>mark capture incomplete if possible"]
  D -- yes --> R[("capture store<br/>record with caller when known")]
  classDef new fill:#fff3b0,stroke:#b59f00,color:#000
  class S,G,D new
Loading
Setting Default Effect
model_call_capture_servers every server Only listed model servers record. A startup warning identifies names missing from the local model-server configuration
model_call_capture_sample_every 1 Records about one rollout in every N, including its Gym retries
model_call_capture_min_free_gib 0 (off) Pauses recording while the disk is below the floor and resumes when space returns. Checked at most every 30 s

Why

With capture on, a long training run records every policy and judge call and can fill the run's filesystem. These settings keep only the calls the run needs and stop recording before the disk fills.

How

Gym hashes the logical rollout ID on each attempt. For example, 12-0 and 12-0-a1 share a decision, while foo-a0 keeps its literal suffix. NeMo RL supplies a separate rollout ID for each generation, so siblings are sampled independently.

Rollout-attributed generation calls through ServerClient name their caller, including calls that already carry a rollout or training-token prefix. A shared judge can record which environment called it.

sequenceDiagram
  participant E as resources server env_a
  participant J as judge model server
  participant S as capture store
  E->>J: model call with x-ng-caller-server env_a
  J->>S: raw record with caller_server env_a
Loading

The model-call capture docs cover the three settings and caller_server.

Compatibility

  • Defaults are unchanged. Raw records can include the optional caller_server key. The ModelCallRecord schema stays the same.
  • Rollout-record attachment, rollout health checks, and agent-timeout retries on resume depend on recorded calls. Keep full capture for evaluations. Training token capture continues when evaluation capture skips a call.

No separate issue was filed for this opt-in capture change.

Validation

  • 460 tests passed across the client, model-call and token capture, rollout correlation, sampling, and agent-timeout recovery. Of the new regression cases, 11 failed on the previous PR head.
  • pre-commit run --all-files passed.
  • python3 tests/unit_tests/test_fern_docs_links.py passed all 30 checks. npm run check in fern/ found zero errors. Fern skipped its authenticated redirect check.
Targeted pytest command
python -m pytest -q \
  tests/unit_tests/client/test_server_client_caller_server.py \
  tests/unit_tests/client/test_server_client.py \
  tests/unit_tests/core/test_model_call_sampling.py \
  tests/unit_tests/models/test_model_call_capture_selection.py \
  tests/unit_tests/models/test_token_capture.py \
  tests/unit_tests/server_runtime/test_rollout_correlation.py \
  tests/unit_tests/server_runtime/test_model_sampling.py \
  tests/unit_tests/rollouts/test_model_calls.py \
  tests/unit_tests/rollouts/test_streamed_capture_reports.py \
  tests/unit_tests/eval/recovery/test_recovery_infra_agent_timeout.py

Model rollout evidence is N/A for this change to capture metadata and storage. The middleware tests exercise the conversational judge request through to its stored record.

🤖 Generated with Claude Code

Allow named model servers to record whole rollout groups and pause evaluation recording at a configurable free-space floor. Retain the caller server on attributed calls while keeping token capture independent.

Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33 yaoyu-33 added the internal_sync Public PR created by internal-to-public sync automation label Nov 20, 2026
@copy-pr-bot

copy-pr-bot Bot commented Nov 20, 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.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added risk:high Autobot PR risk: high feature New capabilities, enhancements, or enablement work area:model Model servers, inference providers, and model adapters labels Nov 20, 2026
yaoyu-33 and others added 2 commits November 23, 2026 14:46
…election

The sampling group dropped the `-a<n>` attempt suffix only after a NeMo RL
`_g<i>` sibling suffix, so a re-dispatched attempt of a rollout-collection key
(`<task>-<rollout>-a<n>`) was sampled apart from its first attempt. Drop the
attempt suffix from any key; NeMo RL keys keep the same groups.

Document `model_call_capture_servers`, `model_call_capture_sample_every`,
`model_call_capture_min_free_gib` and the raw record's `caller_server` field
on the model-call capture page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33 yaoyu-33 changed the title Select which model calls to capture by server and rollout group feat(capture): select which model calls to capture by server and rollout group Nov 23, 2026
@yaoyu-33

Copy link
Copy Markdown
Contributor Author

/ok to test 40c9dd1

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

@yaoyu-33
yaoyu-33 marked this pull request as ready for review November 23, 2026 23:09

@svcnvidia-nemo-ci svcnvidia-nemo-ci 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.

SHIP WITH CARE — two RISK findings affect capture attribution and retry-consistent sampling.

Reviewed all six changed files, trusted-base AGENTS.md, surrounding implementations, consumers, tests, and existing feedback. There are no prior submitted reviews or inline comments.

CI at 40c9dd11: Unit tests / Test, Unit tests / Server suite, and Lint check passed. The non-blocking mini-SWE harness conformance check failed; its log reports invalid scenario evidence and missing saved model calls. I have not attributed that failure to this change.

Focused probes ran against the admitted head with Python 3.13.14 in 766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:main-offline, not the exact CI runtime. They reproduced both findings below. Nine additional JSON/SSE/exception cases preserved training-token capture and context cleanup when evaluation capture was selected out. A filesystem-check error preserved the model response, and Hydra configuration parsing accepted the new settings. No repository CI suites were rerun.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

Comment thread nemo_gym/client/server_client.py Resolved
Comment thread nemo_gym/models/model_call_capture.py Resolved
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the needs-review PR is ready for code review and waiting on a reviewer label Nov 24, 2026

@yfw yfw 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.

SHIP WITH CARE. The defaults, the server list and training token capture work as described. Each new setting has one gap, with a fix in the comments:

Thank you for this feature. With the defaults, records at base and head match for JSON, streamed, failed and chat calls, apart from the new caller_server. A call that the store leaves out keeps its training token capture. The PR also comes with a docs section and focused tests.

DCO sign-off is on all commits. CI at this head passes the unit tests, the server suite and lint. The non-blocking "Harness conformance / miniswe_sandboxed" job failed with the same message as main's scheduled run at 8bb7fc1 (run). GitHub shows the PR as mergeable, and it waits for an approval.

NeMo RL main does not read the capture store today, so none of these findings changes NeMo RL training data. A trial merge with the open #6235, which also edits model_call_capture.py, shows no conflict.

Generated by Claude Code

Comment thread nemo_gym/models/model_call_capture.py Resolved
Comment thread nemo_gym/models/model_call_capture.py Resolved
Comment thread nemo_gym/models/model_call_capture.py Resolved
Comment thread nemo_gym/client/server_client.py Resolved
yfw
yfw previously approved these changes Nov 25, 2026
@yfw

yfw commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

/ok to test 555d3a0

@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 25, 2026 01:17
@yfw

yfw commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

/ok to test 0b9edb2

@yfw
yfw enabled auto-merge November 30, 2026 22:36
@yfw
yfw added this pull request to the merge queue Nov 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

Merged via the queue into main with commit 3c4938e Nov 30, 2026
79 of 82 checks passed
@yfw
yfw deleted the sync/model-call-capture-selection branch November 30, 2026 23:12
wprazuch added a commit that referenced this pull request Dec 1, 2026
Resolve the conflict with #6552 in model_call_capture.py: the claims-file
claim now runs on the gated per-call store, and both write paths pass
caller_server to _record, which still releases the claim itself.

Signed-off-by: Wojciech Prazuch <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:model Model servers, inference providers, and model adapters feature New capabilities, enhancements, or enablement work internal_sync Public PR created by internal-to-public sync automation needs-review PR is ready for code review and waiting on a reviewer risk:high Autobot PR risk: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants