Skip to content

feat(nemo-gym): preserve multi-harness routing and pooled rollout metrics - #4521

Open
ehosseiniasl wants to merge 8 commits into
NVIDIA-NeMo:mainfrom
ehosseiniasl:ehosseiniasl/multi-harness-training-routing
Open

ehosseiniasl wants to merge 8 commits into
NVIDIA-NeMo:mainfrom
ehosseiniasl:ehosseiniasl/multi-harness-training-routing

Conversation

@ehosseiniasl

@ehosseiniasl ehosseiniasl commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor
  • I, the PR author, have personally reviewed every line of this PR.

What and why

Uneven rollout groups need pooled counters, and harness identity must survive capture and recovery to attribute results correctly.

  • Preserve flat-row fan_out (every harness) and agent_pool (one harness) before shard dispatch, with prompt-group affinity and a Qwen example. Keep native taskset routing intact.
  • Retain reported execution tags through replay and recovery; pool reward/token/mask counters by benchmark, environment, and executed harness, including valid zero rewards.
  • Bound capture control connections and response bodies with one deadline; require uvloop 0.23 cleanup fixes.
  • Share sampled/head scoring gradients to reduce chunked logprob memory, and report optimizer updates across participating ranks.
  • Support current_step checkpoint retention. Reward computation and training masks retain their existing behavior.
  • Keep configured BF16 optimizer moments off the GPU during non-colocated split accumulation, restore them after gradient finalization, and reuse joint scoring storage under a validated sole-consumer contract. Honor explicitly frozen expert biases.
  • Bound native checkpoint-writer host memory during container construction and reserve the longest completed iteration before the save deadline.
flowchart LR
  S[Source task] --> F[Expand or select harness]
  F --> G[Keep each prompt group together]
  G --> E[Gym execution]
  E --> R[Retain execution identity]
  R --> M[Pool counters before computing means]
Loading

Issues

None.

Convergence / perf / functionality proof

  • Earlier public-head native CPU focused run: 1,038 cases passed. Model-backed integration remains unverified locally: three existing vLLM setups could not load their Qwen tokenizer from the offline cache.

  • The retained Qwen recipe validates against the current SingleController schema.

  • Ruff lint, import order, and formatting pass for all 31 changed Python files; syntax and dependency-manifest consistency checks pass.

  • The corrected optimizer-policy suite adds 16 passing cases. Two TQ publication cases were not reached because the standalone runner initialized Ray twice; CI must cover those cases.

  • New runtime fixes: 84 focused CPU checks passed using Torch 2.9 CPU: the complete timer suite plus isolated actual production methods for Gloo/autograd, storage reuse, residency guards and resumed Adam state parity. GPU-dependent whole-module/model integration remains unverified.

  • Native checkpoint writer: seven compatibility checks passed using exact PyTorch 2.13 writer source on Torch 2.9 CPU DCP, covering bounded tensor lifetimes, roundtrip, safetensors offsets, source guards and atomic hardlink-safe installation. Native 2.13/2.14 execution and a full container rebuild remain unverified.

No full-model training claim is made for this public head. Historical runs below used an earlier private runtime; they support the development history only.

Needs upstream changes

Supported container builds apply the included source-verified PyTorch writer fix. Source-only installs require the equivalent dependency fix. The pinned public Megatron-Core already uses synchronous saves; its source is not replaced.

Companion execution metadata: NVIDIA-NeMo/Gym#6607. Legacy AnyTerminal profile: NVIDIA-NeMo/Gym#4082.

W&B references (historical; not public-head validation):

@copy-pr-bot

copy-pr-bot Bot commented Oct 6, 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.

@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Oct 6, 2026
@ehosseiniasl ehosseiniasl self-assigned this Oct 6, 2026
@ehosseiniasl

ehosseiniasl commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor Author

Current multi-harness validation

This comment supersedes the earlier choose-one agent_pool smoke.

Current PR head: 1595167c.

The implemented training mode is now fan_out from the neutral source anyterminal_multi_harness to all four P0 destinations:

  • anyterminal_opencode
  • anyterminal_openclaw
  • anyterminal_pi
  • anyterminal_hermes

Every source task is expanded once per harness before dataloader batching and shard routing. Four source tasks therefore produce 16 independent GRPO prompt groups; sibling generations within one group stay on the same harness.

Validation completed:

  • focused RL fan-out suite: 8 passed
  • Gym focused fan-out/profile suite: 12 passed
  • Slurm preflight 2158959: COMPLETED (0:0)
  • verified 4 source tasks → 16 groups in OpenCode/OpenClaw/Pi/Hermes order
  • verified 16 nodes, 8 trainer nodes, 8 generation nodes, and 4 optimizer steps

Full Nemotron Super 3.5 Omni runs are submitted: 16-node async job 2158991, plus 8-node synchronous job 2159151. Sync preflight 2159121 completed successfully with 4 trainer nodes, 4 generation nodes, zero lookahead, one batch in flight, KV-cache recomputation after refit, and the same 4→16 fan-out. W&B will use adlr/multi-harness-RL; run URLs and TMPE results will be added after allocation starts.

@ehosseiniasl
ehosseiniasl force-pushed the ehosseiniasl/multi-harness-training-routing branch 2 times, most recently from c64f9a3 to c27f065 Compare October 6, 2026 18:21
@ehosseiniasl ehosseiniasl changed the title feat(gym): route agent pools across shards feat(nemo-gym): add multi-harness fan-out training Oct 6, 2026
@ehosseiniasl
ehosseiniasl force-pushed the ehosseiniasl/multi-harness-training-routing branch 5 times, most recently from 0593faf to 874f27b Compare October 13, 2026 06:56
@terrykong terrykong added the CI:L1 Run doctests, unit tests, and functional tests label Nov 5, 2026
@ehosseiniasl
ehosseiniasl force-pushed the ehosseiniasl/multi-harness-training-routing branch from 83ca06a to b9167c3 Compare November 25, 2026 18:15
@ehosseiniasl ehosseiniasl changed the title feat(nemo-gym): add multi-harness fan-out training feat(nemo-gym): preserve multi-harness routing and pooled rollout metrics Nov 25, 2026
@ehosseiniasl

Copy link
Copy Markdown
Contributor Author

/ok to test b9167c3

@terrykong terrykong removed the Documentation Improvements or additions to documentation label Nov 28, 2026
Keep TORCH_SAVE tensors transient while preserving SAFETENSORS metadata and payloads. Apply the source-verified PyTorch fix during container environment construction using atomic replacements so uv hardlinks remain safe.

Validation: seven compatibility checks passed using the exact PyTorch 2.13 writer source with real Torch 2.9 CPU DCP, including tensor lifetime bounds, roundtrip and safetensors offsets. Native 2.13/2.14 runtime and a full container rebuild remain unverified.
Signed-off-by: ehosseiniasl <[email protected]>
Park configured BF16 optimizer moments during non-colocated accumulation and restore them after gradient finalization. Reuse logits for the joint sampled/head scoring backward only under the validated packed sole-consumer contract. Keep explicitly frozen expert biases frozen outside autograd.

Validation: focused CPU qualification passed84 cases covering real selected production methods with Gloo/autograd and resumed Adam state parity, plus the full timer suite. GPU-dependent whole-module and model-backed integration remain separate.
Signed-off-by: ehosseiniasl <[email protected]>
Reserve the longest observed iteration before the checkpoint deadline so uneven agentic batches do not exhaust the save window after a short-batch average. Keep the existing one-shot deadline signal and job-start epoch behavior.

Validation: full CPU timer suite passed, including deterministic long-then-short iteration deadline coverage, as part of84 passing focused checks.
Signed-off-by: ehosseiniasl <[email protected]>
@ehosseiniasl

Copy link
Copy Markdown
Contributor Author

/ok to test 4a03617

@svcnvidia-nemo-ci svcnvidia-nemo-ci added complexity:high Large or cross-cutting change. Set by Autobot PR classify (skills/pr-classify) convergence-risk:high Likely to change training results. Set by Autobot PR classify (skills/pr-classify) proof:functionality Needs proof that it works. Set by Autobot PR classify (skills/pr-classify) proof:convergence Needs convergence proof (W&B runs). Set by Autobot PR classify (skills/pr-classify) proof:perf Needs performance proof. Set by Autobot PR classify (skills/pr-classify) labels Dec 2, 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

CI:L1 Run doctests, unit tests, and functional tests complexity:high Large or cross-cutting change. Set by Autobot PR classify (skills/pr-classify) convergence-risk:high Likely to change training results. Set by Autobot PR classify (skills/pr-classify) proof:convergence Needs convergence proof (W&B runs). Set by Autobot PR classify (skills/pr-classify) proof:functionality Needs proof that it works. Set by Autobot PR classify (skills/pr-classify) proof:perf Needs performance proof. Set by Autobot PR classify (skills/pr-classify)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants