Skip to content

fix(gym): size every Gym actor's max_concurrency from the rollout fan-in - #5117

Draft
jthomson04 wants to merge 15 commits into
NVIDIA-NeMo:jthomson04/dynamo-1.7from
jthomson04:jthomson04/gym-actor-concurrency
Draft

jthomson04 wants to merge 15 commits into
NVIDIA-NeMo:jthomson04/dynamo-1.7from
jthomson04:jthomson04/gym-actor-concurrency

Conversation

@jthomson04

Copy link
Copy Markdown
Contributor

What

Every NeMo-Gym actor is created with no max_concurrency, so Ray's async-actor default of 1000 applies to each one. On the SingleController, every in-flight prompt holds one run_rollouts call on a Gym actor. Past 1000 calls, the extra calls do not raise and do not time out. They wait inside the actor, the submitter logs tasks pending submission to actor NemoGym, and the run stops producing steps.

This PR sizes every actor, each shard replica included, for async_rl.max_inflight_prompts plus 8 slots for control calls (_spinup, health_check, shutdown).

  • Why every replica gets the whole fan-in: routing is by agent name, so the fan-in does not split evenly across replicas. In the Nano 3.5 lag-16 shard plan at a 32K batch (34,816 groups in flight), each of the 32 verifier replicas carries about 1,073 groups, just past Ray's 1000.
  • Other callers: callers that declare no fan-in (v1 GRPO, distillation) keep Ray's default.

Stacked on #5115. It is needed for the ~0.5M-rollouts-in-flight stress config (32K batch, lag 16).

Credit

This is adapted from Saurabh's saumishr/RL@3570a766fd, which extends #3672 (still open, written against the pre-build_nemo_gym_actors code) to the sharded builder. The env.nemo_gym.max_concurrency override from those commits is left out: nothing here needs it, and it would add a config key.

Testing

  • New test: parametrized over unsharded and sharded, with and without a fan-in. It asserts every actor gets the fan-in plus 8, and that no fan-in leaves the option off. Removing the sharded line makes the sharded case fail.
  • Test files: tests/unit/environments/test_nemo_gym_utils.py and tests/unit/single_controller/test_setup.py pass (432 tests).
  • Checks: ruff and pyrefly are clean.

🤖 Generated with Claude Code

build_nemo_gym_actors created its actors with no max_concurrency, so Ray's
async-actor default of 1000 applied to each. Every in-flight prompt holds one
run_rollouts call on a Gym actor, and calls past 1000 do not raise or time
out: they wait inside the actor, the submitter logs "tasks pending submission
to actor NemoGym", and the run stops producing steps.

On the SingleController path, size every actor (each shard replica included)
for async_rl.max_inflight_prompts plus 8 slots for its control calls. The whole
fan-in goes to each replica because routing is by agent name and does not
split evenly: in the Nano 3.5 lag-16 shard plan at a 32K batch, each of the 32
verifier replicas carries about 1,073 groups. Callers that declare no fan-in
(v1 GRPO, distillation) keep Ray's default.

Adapted from saumishr/RL@3570a766fd, which extends NVIDIA-NeMo#3672 to the
sharded builder. The env.nemo_gym.max_concurrency override from those commits
is left out.

Co-authored-by: Saurav Muralidharan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: jthomson04 <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Nov 6, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

…tor-concurrency

Brings in NVIDIA-NeMo#5115 restacked on NVIDIA-NeMo#4979 at 45add8b (NeMo RL's chat engine in Dynamo's frontend, Gym at 9aac609). No conflicts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: jthomson04 <[email protected]>
@copy-pr-bot

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

jthomson04 and others added 4 commits November 10, 2026 11:55
 NaN fix) into jthomson04/gym-actor-concurrency

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: jthomson04 <[email protected]>
…alidArgument -> 500) into jthomson04/gym-actor-concurrency

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: jthomson04 <[email protected]>
… cuts through every frontend) into jthomson04/gym-actor-concurrency

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: jthomson04 <[email protected]>
…t-call steps and cut deadline) into jthomson04/gym-actor-concurrency

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: jthomson04 <[email protected]>
@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Nov 12, 2026
…rs start at registration) into jthomson04/gym-actor-concurrency

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: jthomson04 <[email protected]>
jthomson04 and others added 8 commits November 12, 2026 16:29
…rs built while the engines load) into jthomson04/gym-actor-concurrency

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: jthomson04 <[email protected]>
… bump and the rebased Gym pin) into jthomson04/gym-actor-concurrency

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: jthomson04 <[email protected]>
… to Gym#4817's review fixes) into jthomson04/gym-actor-concurrency

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: jthomson04 <[email protected]>
… startup check also covers sampling_overrides) into jthomson04/gym-actor-concurrency

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: jthomson04 <[email protected]>
…the prefix-recovery Dynamo run) into jthomson04/gym-actor-concurrency

No conflicts.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: jthomson04 <[email protected]>
…d multimodal prefix recovery) into jthomson04/gym-actor-concurrency

No conflicts.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: jthomson04 <[email protected]>
… engine and dynamic sampling under token capture) into jthomson04/gym-actor-concurrency

No conflicts.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: jthomson04 <[email protected]>
…namic sampling for the streaming samplers and checkpointing configs as BaseModel) into jthomson04/gym-actor-concurrency

No conflicts.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: jthomson04 <[email protected]>
@terrykong terrykong removed the Documentation Improvements or additions to documentation label Nov 28, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants