Repository navigation
feat(eval): reverify Relay ATIF trajectories - #2737
Merged
Merged
Conversation
2 tasks
afourniernv
marked this pull request as draft
August 25, 2026 12:34
Signed-off-by: Alex Fournier <[email protected]>
Signed-off-by: Alex Fournier <[email protected]>
Signed-off-by: Alex Fournier <[email protected]>
afourniernv
force-pushed
the
feat/relay-atif-reverify
branch
from
August 25, 2026 15:01
4fedb7b to
fc653c7
Compare
Signed-off-by: Alex Fournier <[email protected]>
afourniernv
marked this pull request as ready for review
August 25, 2026 15:50
Signed-off-by: Alex Fournier <[email protected]>
Signed-off-by: Alex Fournier <[email protected]>
3 tasks done
Signed-off-by: Alex Fournier <[email protected]>
Contributor
|
🌿 Preview your docs: https://nvidia-preview-feat-relay-atif-reverify.docs.buildwithfern.com/nemo/gym Here are the markdown pages you've updated: |
Signed-off-by: Alex Fournier <[email protected]>
Signed-off-by: Alex Fournier <[email protected]>
Signed-off-by: Alex Fournier <[email protected]>
Signed-off-by: Alex Fournier <[email protected]>
Signed-off-by: Alex Fournier <[email protected]>
Signed-off-by: Alex Fournier <[email protected]>
Signed-off-by: Alex Fournier <[email protected]>
Signed-off-by: Alex Fournier <[email protected]>
Signed-off-by: Alex Fournier <[email protected]> # Conflicts: # nemo_gym/rollout_reverification.py
Signed-off-by: Alex Fournier <[email protected]>
Signed-off-by: Alex Fournier <[email protected]>
Contributor
|
/ok to test 5cc7229 |
Signed-off-by: Alex Fournier <[email protected]>
Contributor
|
/ok to test 55e7aa2 |
Contributor
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/35321900588 |
5 tasks done
pull Bot
pushed a commit
to Stars1233/Gym
that referenced
this pull request
Sep 21, 2026
## What does this PR do? Adds a strict offline exporter from completed Gym `ng_trajectory` v1.0 rollouts to ATIF v1.7. It writes one ATIF file per rollout plus a SHA-256-pinned manifest that Gym's ATIF reverification path can consume. Together, NVIDIA-NeMo#2737 and NVIDIA-NeMo#2767 establish a file-based interoperability path between NeMo Relay and NeMo Gym. Relay-exported ATIF trajectories can be evaluated in Gym, while Gym-native trajectories can be exported to the same ATIF format for downstream consumers. This does not couple the Relay and Gym runtimes or add Relay as a Gym dependency. This is PR 2 of a two-PR sequence. NVIDIA-NeMo#2737 owns ATIF ingress and the shared ATIF schema/JSON boundary; this PR owns Gym-to-ATIF egress. Related to NVIDIA-NeMo#2468. ## Before Gym could store normalized rollout trajectories but could not export them in a portable trajectory format. ## After ```bash gym eval export \ --format atif \ --rollouts results/rollouts.jsonl \ --output-dir results/atif \ --session-id eval-2026-08-25 \ --agent-version 1.2.3 ``` The exporter maps Gym's normalized trajectory, not provider-native payloads. Raw provider request and response copies are retained opaquely in ATIF extension metadata; they are never parsed to fill gaps in the normalized record. ## Initial contract Supported: - one completed root invocation and one initial system/user phase; - exactly one captured model call per agent turn; - text, reasoning, generic function calls, and correlated text results; - normalized turn/model/token/timing/status evidence; and - task/rollout identity plus a hash-pinned manifest. Rejected rather than guessed or dropped: - evidence gaps, subagents, later user/system turns, and multimodal content; - incomplete, failed, or ambiguously correlated model/tool calls; - unsupported Responses item families or namespaced calls; - training token IDs, log probabilities, and routed-expert metadata; and - non-standard JSON. The exporter writes each known per-step usage field without inventing missing values. `reasoning_tokens` and `total_tokens` use the same step-level ATIF extension shape as Relay. A final prompt-, completion-, or cached-token aggregate is emitted only when every captured model call reports that field; an unavailable value is never counted as zero. An export with partial usage can therefore be valid ATIF for another consumer while remaining ineligible for Gym's strict reverify path. Gym reverify requires complete per-step prompt/completion counts whenever supported usage exists because one verifier request cannot represent partial standard usage. This asymmetry is deliberate. The exported `extra.nemo_gym.conversion.status=complete` means every field present in the supported normalized `ng_trajectory` profile was represented without guessing. It does not certify opaque provider request or response copies retained as provenance. ## Out of scope No ATOF parsing, Relay/NAT dependency, live instrumentation, provider-payload reconstruction, or best-effort export of unsupported structural or content fields is included. Preserving known step-level usage while omitting an unprovable aggregate is exact representation, not best-effort conversion. ## Review order This is the egress follow-on to merged PR NVIDIA-NeMo#2737. Current `main` is merged into this branch, `atif_v1_7.py` has left the diff, and `atif_json.py` retains only the small strict JSON equality helper used by the exporter. The exporter test now exercises the combined egress-to-ingress path through NVIDIA-NeMo#2737's manifest loader and reverify projection. | Review area | Files | What to verify | | --- | --- | --- | | Export contract | `nemo_gym/atif_export.py` | Exact normalized-trajectory mapping, rejection boundaries, batch atomicity, and manifest hashes | | Shared boundary delta | `nemo_gym/atif_json.py` | Strict JSON equality used by export validation | | Wiring | `nemo_gym/cli/eval.py`, `nemo_gym/cli/main.py`, docs | One-command offline export and documented scope | | Evidence | `tests/unit_tests/test_atif_export.py`, CLI tests | Contract, failure, hash, and round-trip coverage | Suggested pass: review the exporter first, then its small shared-boundary delta and wiring. The test file is intentionally large because unsupported shapes fail closed. ## Validation - Focused exporter, rollout-reverification, and CLI suites: **609 passed**. - Repository-wide pre-commit and `git diff --check`: passed. - Combined local core+sandbox coverage: **95.08%**, above the 95% gate. - The exact cross-PR test exports two Gym trajectories, loads the generated manifest through NVIDIA-NeMo#2737's loader, and runs the real reverify projection while checking identity, usage, tool correlation, reasoning, and final output. - Manifest SHA verification succeeded, tampering was rejected, parallel tool results were correlated by call ID rather than arrival order, usage survived, and native versus round-tripped MCQA verification both returned reward `1.0`. The complete trusted Linux matrix remains pending on the exact pushed head. A local Enroot cleanup test is Linux-specific and cannot run on macOS because `/proc` is absent. The earlier Codex → Relay → ATIF → Gym live qualification remains evidence for NVIDIA-NeMo#2737; this offline exporter PR does not claim another provider run. ## Checklist - [x] I have read the contributing guidelines. - [x] Tests were added and pass locally. - [x] Commits have DCO sign-off. --------- Signed-off-by: Alex Fournier <[email protected]>
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds a bounded ATIF v1.7 input path to
gym eval reverify, allowing completed Relay trajectories to be scored by Gym's existing stateless verifier flow without rerunning the agent or policy model.Together, #2737 and #2767 establish a file-based interoperability path between NeMo Relay and NeMo Gym. Relay-exported ATIF trajectories can be evaluated in Gym, while Gym-native trajectories can be exported to the same ATIF format for downstream consumers. This does not couple the Relay and Gym runtimes or add Relay as a Gym dependency.
Relates to #2468.
Before
gym eval reverifyonly accepted native Gym rollout JSONL.ATIF contains the external agent trajectory, but not the Gym task, expected answer, verifier configuration, or resources-server routing needed to calculate a reward.
After
gym eval reverify \ --input-format atif \ --config my_resources_server.yaml \ --inputs materialized-inputs.jsonl \ --atif-manifest relay-trajectories.jsonl \ --output rewards.jsonlThe inputs have separate responsibilities:
(_ng_task_index, _ng_rollout_index)and may pin its SHA-256.Gym projects the supported ATIF output into its existing Responses-shaped verifier payload, calls the normal stateless
/verifypath, and computes aggregate metrics.Integration contract
Gym consumes the canonical ATIF fields needed to build that bounded scoring payload. It does not reconstruct provider-native payloads stored in optional
extrametadata; the ATIF producer owns that conversion.projection_status=completemeans Gym constructed the supported verifier payload without guessing or dropping a field the adapter maps. It does not claim full-document ATIF fidelity, certify the producer's provider-to-ATIF conversion, or interpret arbitrary producer metadata. Persisted source and trajectory hashes retain that provenance.Supported in this initial path:
reasoning_content;Standard usage is strict. If any model step reports supported usage, every model-backed step must provide
prompt_tokensandcompletion_tokens, andfinal_metricsmust provide matching totals. Optional cached, reasoning, and reported-total details are projected only when their aggregate can be proven. Partially reported optional details remain unknown rather than being counted as zero. Equivalent Relay reasoning-token aliases are normalized, conflicting aliases are rejected, and cost metadata remains provenance rather than verifier input.The path fails closed on shapes that cannot be mapped without changing what the verifier scores, including:
Optional producer-specific status or provider payloads in
extrado not change the canonical projection. A trajectory may end after a tool call when every call has a correlated observation result.Tool-bearing ATIF is rejected when routed to a resources server with
expose_tools_over_mcp: true. ATIF proves generic call/result correlation, but does not carry Gym's canonical MCP(server_name, tool_name)identity.ATIF mode requires the verifiers selected by the batch to be stateless and does not support
--force,--resume,--judge-failed-only, or--append.Native Gym reverification remains the default. This adds no Relay, NeMo Agent Toolkit, or Harbor runtime dependency.
Suggested review order
Most of the added lines are qualification tests and fixtures. The maintainer-facing behavior is concentrated in these areas:
nemo_gym/atif_v1_7.py,nemo_gym/atif_json.pynemo_gym/atif_reverification.pynemo_gym/rollout_reverification.pySuggested pass: review the boundary first, then projection, then the small Gym integration. The remaining files document and prove that contract.
Validation
git diff --check: passed.function_call → function_call_output → message, and returned reward1.0with aggregate accuracy100%.The broader local unit run reported the same five failures in both ATIF worktrees, all outside the affected paths: sandbox port binding, existing
aime24metadata, macOS/procbehavior, system Python missingaiohttp, and sandbox semaphore permissions. The affected suites pass.Related work
Checklist