Skip to content

feat(osworld): OSWorld v2 SingleController training recipe - #4581

Open
jinglinglingling wants to merge 22 commits into
NVIDIA-NeMo:mainfrom
jinglinglingling:linglinj/flashreinforce-agentenv-osworld
Open

jinglinglingling wants to merge 22 commits into
NVIDIA-NeMo:mainfrom
jinglinglingling:linglinj/flashreinforce-agentenv-osworld

Conversation

@jinglinglingling

@jinglinglingling jinglinglingling commented Oct 8, 2026 •

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

What and why

This is the OSWorld v2 SingleController integration, stacked on bounded physical-row dispatch and packed-media broadcasts and Forest REINFORCE++ with owner action-token counts. Those two framework changes are reviewed independently against main.

The OSWorld layer adds the training, checkpoint and inference recipes, the launch and data-preparation tools, and the rollout handling they depend on: capture failures mask only the affected rollout, media-token masks come from authenticated embedding spans, and rows carry trajectory IDs and episode-end metrics. The Molt recipe uses the existing reinforce_plus_plus estimator with minus_baseline: true; it does not introduce a separate estimator.

Convergence / perf / functionality proof

  • On 9bcf9f5f3, 9 OSWorld recipe tests and 430 Gym capture, ingestion and media tests passed locally in the rl.nightly container with candidate Gym 91666f9; Ruff lint and formatting passed across the stack. These tests did not run distributed training or replace hosted CI.

  • Post-bump local checks used official Gym 91666f9: 47 A tests (two GPUs), 310 B tests passed with one inapplicable case skipped, and on the first integrated head e375e0835, all 9 OSWorld recipe plus 7 data-preparation cases passed. Hosted type checking then flagged the type of the resolved config; f4ae7c135 follows the SC entrypoint’s typed mapping convention. On f4ae7c135, the 9 OSWorld recipe tests passed again, and the launcher passed Pyrefly 1.4.0 (the preceding revision reproduced the original error under the same checker). Hosted CI on the earlier f4ae7c135 head passed. After integrating upstream Forest terminal attribution and row caps, the baseline is now b447d1b23: current hosted CI. Targeted local regression on published heads: b447d1b23: 352 capture/Forest boundary and ingestion cases, 8 rollout identity/task-index cases, 9 recipe cases and 7 data cases passed. Framework 9e4eefdcc: 310 passed, 1 skipped.

Earlier recipe verification

  • Unit tests (tests/unit, CPU lanes, container rl.nightly-20261116T1258): no failures beyond those on main in the same container. OSWorld recipe composition: 7 passed.
  • OSWorld training with grpo_nemotron_omni_30ba3b_osworld_v2_cc_molt_b8k8_checkpoint.yaml and the agent settings in examples/nemo_gym/osworld_v2/env.example: 4 x 8 H100, 8 prompts x 8 generations, 16 prompt groups in flight, 128 parallel OpenSandbox sandboxes, 64 steps, container rl.nightly-20261121T0937Z.

Earlier evaluation

  • Tasks: 361 OSWorld tasks (the OSWorld test set without the Google Drive tasks). Training uses the same 361 tasks, so this measures training progress on the training tasks, not held-out generalization. 29 of the 361 tasks are infeasible.
  • Scoring: four rollouts per task; accuracy is the mean over all rollouts, and pass@4 counts a task as solved if any rollout solves it. A rollout counts as solved only when the OSWorld evaluator returns 1.0.
  • Sampling: temperature 0.6, top_p 0.95, up to 4096 generated tokens per turn, up to 200 turns, AgentENV osworld-v1 sandboxes.
Model Accuracy, all 361 Accuracy, 332 feasible Pass@4, all 361 Mean step time
SFT (starting point) 43.63% 40.74% 64.54% (233/361) -
Baseline recipe, step 64 52.77% 50.15% 67.04% (242/361) 899 s

Needs upstream changes

The Gym bump has merged. The PR is rebased on RL main at d6c70efc3 and inherits its official Gym pin 91666f9, which contains benchmarks/osworld/configs/osworld_nemo_rl_opensandbox.yaml. There is no submodule or lockfile change in this PR. The two framework PRs linked above remain separate review dependencies. The earlier OSWorld Gym work was tracked in Gym #4209.

@copy-pr-bot

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

@jinglinglingling
jinglinglingling force-pushed the linglinj/flashreinforce-agentenv-osworld branch from ff3bffa to e970318 Compare October 8, 2026 01:49
@jinglinglingling jinglinglingling changed the title feat(osworld): add FlashREINFORCE AgentEnv training feat(osworld): add OSWorld v2 training stack Oct 8, 2026
@jinglinglingling jinglinglingling changed the title feat(osworld): add OSWorld v2 training stack feat(osworld): OSWorld v2 training stack Oct 8, 2026
@jinglinglingling
jinglinglingling force-pushed the linglinj/flashreinforce-agentenv-osworld branch from e970318 to fb8f729 Compare October 14, 2026 15:20
@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Oct 14, 2026
@jinglinglingling

jinglinglingling commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Rebase/validation update:

  • Rebased onto current main (f7f14b5396).
  • Updated Gym pin to the CI-clean rebased fix(automodel): unbreak L1 by adding the missing dpo model_save_format #4209 head (65c0560412).
  • Added exact processor-owned media-token masking and pinned the companion MBridge fix in fix(nemotron-omni): gate sound merge on audio inputs Megatron-Bridge#6458.
  • 4-node / 32-GPU OSWorld smoke Job 20192123 completed successfully (ExitCode=0:0): 8/8 rollout groups, 404 valid sequences, 1,098,500 valid tokens, old-policy logprobs, advantage, optimizer step, refit, and step_1 checkpoint all completed.
  • This sampled batch had all-zero rewards, so expected loss/grad norm were both 0.0; the full training control/data path nevertheless completed.
  • Checkpoint: /lustre/fs1/portfolios/coreai/projects/coreai_dlalgo_nemorl/users/linglinj/osworld-v2-integration/live-execution/results/osworld-v2-latest-mediamask-20261014T141414Z/checkpoints/step_1.

@github-actions

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: fb8f729 (PR #4581 from linglinj/flashreinforce-agentenv-osworld)

✅ Submodules that are properly updated:

Gym: ✅ PR branch is ahead of main branch (fast-forward)
Megatron-Bridge: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

@github-actions

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: 2d8584a (PR #4581 from linglinj/flashreinforce-agentenv-osworld)

✅ Submodules that are properly updated:

Gym: ✅ PR branch is ahead of main branch (fast-forward)
Megatron-Bridge: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

@github-actions

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: c499f19 (PR #4581 from linglinj/flashreinforce-agentenv-osworld)

✅ Submodules that are properly updated:

Gym: ✅ PR branch is ahead of main branch (fast-forward)
Megatron-Bridge: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

@terrykong terrykong added the CI:L1 Run doctests, unit tests, and functional tests label Nov 5, 2026
@jinglinglingling
jinglinglingling force-pushed the linglinj/flashreinforce-agentenv-osworld branch from 51b1740 to 7411feb Compare November 18, 2026 06:42
@jinglinglingling jinglinglingling changed the title feat(osworld): OSWorld v2 training stack feat(osworld): OSWorld v2 SingleController training recipe Nov 18, 2026
@jinglinglingling
jinglinglingling force-pushed the linglinj/flashreinforce-agentenv-osworld branch from 7411feb to 84ccb5a Compare November 18, 2026 10:52
@github-actions

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: 84ccb5a (PR #4581 from linglinj/flashreinforce-agentenv-osworld)

✅ Submodules that are properly updated:

Gym: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

@github-actions

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: 4f7e7da (PR #4581 from linglinj/flashreinforce-agentenv-osworld)

✅ Submodules that are properly updated:

Gym: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

@terrykong terrykong removed the Documentation Improvements or additions to documentation label Nov 28, 2026
@aroshanghias-nvd aroshanghias-nvd self-assigned this Nov 30, 2026
@aroshanghias-nvd

Copy link
Copy Markdown
Contributor

Could we reuse ReinforcePlusPlusAdvantageEstimator instead of adding a separate estimator? With minus_baseline=True and KL reward shaping disabled, it appears to implement the same group-mean baseline and global token-weighted normalization. The forest path could pass each rollout’s aggregated eligible action-token count through normalization_mask, while preserving the separate baseline-participation mask.

I checked 200 isolated CPU cases using the source-extracted implementations; the final masked advantages matched exactly. We’d still need the forest token-count plumbing and configuration guards, but is there another semantic difference that requires a separate class?

@aroshanghias-nvd

Copy link
Copy Markdown
Contributor

Could we validate the new physical-row limits against DP and microbatch alignment? _bounded_meta_partitions currently accepts any positive integer, but each partition must still satisfy the sharder’s constraints. For example, 40 rows with DP=8 works unsplit, but a limit of 30 produces 30+10 and fails DP divisibility. With static batching, DP=4, microbatch size=2, and limit=12 also fails because each rank receives 3 rows.

Could we reuse the existing alignment calculation to reject incompatible limits or choose aligned partitions? With an aligned input and partition size, the smaller final partition remains aligned too. A test using the real sharder would help—the current tests mock it and therefore miss these failures.

@aroshanghias-nvd

Copy link
Copy Markdown
Contributor

Linglin, could we split the general framework changes into their own focused PRs and stack the OSWorld integration on top? In particular, the physical-row dispatch limits and chunked packed-media broadcasts are useful beyond OSWorld and have independent correctness and testing requirements. The advantage-estimator/forest token-count changes would also be easier to review separately, incorporating the REINFORCE++ reuse discussion above. Keeping the OSWorld recipes and tooling here would make the scope and dependencies much clearer.

@jinglinglingling

Copy link
Copy Markdown
Contributor Author

Sounds good @aroshanghias-nvd — agreed that separating the general framework pieces will make each change much easier to review and verify independently.

We'll split this into focused PRs and link them back here:

  1. Physical-row dispatch limits & chunked packed-media broadcasts (with dedicated DP/microbatch-alignment and broadcast tests).
  2. Advantage-estimator / forest token-count support, incorporating the ReinforcePlusPlusAdvantageEstimator reuse feedback from above.
  3. OSWorld recipes, config, and cluster tooling kept here in feat(osworld): OSWorld v2 SingleController training recipe #4581 stacked on top of the framework PRs.

Will follow up here with links as each split PR is opened.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added 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
@jinglinglingling
jinglinglingling force-pushed the linglinj/flashreinforce-agentenv-osworld branch from 69d7690 to 9bcf9f5 Compare December 3, 2026 01:11
Partition SC train and logprob metadata before sharding, respecting DP and static microbatch alignment. Accumulate the partitions into the caller's existing train step and wait for each fanout before materializing more rows.

Signed-off-by: Linglin Jing <[email protected]>
Stage CPU packed data through a reusable collective-device buffer, and rebuild CUDA payloads on each follower's own device. Exercise chunk boundaries on the int16 byte wire for Gloo and NCCL.

Signed-off-by: Linglin Jing <[email protected]>
@jinglinglingling
jinglinglingling force-pushed the linglinj/flashreinforce-agentenv-osworld branch from 9bcf9f5 to e375e08 Compare December 4, 2026 01:43
@jinglinglingling

Copy link
Copy Markdown
Contributor Author

/ok to test e375e08

@jinglinglingling

Copy link
Copy Markdown
Contributor Author

/ok to test f4ae7c1

A rollout without any accepted captured generation is recorded as capture_no_accepted_generations and masked instead of failing the step.

Signed-off-by: Linglin Jing <[email protected]>
(cherry picked from commit 29b0855)
…ogical owners

Compute the group baseline from one finalized reward per participating owner. Weight global whitening by surviving action tokens, excluding late execution padding. Exercise both Forest penalty scopes through finalization, step padding, and advantage writeback.

Signed-off-by: Linglin Jing <[email protected]>
Signed-off-by: Linglin Jing <[email protected]>
(cherry picked from commit 4d9ff02)
Forest training builds the media-token validity mask from the verified embedding spans, so a media token id the model generates stays text.

Signed-off-by: Linglin Jing <[email protected]>
(cherry picked from commit 054298d)
Signed-off-by: Linglin Jing <[email protected]>
(cherry picked from commit 2c6dc86)
grpo.val_at_resume runs val_at_start on a restored checkpoint; checkpointing.load_optimizer=false restores policy weights without optimizer state.

Signed-off-by: Linglin Jing <[email protected]>
(cherry picked from commit 0740776)
Forest training recipe, checkpoint and evaluation profiles, Slurm launch scripts and data preparation for Nemotron Omni on OSWorld.

Signed-off-by: Linglin Jing <[email protected]>
(cherry picked from commit 64b5fbb)
OSWorld capture rows now carry a schema-1 trajectory_identity built from
the runtime rollout id, group id, rollout index, and group attempt, and
partial legacy context_compaction_* dataset fields are removed. The
identity follows rollout ids and attempts replaced on redispatch.

Signed-off-by: Linglin Jing <[email protected]>
(cherry picked from commit 924d7d9)
Gym's Nano Omni profile sends truncate_history_thinking=true per request,
which overrides the vLLM server default and strips reasoning from replayed
assistant turns. Pin the request value to the tokenizer's setting.

Signed-off-by: Linglin Jing <[email protected]>
(cherry picked from commit 573bc37)
The recipe now carries the OSWorld agent settings it trains with, so composing
it outside the Slurm scripts no longer falls back to the Gym profile's
defaults. The OSWORLD_* variables still override each value.

Signed-off-by: Linglin Jing <[email protected]>
(cherry picked from commit 0c00b3a)
…8 recipe

Signed-off-by: Linglin Jing <[email protected]>
(cherry picked from commit 69d7690)
@jinglinglingling
jinglinglingling force-pushed the linglinj/flashreinforce-agentenv-osworld branch from f4ae7c1 to b447d1b Compare December 4, 2026 09:28
@jinglinglingling

Copy link
Copy Markdown
Contributor Author

/ok to test b447d1b

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:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) 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.

4 participants