Repository navigation
feat(rollout): add multi-harness fan-out training - #4082
ehosseiniasl wants to merge 62 commits into
Conversation
Signed-off-by: Ehsan Hosseini Asl <[email protected]> Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
Signed-off-by: Ehsan Hosseini Asl <[email protected]> Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
Signed-off-by: ehosseiniasl <[email protected]> Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
Signed-off-by: ehosseiniasl <[email protected]> Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
Signed-off-by: ehosseiniasl <[email protected]> Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
e7a8b8f to
3f2ea97
Compare
Current P0 fan-out validationThis comment supersedes the earlier choose-one Current PR head: The generic source is
Validation completed:
Full Nemotron Super 3.5 Omni async-GRPO job |
Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
fe22f31 to
cda0d86
Compare
…rness-training-routing Signed-off-by: Ehsan Hosseini-Asl <[email protected]> # Conflicts: # nemo_gym/train_data_utils.py
Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
…rness-training-routing Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
ecf59f4 to
a1b3466
Compare
Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
97441d3 to
c27e6c1
Compare
# Conflicts: # nemo_gym/token_id_capture/fingerprint.py # responses_api_agents/openclaw_agent/setup_openclaw.py # responses_api_agents/opencode_agent/app.py # responses_api_agents/opencode_agent/tests/test_app.py # responses_api_agents/pi_agent/README.md # responses_api_agents/pi_agent/app.py # responses_api_agents/pi_agent/configs/pi_agent.yaml # responses_api_agents/pi_agent/tests/test_app.py Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
# Conflicts: # responses_api_agents/openclaw_agent/app.py # responses_api_agents/openclaw_agent/configs/openclaw_agent.yaml # responses_api_agents/openclaw_agent/tests/test_app.py # responses_api_agents/opencode_agent/README.md # responses_api_agents/opencode_agent/app.py # tests/unit_tests/test_token_capture_ledger.py Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
Signed-off-by: Ehsan Hosseini-Asl <[email protected]> (cherry picked from commit 5511663cddfff144726bb85983882e6f65bd4d32)
Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
## What does this PR do? README only. Tells OpenClaw users to set `context_window` to the model server's maximum context length, and explains how OpenClaw uses it and `max_output_tokens`. Follow-up to NVIDIA-NeMo#4476, which lets sandbox sessions use `max_output_tokens`; there is no issue. Why: when `context_window` is unset, OpenClaw assumes 200,000 tokens. On a server with a smaller limit, it keeps requesting its full output limit and does not compact in time, so long episodes can send requests the server rejects. Gym's `vllm_model` returns an empty reply, not an error, by default, and the run ends early. Example, worked out from the code and not measured in a run: released vLLM (up to 0.31) rejects a call when prompt + requested output > `max_model_len`. At 131,072 with no `context_window`, calls fail once the prompt passes 122,880 tokens (131,072 − 8,192 default), or 98,304 with `max_output_tokens: 32768` (131,072 − 32,768). With `context_window: 131072`, OpenClaw lowers each call's output to fit the room left by its estimate of the input; the estimate can undercount code or JSON. Unreleased vLLM main (vllm-project/vllm#57035) lowers the output instead of rejecting, but still rejects a prompt longer than `max_model_len`. The sandbox section now also says that the request field is rejected but the agent config field applies, and that a `max_output_tokens` above `context_window` is rejected (the check from NVIDIA-NeMo#4476). ## Validation - Read the OpenClaw npm package at 2026.6.11 (pinned in `configs/openclaw_agent.yaml`) and at 2026.6.35 (the pin in NVIDIA-NeMo#4082). Both match the README: - `contextWindow` defaults to 200,000 and `maxTokens` to min(8,192, `contextWindow`) (`dist/io-*.js`); - each call requests at most min(`maxTokens`, `contextWindow` − estimated input − 1), where the estimate is characters / 4 × 1.25. This applies to any base URL other than OpenAI's or Azure OpenAI's, which covers Gym's model server (`dist/openai-transport-stream-*.js`); - two in-run limits are computed from `contextWindow`. One is the context guard: once a run passes its limit, OpenClaw compacts and retries (`installToolResultContextGuard` in `dist/selection-*.js`). The other is the cap on each tool result's size (`resolveLiveToolResultMaxChars` in `dist/tool-result-truncation-*.js`). - Gym code on main: `_build_openclaw_config` writes `contextWindow` and `maxTokens` only when they are set, and `vllm_model` returns an empty `length` completion on a context-length error unless `propagate_context_overflow_errors` is true. - Open PRs touching OpenClaw: NVIDIA-NeMo#3902 and NVIDIA-NeMo#2733 edit this README, and NVIDIA-NeMo#4082 moves the pin to 2026.6.35. `git merge-tree` shows this PR adds no conflicts with any of them. - `pre-commit run --all-files`: passed. ## Rollouts N/A: README-only change, with no code or config changes. ## Compatibility and benchmark impact None from this PR. Following the advice can change rollouts with long episodes or long tool results, because `context_window` also sets when OpenClaw compacts and how much of a tool result it keeps. ## Checklist - [x] I have read the [contributing guidelines](https://github.com/NVIDIA-NeMo/Gym/blob/main/CONTRIBUTING.md). - [x] The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs. - [x] Tests added or updated and pass locally, or N/A for docs-only / non-code changes (so CI unit/server checks pass when applicable). N/A: docs-only. - [x] Documentation added or updated, or N/A with justification. - [x] Pre-commit checks pass locally (`pre-commit run --all-files`) (so CI lint/format checks pass). - [x] New source files include the required Apache-2.0 SPDX header. N/A: no new files. - [x] All commits have DCO sign-off (`git commit -s`) (so the DCO check passes). Signed-off-by: Abhishree <[email protected]>
…rness-training-routing Signed-off-by: Ehsan Hosseini-Asl <[email protected]> # Conflicts: # responses_api_agents/openclaw_agent/scripts/openclaw_agent_deps.sh
95cf80e to
7529292
Compare
Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
Signed-off-by: Ehsan Hosseini-Asl <[email protected]>
|
We’re doing some cleanup of the open PR list. This PR has had no activity for over a month, so I’ve moved it back to draft. If this change is still needed, please resolve any merge conflicts and mark the PR ready for review again when it’s ready to merge. Thanks! |
Summary
Adds FineEnvs-style multi-harness rollout support to NeMo Gym.
fan_outto run every matching task through every configured harnessagent_poolas a distinct choose-one-harness modeanyterminal_multi_harnessRouting semantics
agent_poolfan_outThe generic profile intentionally does not hard-code either mode. The caller chooses
fan_outfor task × harness training oragent_poolfor one-of-N routing.P0 configuration
The source data uses:
Direct Gym rollout fan-out:
python -m nemo_gym.cli run --config responses_api_agents/anyterminal_agent/configs/anyterminal_multi_harness.yaml '+fan_out={anyterminal_multi_harness:[anyterminal_opencode,anyterminal_openclaw,anyterminal_pi,anyterminal_hermes]}' --input data/anyterminal_multi_harness/train.jsonl --output results/anyterminal_multi_harness.jsonlFor NeMo RL training, the companion PR supplies the same mapping at
env.nemo_gym.fan_out. Four source tasks × four destinations produce 16 independent prompt groups.Implementation
nemo_gym/rollout_collection.pyfan_outagent_poolselection andfan_outexpansion separatenemo_gym/global_config.pynemo_gym/train_data_utils.pyandnemo_gym/task_data.pyresponses_api_agents/anyterminal_agent/Validation
Automated coverage
Coverage includes:
fan_outemits one row per destination in configured orderagent_poolandfan_outroutes composeFocused fan-out and profile coverage passes on the current head: 12 passed, 441 deselected. The changed-file pre-commit hooks also pass on
63bd86b11; GitHub CI is rerunning on that head.Real P0 harness execution
Real Terminal-Bench 2.1 task containers completed through all four harnesses—OpenCode, OpenClaw, Pi, and Hermes—with non-empty output and:
mask_sample=falsefailure_kind=nullandfailure_reason=nullagent_timed_out=falsecontainer_timed_out=falsesandbox_failed=falseAsync-GRPO regression run
The earlier one-harness-per-task run validates the surrounding Gym ↔ RL runtime path, token capture, policy update, TMPE logging, and W&B integration:
2157719,COMPLETED (0:0)It is a regression result, not proof of the new cross-product. Current-head Slurm preflight
2158959completed successfully: 4 Terminal-Bench source tasks expanded to 16 prompt groups in OpenCode/OpenClaw/Pi/Hermes order. The companion RL PR adds the full Nemotron Super 3.5 Omni task × four-harness recipe; training job2158991is submitted and pending scheduler capacity.Review guide
nemo_gym/rollout_collection.pynemo_gym/global_config.pynemo_gym/train_data_utils.pyresponses_api_agents/anyterminal_agent/tests/unit_tests/test_rollout_collection.pyandtest_anyterminal_multi_harness.pyCompanion NeMo RL PR: NVIDIA-NeMo/RL#4521