Repository navigation
feat(sc): dump Gym results with train data, and log every Gym result separately - #4855
ZhiyuLi-Nvidia wants to merge 4 commits into
Conversation
9253fc4 to
714adcd
Compare
With async_rl.log_full_train_data on a NeMo-Gym run, every row of train_data_step<N>.jsonl now carries gym_full_result: the rollout's whole Gym result (reward, verifier fields, final response). The result rides the row RL already writes to TransferQueue, as one more object column (not a tag: tags ride every metadata RPC). Both row builders fill it: RewardLogContext.full_result_json on the token-capture path, Completion.env_extras otherwise. The advantage stage fetches it only while dumping, and TrainDataDump.add_chunk decodes and writes it per row. full_result_json now keeps Gym's raw reward; the W&B result table still overwrites it with the final reward. Also fix AdvantageStageConfig reading logger["log_dir"] off LoggerConfig, which crashed every log_full_train_data run at startup. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Zhiyu Li <[email protected]>
714adcd to
9007ead
Compare
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
Review #4855
The object-column approach keeps large results out of row tags, and the logger-model access fix is consistent with the configured logger type.
Two correctness issues remain: capture-off dumps do not preserve the original Gym result, and enabling dumps when restoring existing replay rows causes a missing-column failure. Inline suggestions also cover schema warm-up and placeholder documentation.
Validation: inspected all 18 changed files and traced the affected producer, replay-restore, transport, advantage, and dump paths. This was a single-reviewer static review; tests and linters 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.
| train_data[MALFORMED_THINKING_MASK] = flat[MALFORMED_THINKING_MASK] | ||
| if include_gym_full_result: | ||
| train_data[GYM_FULL_RESULT_FIELD] = np.array( | ||
| [json.dumps(c.env_extras, separators=(",", ":")) for c in completions], |
There was a problem hiding this comment.
1 action item — please fix in this PR.
TL;DR — capture-off dumps serialize modified completion extras, so the purported original Gym reward and verifier flags can be wrong.
AI-1 — Preserve the original result separately
BUG · PR-introduced · confidence: 98. With capture disabled, a Gym result with reward 1.0 and generated token 2, combined with the unwanted-token penalty for [2], has its reward changed to 0.0 in place before completion construction. The new serializer therefore records 0.0 inside the Gym result too. Effort shaping also modifies that reward earlier, and disabling environment masking removes both original mask flags from completion extras. These transformations are correct for training, but not for the promised whole Gym result.
Action: snapshot the result before shaping or mask filtering and carry that immutable JSON separately. One minimal implementation is the following coordinated edit; it is source-traced, not executed, and should be verified before adoption:
# Append to Completion in experience/interfaces.py:
gym_full_result_json: Optional[str] = None
# In AsyncNemoGymRolloutImpl._stream_rows, before the receipt branch:
if self._dump_gym_results and "receipt" not in result:
result["gym_full_result_json"] = json.dumps(
result["full_result"], separators=(",", ":")
)
# Add to the non-receipt Completion constructor in _results_to_completions:
gym_full_result_json=result.get("gym_full_result_json"),
# Replace the list expression at payload.py:194:
[c.gym_full_result_json or "null" for c in completions],Targets: the existing completion container, pre-shaping stream branch, and echo completion constructor. Keep the receipt/finalizer path using its existing raw-result context.
Preservation / acceptance — proposed checks, not run: stream an echo result with reward 1.0, assistant token 2, and both mask flags set; enable the unwanted-token penalty and disable environment masking. After packing and dumping, expect training reward 0.0, no applied environment mask, but dumped Gym reward 1.0 and both original flags retained. Repeat with masking enabled and verify it still masks training. Exercise effort shaping and verify only the training reward changes. Retain the capture-on raw-reward assertion in the streamed-receipt test, the table's final reward 0.25 assertion in the reward-table regression, and omission of the object column when dumping is disabled.
There was a problem hiding this comment.
This will be covered in #4890 (stacked on this PR): it removes the gym_full_result TQ column this comment is about. The full Gym result is logged instead from the NemoGym actor to <log_dir>/gym_results/gym_results.<pid>.jsonl, and RL's decisions go to rl_outcomes.<pid>.jsonl; the two join on rollout_id.
| INPUT_LENGTHS, | ||
| adv_cfg.prompt_ids_field, | ||
| adv_cfg.generation_logprobs_field, | ||
| *self.dump_object_fields, |
There was a problem hiding this comment.
1 action item — please fix in this PR.
TL;DR — enabling dumps on resume requests a result column that restored replay rows never wrote, aborting the first consuming step.
AI-1 — Migrate restored rows before requiring the new column
BUG · PR-introduced · confidence: 96. Minimal trigger: save a Gym run with dumping disabled and at least one buffered replay group, then resume the same checkpoint with dumping enabled and replay restoration retained. The producer omits the column while disabled, but replay restoration accepts the saved groups unchanged. The new fetch list then requires the absent column for those rows; the adapter raises a missing-column KeyError. Schema warm-up alone cannot populate historical rows.
Action: add a restore migration before the pumps start, alongside replay restoration. For restored groups whose saved metadata lacks the result column, write the JSON string "null" to that column and update their live metadata. The raw result cannot be reconstructed when it was never retained. Preserve existing result payloads, and keep missing-column errors for newly produced rows rather than broadly suppressing fetch failures. The exact backend-safe restored-schema migration is not verified here, so this is an invariant handoff rather than a suggested implementation patch.
Preservation / acceptance — proposed checks, not run: checkpoint one buffered group with dumping off, restore with dumping on, consume it, and expect a completed dump with [null] for that historical result rather than an exception. A newly generated group after that restore must contain its actual result. Also check on→on restore preserves the existing JSON, off→off does not fetch the column, and non-Gym dumps remain unchanged. This needs to hold on both supported checkpoint backends. For the static check, ensure the migration finishes before either pump is launched.
There was a problem hiding this comment.
This will be covered in #4890 (stacked on this PR): it removes the gym_full_result TQ column this comment is about. The full Gym result is logged instead from the NemoGym actor to <log_dir>/gym_results/gym_results.<pid>.jsonl, and RL's decisions go to rl_outcomes.<pid>.jsonl; the two join on rollout_id. Restored replay rows no longer need a column they never wrote.
| staging_partition_id=( | ||
| token_capture_cfg.staging_partition if token_capture_cfg.enabled else None | ||
| ), | ||
| include_gym_full_result=dump_gym_results, |
There was a problem hiding this comment.
1 action item.
TL;DR — the new producer column is absent from setup's schema warm-up, leaving its first registration until live traffic.
AI-1 — Include the result column in the gated warm-up
GUIDELINE · PR-introduced omission · confidence: 97. On a fresh Gym dump, this producer gate enables a new column, but neither branch of partition registration includes it. This violates the declared superset-of-producer-fields contract. The adapter explicitly uses warm-up to avoid lazy field-registration races; a serial toy run does not check that invariant. I did not execute a concurrent-failure reproduction.
Action: import the existing result-field constant in setup and add this after the two partition-field branches, before optional multimodal fields:
if should_dump_gym_results(master_config):
partition_fields.append(GYM_FULL_RESULT_FIELD)Preservation / acceptance — static checks, not executed: with a valid Gym configuration and dumping enabled, the registration call must include the column with capture both on and off. With dumping disabled, or a native environment, it should remain absent. Preserve the existing routed-expert and media-field conditions. Do not add this diagnostic object column to the shared training tensor fetch list; registration must not make training workers fetch it.
There was a problem hiding this comment.
This will be covered in #4890 (stacked on this PR): it removes the gym_full_result TQ column this comment is about. The full Gym result is logged instead from the NemoGym actor to <log_dir>/gym_results/gym_results.<pid>.jsonl, and RL's decisions go to rl_outcomes.<pid>.jsonl; the two join on rollout_id. There is no new producer column left to warm up.
| singleton-batch JSONL shape. Chunks stream through `.jsonl.partial` files; | ||
| singleton-batch JSONL shape. On a NeMo-Gym run each row also carries | ||
| `gym_full_result`, the rollout's whole Gym result (`null` for a placeholder | ||
| row). Chunks stream through `.jsonl.partial` files; |
There was a problem hiding this comment.
1 action item.
TL;DR — a placeholder can retain a non-null Gym result, contrary to the new documentation.
AI-1 — Describe unavailable results rather than placeholder validity
DOC · PR-introduced · confidence: 99. If manifest fetching fails after Gym returned a result, the environment returns a missing receipt beside the full result. The row becomes a rejected placeholder, but the new column builder still copies its available result context. Thus the documented placeholder→null rule does not match the implementation.
Action: retain those useful failure diagnostics and replace lines 562–563 with:
`gym_full_result`, the rollout's whole Gym result (`null` when unavailable).
A rejected capture can still retain its Gym result. Chunks stream through `.jsonl.partial` files;
Preservation / acceptance — static check: the wording should distinguish an unavailable result, which yields [null], from an invalid captured trajectory with an available result, which yields an object while remaining loss-masked. No training-mask or result-retention change is needed. This documentation suggestion was not executed or rendered in GitHub.
There was a problem hiding this comment.
This will be covered in #4890 (stacked on this PR): it removes the gym_full_result TQ column this comment is about. The full Gym result is logged instead from the NemoGym actor to <log_dir>/gym_results/gym_results.<pid>.jsonl, and RL's decisions go to rl_outcomes.<pid>.jsonl; the two join on rollout_id. The placeholder/null wording in the docs goes with it.
… dump async_rl.log_gym_results appends each NeMo-Gym result to <log_dir>/gym_results/gym_results.<pid>.jsonl as it lands in AsyncNemoGymRolloutImpl._stream_rows, before any RL filtering. Rollouts that are never trained on (filtered, evicted as stale, or retried) are logged too. Each line carries group_id, group_attempt, rollout_index, rollout_id, and full_result. Independent of async_rl.log_full_train_data, whose rows keep their own gym_full_result copy. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Zhiyu Li <[email protected]>
mikhailshilkov
left a comment
There was a problem hiding this comment.
Thanks! Commit 2 is very helpful for us at MF, giving us every Gym result before filtering. I ported it to Model Factory with one change (a pluggable writer, like #4812) and ran it end to end on a small run. All results landed and all trained samples joined back to their rollout.
For commit 1, I'd rather not carry the whole result through TQ - see my comment below.
| "rollout_id": row.get("_ng_rollout_id"), | ||
| "full_result": result["full_result"], | ||
| } | ||
| self._gym_results_file.write(json.dumps(record, separators=(",", ":")) + "\n") |
There was a problem hiding this comment.
Could this go through a writer chosen by target, the same way as DebugWriter in #4812? We send these to Iceberg. Here's roughly what I did on our side:
class GymResultsWriter(ABC):
def __init__(self, log_dir: str) -> None: ...
@abstractmethod
def write(self, record: dict[str, Any]) -> None: ... # runs on the rollout loop: must not block
def close(self) -> None: ...
# async_rl.gym_results_writer: {target: json} -> today's JSONL as the default
There was a problem hiding this comment.
This logger is replaced in #4890 by JsonlAppender in nemo_rl/utils/gym_results_log.py, which is the natural place for a writer chosen by target. I've raised it there: #4890 (comment)
| "rollout_id": row.get("_ng_rollout_id"), | ||
| "full_result": result["full_result"], | ||
| } | ||
| self._gym_results_file.write(json.dumps(record, separators=(",", ":")) + "\n") |
There was a problem hiding this comment.
This serializes and writes on the controller's event loop, once per result, and agentic results are big (tens of KB). I'd hand the record to the writer as a dict and let it serialize and flush off the loop.
There was a problem hiding this comment.
Addressed in #4890: the write moves off the controller to each NemoGym actor, and JsonlAppender does the file IO on a background thread. json.dumps stays on the caller on purpose: RL post-processing rewrites the result in place right after, so serializing later could log the modified reward instead of what Gym returned.
| ) | ||
| results[rowidx] = result | ||
| if self._gym_results_dir is not None: | ||
| self._log_gym_result(inputs_by_rowidx[rowidx], result) |
There was a problem hiding this comment.
This only sees rows that come back. A row lost to a timeout or a transport failure gets re-dispatched or dropped without a record, and those may be exactly what we’re debugging. Could the re-dispatch and give-up paths log a record with the failure reason as well?
There was a problem hiding this comment.
Partly covered in #4890: when Gym's /run fails, the NemoGym actor writes an event: error line naming the pending rollouts. Re-dispatch and give-up on the controller side (timeouts, transport failures) aren't logged yet; I've raised it on #4890: #4890 (comment)
| "rollout_id": row.get("_ng_rollout_id"), | ||
| "full_result": result["full_result"], | ||
| } | ||
| self._gym_results_file.write(json.dumps(record, separators=(",", ":")) + "\n") |
There was a problem hiding this comment.
Nit: json.dumps doesn't handle NaN or inf, so those rewards produce invalid JSON. #4812 adds json_safe_nonfinite for the same reason in the train dump.
There was a problem hiding this comment.
Good catch. #4890 replaces this logger with JsonlAppender (nemo_rl/utils/gym_results_log.py), and I've proposed the json_safe_nonfinite fix there: #4890 (comment)
| train_data[MALFORMED_THINKING_MASK] = flat[MALFORMED_THINKING_MASK] | ||
| if include_gym_full_result: | ||
| train_data[GYM_FULL_RESULT_FIELD] = np.array( | ||
| [json.dumps(c.env_extras, separators=(",", ":")) for c in completions], |
There was a problem hiding this comment.
This turns on for every run that has log_full_train_data, so we'd get it in all our runs with no way to opt out. Could it get its own flag? Or, with log_gym_results on, the trained row only needs to point at its result: rollout_id and group_attempt in the tags for a join and not the full sample of tens of KB. That would also make the bot happy.
There was a problem hiding this comment.
This will be covered in #4890: it drops the result from the training-data dump entirely, so log_full_train_data no longer pulls it in. The log has its own flag, async_rl.gym_results_log.enabled (off by default), and trained rows join to their result through rl_outcomes lines keyed by rollout_id / group_id + group_attempt, as you suggest.
|
/ok to test cc3082e |
Signed-off-by: Christian Muertz <[email protected]>
|
/ok to test 94787ae |
Signed-off-by: Christian Muertz <[email protected]>
|
/ok to test 1d9b6f2 |
What and why
The train-data dump only sees rollouts selected for training. This PR adds a separate, optional Gym-results log that records a rollout when Gym returns it, before filtering. The train-data dump can also include the full Gym result alongside a trained row. Both can be enabled independently. The diagrams and sample records below show both paths.
Issues
None linked.
Convergence / perf / functionality proof
The original capture-on and capture-off runs each matched 24 of 24 trained rows to Gym records. The validation section below includes the checks, evicted-group counts, and example records from those runs. The controller config regression test also passed on the updated branch.
Needs upstream changes
None. Both features use results already returned by Gym.
PR commands and CI
CI:Lfast: the default for most PRs. Runs a fast test subset.CI:L1: dependency or container changes (pyproject.toml,uv.lock,Dockerfile) or broad core changes. Builds a new image and runs unit and functional tests.CI:docs: docs-only changes. Runs doc tests only./ok to test <full-commit-sha>: start CI for that commit. Post again after each push./review: automated review comments. Addmode=strictfor a stricter review,reset=truefor a fresh full review./resolve-conflict: Autobot mergesmaininto this PR and resolves the conflicts. PRs from forks must allow edits by maintainers./review-pr-team <pr-number>for a team review before you ask for human review.What
With
async_rl.log_full_train_dataturned on in a NeMo-Gym run, each row oftrain_data_step<N>.jsonl(#4347) now includesgym_full_result. That field holds the rollout's whole Gym result: the reward, the verifier fields, and the final response.RewardLogContext.full_result_json. With capture off, it comes fromCompletion.env_extras.full_result_jsonkeeps the raw reward. It now holds Gym's raw reward. The W&B result table still overwrites that with the final reward.AdvantageStageConfigindexedlogger["log_dir"]on theLoggerConfigobject, so everylog_full_train_datarun crashed at startup. Added a regression test.Commit 2:
async_rl.log_gym_results, a Gym-results log decoupled from the train-data dumpThe train-data dump only holds rows that reach a training batch. With
async_rl.log_gym_results: true, every NeMo-Gym result is appended to<log_dir>/gym_results/gym_results.<pid>.jsonlas soon as it lands inAsyncNemoGymRolloutImpl._stream_rows, before any RL filtering. That includes rollouts that are never trained on (filtered, evicted as stale, or retried). Each line carriesgroup_id,group_attempt,rollout_index,rollout_id, andfull_result. The two flags are independent: either log can be on without the other.Example gym_results line (the same rollout as train_data_step2.jsonl row 0 in that run; tool schemas omitted)
{ "group_id": "41d75d46-c218-4d52-adcb-199fa2688f0d", "group_attempt": 0, "rollout_index": 0, "rollout_id": "41d75d46-c218-4d52-adcb-199fa2688f0d_g0_a9b5133ca1843445bae9c1805b7dcdd69", "full_result": { "responses_create_params": { "background": null, "include": null, "input": [ { "content": "Today's date is Thursday, 2023-11-30 and the current time is 23:59:00. Remember the current date and time when answering queries. Meetings must not start before 9am or end after 6pm.", "role": "system", "type": "message", "phase": null }, { "content": "Reply to carlos's last email about 'Task Update on Develop prototype for report generation' with 'Thanks for the update - I will get back to you tomorrow.'", "role": "user", "type": "message", "phase": null } ], "instructions": null, "max_output_tokens": 8192, "max_tool_calls": null, "metadata": null, "model": null, "parallel_tool_calls": false, "previous_response_id": null, "prompt": null, "reasoning": null, "service_tier": null, "store": null, "context_management": null, "conversation": null, "moderation": null, "prompt_cache_key": null, "prompt_cache_retention": null, "safety_identifier": null, "stream_options": null, "temperature": 1.0, "text": null, "tool_choice": "auto", "tools": [ "<27 tool schemas, names omitted>" ], "top_logprobs": null, "top_p": 1.0, "truncation": null, "user": null, "stream": null }, "response": { "id": "chatcmpl-b5b76a6159b0f591", "created_at": 1792660078.0, "error": null, "incomplete_details": null, "instructions": null, "metadata": null, "model": "Qwen/Qwen3-0.6B", "object": "response", "output": [ { "arguments": "{\"email_id\": \"reply_to_email_id\", \"body\": \"Thanks for the update - I will get back to you tomorrow.\"}", "call_id": "chatcmpl-tool-a12d279f5e62203c", "name": "email_reply_email", "type": "function_call", "id": "chatcmpl-tool-a12d279f5e62203c", "status": "completed", "namespace": null }, { "call_id": "chatcmpl-tool-a12d279f5e62203c", "output": "{\"output\":\"Email not found.\"}", "type": "function_call_output", "id": null, "status": null }, { "id": "msg_38d4819d9acf4079bcfd292cab2397a8", "content": [ { "annotations": [], "text": "{\"name\": \"email_reply_email\", \"arguments\": {\"email_id\": \"reply_to_email_id\", \"body\": \"Thanks for the update - I will get back to you tomorrow.\"}}", "type": "output_text", "logprobs": null } ], "role": "assistant", "status": "completed", "type": "message", "phase": null } ], "parallel_tool_calls": false, "temperature": 1.0, "tool_choice": "auto", "tools": [ "<27 tool schemas, names omitted>" ], "top_p": 1.0, "background": null, "completed_at": null, "conversation": null, "max_output_tokens": 8192, "max_tool_calls": null, "moderation": null, "previous_response_id": null, "prompt": null, "prompt_cache_key": null, "prompt_cache_retention": null, "reasoning": null, "safety_identifier": null, "service_tier": null, "status": "completed", "text": null, "top_logprobs": null, "truncation": null, "usage": { "input_tokens": 8291, "input_tokens_details": { "cached_tokens": null }, "output_tokens": 83, "output_tokens_details": { "reasoning_tokens": null }, "total_tokens": 8374 }, "user": null }, "reward": 0.0, "mask_sample": false, "failure_kind": null, "failure_reason": null, "ng_trajectory": { "schema_version": "1.0", "task_id": "unknown", "rollout_id": "41d75d46-c218-4d52-adcb-199fa2688f0d_g0_a9b5133ca1843445bae9c1805b7dcdd69", "invocations": [ { "kind": "agent_invocation", "invocation_id": "root", "parent_invocation_id": null, "spawned_by_tool_call_id": null, "status": "completed", "stop_reason": null, "duration_ms": null, "error_type": null, "model_calls": [ { "model_call_id": null, "model_ref": { "type": "responses_api_models", "name": "policy_model" }, "response_id": "chatcmpl-9d330f15bded4bb6" }, { "model_call_id": null, "model_ref": { "type": "responses_api_models", "name": "policy_model" }, "response_id": "chatcmpl-b5b76a6159b0f591" } ], "conversation": [ { "content": "Today's date is Thursday, 2023-11-30 and the current time is 23:59:00. Remember the current date and time when answering queries. Meetings must not start before 9am or end after 6pm.", "role": "system", "type": "message", "phase": null }, { "content": "Reply to carlos's last email about 'Task Update on Develop prototype for report generation' with 'Thanks for the update - I will get back to you tomorrow.'", "role": "user", "type": "message", "phase": null }, { "arguments": "{\"email_id\": \"reply_to_email_id\", \"body\": \"Thanks for the update - I will get back to you tomorrow.\"}", "call_id": "chatcmpl-tool-a12d279f5e62203c", "name": "email_reply_email", "type": "function_call", "id": "chatcmpl-tool-a12d279f5e62203c", "status": "completed", "namespace": null }, { "call_id": "chatcmpl-tool-a12d279f5e62203c", "output": "{\"output\":\"Email not found.\"}", "type": "function_call_output", "id": null, "status": null }, { "id": "msg_38d4819d9acf4079bcfd292cab2397a8", "content": [ { "annotations": [], "text": "{\"name\": \"email_reply_email\", \"arguments\": {\"email_id\": \"reply_to_email_id\", \"body\": \"Thanks for the update - I will get back to you tomorrow.\"}}", "type": "output_text", "logprobs": null } ], "role": "assistant", "status": "completed", "type": "message", "phase": null } ] } ], "turns": [ { "invocation_id": "root", "source_message_id": null, "source_model_ref": null, "task_id": "unknown", "rollout_id": "41d75d46-c218-4d52-adcb-199fa2688f0d_g0_a9b5133ca1843445bae9c1805b7dcdd69", "turn_no": 1, "timestamp": 1792660078.1429865, "question": [ { "content": "Today's date is Thursday, 2023-11-30 and the current time is 23:59:00. Remember the current date and time when answering queries. Meetings must not start before 9am or end after 6pm.", "role": "system", "type": "message", "phase": null }, { "content": "Reply to carlos's last email about 'Task Update on Develop prototype for report generation' with 'Thanks for the update - I will get back to you tomorrow.'", "role": "user", "type": "message", "phase": null } ], "answer": [ { "arguments": "{\"email_id\": \"reply_to_email_id\", \"body\": \"Thanks for the update - I will get back to you tomorrow.\"}", "call_id": "chatcmpl-tool-a12d279f5e62203c", "name": "email_reply_email", "type": "function_call", "id": "chatcmpl-tool-a12d279f5e62203c", "status": "completed", "namespace": null } ], "reasoning_content": null, "resolved": null, "step_count": 1, "model_calls": [ { "model_call_id": null, "model_ref": { "type": "responses_api_models", "name": "policy_model" }, "response_id": "chatcmpl-9d330f15bded4bb6" } ] }, { "invocation_id": "root", "source_message_id": null, "source_model_ref": null, "task_id": "unknown", "rollout_id": "41d75d46-c218-4d52-adcb-199fa2688f0d_g0_a9b5133ca1843445bae9c1805b7dcdd69", "turn_no": 2, "timestamp": 1792660078.4448571, "question": [ { "content": "Today's date is Thursday, 2023-11-30 and the current time is 23:59:00. Remember the current date and time when answering queries. Meetings must not start before 9am or end after 6pm.", "role": "system", "type": "message", "phase": null }, { "content": "Reply to carlos's last email about 'Task Update on Develop prototype for report generation' with 'Thanks for the update - I will get back to you tomorrow.'", "role": "user", "type": "message", "phase": null }, { "arguments": "{\"email_id\": \"reply_to_email_id\", \"body\": \"Thanks for the update - I will get back to you tomorrow.\"}", "call_id": "chatcmpl-tool-a12d279f5e62203c", "name": "email_reply_email", "type": "function_call", "id": "chatcmpl-tool-a12d279f5e62203c", "status": "completed", "namespace": null }, { "call_id": "chatcmpl-tool-a12d279f5e62203c", "output": "{\"output\":\"Email not found.\"}", "type": "function_call_output", "id": null, "status": null } ], "answer": [ { "id": "msg_38d4819d9acf4079bcfd292cab2397a8", "content": [ { "annotations": [], "text": "{\"name\": \"email_reply_email\", \"arguments\": {\"email_id\": \"reply_to_email_id\", \"body\": \"Thanks for the update - I will get back to you tomorrow.\"}}", "type": "output_text", "logprobs": null } ], "role": "assistant", "status": "completed", "type": "message", "phase": null } ], "reasoning_content": null, "resolved": null, "step_count": 1, "model_calls": [ { "model_call_id": null, "model_ref": { "type": "responses_api_models", "name": "policy_model" }, "response_id": "chatcmpl-b5b76a6159b0f591" } ] } ], "model_calls": [], "tool_calls": [ { "kind": "tool_call", "invocation_id": "root", "tool_call_id": "chatcmpl-tool-a12d279f5e62203c", "sandbox_id": null, "tool_name": "email_reply_email", "started_at": 1792660078.394602, "completed_at": 1792660078.444818, "duration_ms": 50.21590400428977, "timing_source": "executor", "status": "completed", "error_type": null, "output": "{\"output\":\"Email not found.\"}" } ], "gaps": [ { "code": "resolution_unavailable", "invocation_id": "root", "detail": null } ] } } }Validation
Toy GRPO runs: Qwen3-0.6B, workplace_assistant, single controller, with token capture on and off. Each dump row was checked against Gym's per-call record of the same rollout:
Gym-results log (
log_gym_results)Toy run with generation running ahead of training (
windowedsampler,max_staleness_versions: 0), so stale groups are evicted without being trained on:gym_resultslinesgym_resultsA logged rollout that was never trained on (group
0fa5ecf0…, evicted as stale): the prompt is "Reply to carlos's last email about 'Task Update on Develop prototype for report generation'…", the model replied "None of the provided functions are directly suitable for replying to an email…", and the reward was 0.0. It appears only ingym_results.Unit tests: 1295 passed, 0 failed in the driver venv. In the actor venvs, vLLM 19, Megatron 22, and NemoGym 29 passed.
Sample dump row
One row of
train_data_step1.jsonlfrom the toy run on this commit with stock Gym (token capture on). For length, each per-token array is cut to its first 8 values, and the tool schemas, which are repeated, are replaced by the tool names.gym_full_resultis otherwise verbatim.train_data_step1.jsonl, row 0
{ "idx": 0, "step": 1, "sample_id": [ "16a89757-0f19-4918-b7a3-d6a160678366_g0" ], "input_lengths": [ 4137 ], "metadata": [ { "weight_version": 0, "prompt_idx": 4, "group_id": "16a89757-0f19-4918-b7a3-d6a160678366" } ], "token_ids": [ [ 151644, 8948, 198, 15364, 594, 2400, 374, 7794, "... 4129 more" ] ], "token_loss_mask": [ [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, "... 4129 more" ] ], "advantages": [ [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, "... 4129 more" ] ], "generation_logprobs": [ [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, "... 4129 more" ] ], "prev_logprobs": [ [ 0.0, -12.816184997558594, -8.185492515563965, -16.112110137939453, -1.0109633207321167, -2.6234922409057617, -0.21216459572315216, -3.7290687561035156, "... 4129 more" ] ], "sample_loss_mask": [ 1.0 ], "pre_seq_error_sample_loss_mask": [ 1.0 ], "rewards": [ 0.0 ], "prompt_ids": [ [ 151644, 8948, 198, 15364, 594, 2400, 374, 7794, "... 4095 more" ] ], "gym_full_result": [ { "responses_create_params": { "background": null, "include": null, "input": [ { "content": "Today's date is Thursday, 2023-11-30 and the current time is 23:59:00. Remember the current date and time when answering queries. Meetings must not start before 9am or end after 6pm.", "role": "system", "type": "message", "phase": null }, { "content": "Move all customers that haven't responded to a proposal for the hardware product in 4 weeks to lost in the crm", "role": "user", "type": "message", "phase": null } ], "instructions": null, "max_output_tokens": 8192, "max_tool_calls": null, "metadata": null, "model": null, "parallel_tool_calls": false, "previous_response_id": null, "prompt": null, "reasoning": null, "service_tier": null, "store": null, "context_management": null, "conversation": null, "moderation": null, "prompt_cache_key": null, "prompt_cache_retention": null, "safety_identifier": null, "stream_options": null, "temperature": 1.0, "text": null, "tool_choice": "auto", "tools": [ "<27 tool schemas: company_directory_find_email_address, email_get_email_information_by_id, email_search_emails, email_send_email, email_delete_email, email_forward_email, email_reply_email, calendar_get_event_information_by_id, calendar_search_events, calendar_create_event, calendar_delete_event, calendar_update_event, analytics_get_visitor_information_by_id, analytics_create_plot, analytics_total_visits_count, analytics_engaged_users_count, analytics_traffic_source_count, analytics_get_average_session_duration, project_management_get_task_information_by_id, project_management_search_tasks, project_management_create_task, project_management_delete_task, project_management_update_task, customer_relationship_manager_search_customers, customer_relationship_manager_update_customer, customer_relationship_manager_add_customer, customer_relationship_manager_delete_customer>" ], "top_logprobs": null, "top_p": 1.0, "truncation": null, "user": null, "stream": null }, "response": { "id": "chatcmpl-b11b84f21a0b5063", "created_at": 1792655121.0, "error": null, "incomplete_details": null, "instructions": null, "metadata": null, "model": "Qwen/Qwen3-0.6B", "object": "response", "output": [ { "id": "msg_d1b7e22bd32346f081b458832b9db44d", "content": [ { "annotations": [], "text": "None of the provided tools can be used to handle the request to move customers based on a proposal status in a CRM. Please request the necessary tools for CRM operations.", "type": "output_text", "logprobs": null } ], "role": "assistant", "status": "completed", "type": "message", "phase": null } ], "parallel_tool_calls": false, "temperature": 1.0, "tool_choice": "auto", "tools": [ "<27 tool schemas: company_directory_find_email_address, email_get_email_information_by_id, email_search_emails, email_send_email, email_delete_email, email_forward_email, email_reply_email, calendar_get_event_information_by_id, calendar_search_events, calendar_create_event, calendar_delete_event, calendar_update_event, analytics_get_visitor_information_by_id, analytics_create_plot, analytics_total_visits_count, analytics_engaged_users_count, analytics_traffic_source_count, analytics_get_average_session_duration, project_management_get_task_information_by_id, project_management_search_tasks, project_management_create_task, project_management_delete_task, project_management_update_task, customer_relationship_manager_search_customers, customer_relationship_manager_update_customer, customer_relationship_manager_add_customer, customer_relationship_manager_delete_customer>" ], "top_p": 1.0, "background": null, "completed_at": null, "conversation": null, "max_output_tokens": 8192, "max_tool_calls": null, "moderation": null, "previous_response_id": null, "prompt": null, "prompt_cache_key": null, "prompt_cache_retention": null, "reasoning": null, "safety_identifier": null, "service_tier": null, "status": "completed", "text": null, "top_logprobs": null, "truncation": null, "usage": { "input_tokens": 4103, "input_tokens_details": { "cached_tokens": null }, "output_tokens": 34, "output_tokens_details": { "reasoning_tokens": null }, "total_tokens": 4137 }, "user": null }, "reward": 0.0, "mask_sample": false, "failure_kind": null, "failure_reason": null, "ng_trajectory": { "schema_version": "1.0", "task_id": "unknown", "rollout_id": "16a89757-0f19-4918-b7a3-d6a160678366_g0_a37949f51ec2547c499ec11fea94de50d", "invocations": [ { "kind": "agent_invocation", "invocation_id": "root", "parent_invocation_id": null, "spawned_by_tool_call_id": null, "status": "completed", "stop_reason": null, "duration_ms": null, "error_type": null, "model_calls": [ { "model_call_id": null, "model_ref": { "type": "responses_api_models", "name": "policy_model" }, "response_id": "chatcmpl-b11b84f21a0b5063" } ], "conversation": [ { "content": "Today's date is Thursday, 2023-11-30 and the current time is 23:59:00. Remember the current date and time when answering queries. Meetings must not start before 9am or end after 6pm.", "role": "system", "type": "message", "phase": null }, { "content": "Move all customers that haven't responded to a proposal for the hardware product in 4 weeks to lost in the crm", "role": "user", "type": "message", "phase": null }, { "id": "msg_d1b7e22bd32346f081b458832b9db44d", "content": [ { "annotations": [], "text": "None of the provided tools can be used to handle the request to move customers based on a proposal status in a CRM. Please request the necessary tools for CRM operations.", "type": "output_text", "logprobs": null } ], "role": "assistant", "status": "completed", "type": "message", "phase": null } ] } ], "turns": [ { "invocation_id": "root", "source_message_id": null, "source_model_ref": null, "task_id": "unknown", "rollout_id": "16a89757-0f19-4918-b7a3-d6a160678366_g0_a37949f51ec2547c499ec11fea94de50d", "turn_no": 1, "timestamp": 1792655121.7567227, "question": [ { "content": "Today's date is Thursday, 2023-11-30 and the current time is 23:59:00. Remember the current date and time when answering queries. Meetings must not start before 9am or end after 6pm.", "role": "system", "type": "message", "phase": null }, { "content": "Move all customers that haven't responded to a proposal for the hardware product in 4 weeks to lost in the crm", "role": "user", "type": "message", "phase": null } ], "answer": [ { "id": "msg_d1b7e22bd32346f081b458832b9db44d", "content": [ { "annotations": [], "text": "None of the provided tools can be used to handle the request to move customers based on a proposal status in a CRM. Please request the necessary tools for CRM operations.", "type": "output_text", "logprobs": null } ], "role": "assistant", "status": "completed", "type": "message", "phase": null } ], "reasoning_content": null, "resolved": null, "step_count": 0, "model_calls": [ { "model_call_id": null, "model_ref": { "type": "responses_api_models", "name": "policy_model" }, "response_id": "chatcmpl-b11b84f21a0b5063" } ] } ], "model_calls": [], "tool_calls": [], "gaps": [ { "code": "resolution_unavailable", "invocation_id": "root", "detail": null } ] } } ] }🤖 Generated with Claude Code