Repository navigation
feat(osworld): FlashREINFORCE B32/N4 OSWorld recipe on AgentENV - #5304
Conversation
Add loss_fn.is_correction_gating (ratio | binary_kl | tv). The divergence gates mask a whole segment when its mean sampled-token Bernoulli KL or total variation between the rollout and trainer policies exceeds truncated_importance_sampling_ratio, and accept GRPO as well as reinforce_baseline under forest training. Add actor_importance_sampling_ratio_min/max to bound the IS weight itself. Signed-off-by: Linglin Jing <[email protected]>
… Gym Stamp _ng_active_generation_indices on every row of a group attempt so a fork-capable environment can set the task up once and clone exactly the dispatched siblings, including on partial retries. Signed-off-by: Linglin Jing <[email protected]>
Add grpo_nemotron_omni_30ba3b_osworld_v2_flashreinforce_b32n4.yaml (Dr.GRPO, binary-KL gated token IS correction, 32 prompt groups x 4 same-state forks) and its --flashreinforce-b32n4 launcher flag, selected by OSWORLD_RECIPE. submit.sh gains the AgentENV provider (CA bundle, template weights), the canonical harness checksum check, and the frozen-evaluator inputs: the RLVR functions root and the evaluator tool rootfs with its wrappers. Signed-off-by: Linglin Jing <[email protected]>
Point 3rdparty/Gym-workspace/Gym at NVIDIA-NeMo/Gym#6458 (c9655871e), which adds the fork, canonical-harness and frozen-evaluator options the FlashREINFORCE recipe uses. Signed-off-by: Linglin Jing <[email protected]>
detect-secrets flags the sha256 pin in submit.sh as a high-entropy string. Signed-off-by: Linglin Jing <[email protected]>
A prompt group whose rollouts all lose their token capture is dropped by the finalizer without a replacement. With min_step_batch_fraction 1 that failed the run; 0.96875 lets that step train on the remaining 31 groups. dropped_prompt_groups records each such step. Signed-off-by: Linglin Jing <[email protected]>
When a token-capture group is dropped, either within the infra budget or by the finalizer, the short-step message now names the dataset index of its prompt, so repeated losses can be traced to the prompts they cluster on. Signed-off-by: Linglin Jing <[email protected]>
|
The new Reproduction using the source-extracted production loss on CPU, with three generated tokens: p = torch.linspace(0.01, 0.99, 99)[3] # rollout ≈ 0.04
q = p + 1e-6 # trainer ≈ 0.040001
# Repeat log(p) and log(q) across the three generated tokens.
# advantages=1, all tokens valid, force_on_policy_ratio=True
# is_correction_gating="binary_kl", gate bounds=[0, 0.01]Float64 KL is approximately Could we clamp finite KL values to nonnegative before gating, or apply only the upper bound for divergence gates, while preserving nonfinite-value rejection? Please add a near-identical-policy regression test; the current divergence tests miss this case. |
|
Could you explain the rationale for setting I reproduced this using the source-extracted production loss on CPU with one valid generated token: rollout_prob = 1e-12
trainer_prob = 0.001
# advantage=1, force_on_policy_ratio=True
# binary_kl gate=[0, 0.01], actor IS bounds=[0, 1e9]The importance ratio is approximately 1e9, while the implemented Bernoulli-KL statistic is approximately 0.000993, below the 0.01 threshold. The segment is retained ( The code also maps positive-infinite weights to |
|
Does the same-state guarantee extend to retries? The pinned Gym fork registry falls back to a fresh environment when a rollout’s original fork has already been claimed or expired. If one sibling fails after claiming its fork, its replacement can therefore run task setup again and start from a different state than the successful siblings. For this recipe’s same-state comparisons, should replacements be recreated from the original prepared snapshot? Alternatively, we could replace the whole group if that snapshot is unavailable. Could we clarify the intended behavior and add a recovery test covering failure after fork claim? This spans the RL recovery path and the Gym fork implementation. |
|
Could we correct the comment above |
|
Could we remove the change allowing sequence-level loss for forests from this PR and handle it in a separate PR? The FlashREINFORCE recipe uses The existing sequence-level reduction averages physical rows, which means segments in forest training. A rollout with three segments therefore receives three row contributions versus one for a rollout with one segment, even if both contain the same total number of generated tokens. This is a general objective change beyond OSWorld. A separate PR could define whether averaging should be per segment or per logical rollout, document that choice, and test loss/gradient weighting with unequal segment counts and lengths. |
Point 3rdparty/Gym-workspace/Gym at NVIDIA-NeMo/Gym#6458 (6f7223534), adding AgentENV osworld-v2 guest compatibility repairs, setup/postconfig command sanitization, pre-evaluation pointer centering, and the OSWORLD_PARSE_RETRIES override. Signed-off-by: Linglin Jing <[email protected]>
Set optimizer_offload_fraction to 1.0 (full CPU offload) in grpo_nemotron_omni_30ba3b_osworld_v2_flashreinforce_b32n4.yaml to avoid hybrid CPU/GPU optimizer drift over long RL runs. Signed-off-by: Linglin Jing <[email protected]>
…weights Address review feedback on seq-mask-tis divergence gating and forest objective validation: - Clamp finite per-token divergence gate stats to >= 0 before gating so float32 cancellation in binary_kl does not reject nearly identical policies, while still mapping non-finite valid tokens to +inf to drop the row. - Keep non-finite (NaN / +-inf) actor importance weights mapped to 0.0 instead of the clamp bounds when actor_importance_sampling_ratio_min/max are set. - Remove the sequence-level loss relaxation from validate_forest_objective so forest training remains token-level in this PR. - Add regression tests for near-identical binary_kl policies, non-finite divergence tokens, non-finite IS weights, and forest token_level_loss rejection. Signed-off-by: Linglin Jing <[email protected]>
…roup retry Address review feedback on the FlashREINFORCE OSWorld recipe: - Replace actor_importance_sampling_ratio_max=1e9 with a practical cap of 10.0 so isolated extreme rollout/trainer probability ratios are bounded independently of the mean Bernoulli-KL segment gate. - Set rollout_recovery.target_level=prompt_group so any sibling failure after fork claim retries the complete N=4 group under a fresh attempt and shared snapshot, and add a unit test verifying full active indices and incremented attempt on retry. - Clarify the comment above on_dropped_prompt: replace so it accurately describes rollout/transport drop replacement vs structural finalizer drops. Signed-off-by: Linglin Jing <[email protected]>
…le for PR #6458 - Rename NEMO_GYM_ACTIVE_GENERATION_INDICES_KEY to NEMO_GYM_GROUP_ROLLOUT_INDICES_KEY (_ng_group_rollout_indices) to match Gym's documented fork-group field name. - Update 3rdparty/Gym-workspace/Gym pin to 919536ec6 (NVIDIA-NeMo/Gym#6458 review fixes + bundled canonical prompt/parser/feedback). Signed-off-by: Linglin Jing <[email protected]>
|
Thanks @aroshanghias-nvd for the detailed review! All 5 review comments (plus the Gym field-name sync from NVIDIA-NeMo/Gym#6458) have been addressed in commits
Verification
|
|
Thanks, Linglin. I checked the fixes at
These were isolated CPU checks and source review, not the full unit suite or an end-to-end AgentENV/distributed training run. The remaining CI blockers on this head are:
Could you reconcile the dependency/submodule pins and complete the self-review gate? The fixes above address our reviewed concerns within the validation scope described. |
Summary
seq-mask-tis(loss_fn.is_correction_gating):ratio(default, the current geometric-mean IS-ratio gate),binary_kl(mean sampled-token Bernoulli KL between the rollout and trainer policies), ortv(mean sampled-token |p_rollout − p_trainer|). Withbinary_klortv, a segment is masked when its statistic exceedstruncated_importance_sampling_ratio; retained segments keep untruncated token-level IS weights. A non-finite divergence on a valid token masks the segment. The divergence gates requiretruncated_importance_sampling_type=seq-mask-tisandtruncated_importance_sampling_ratio_min <= 0.loss_fn.actor_importance_sampling_ratio_min/max: bounds on the generation-to-trainer IS weight itself. Non-finite weights map to the bounds instead of zero. Defaults (0.0,None) keep the current behavior.validate_forest_objective) also accepts GRPO orreinforce_baselinewith a divergence-gatedseq-mask-tis._ng_active_generation_indices: every row of a group attempt carries the rollout indices dispatched together in that attempt, including partial retries, so a fork-capable Gym environment can set the task up once and clone exactly those siblings.examples/nemo_gym/grpo_nemotron_omni_30ba3b_osworld_v2_flashreinforce_b32n4.yamlfor Nemotron Omni 30B-A3B, on top of the OSWorld v2 checkpoint profile:normalize_rewards: false,use_leave_one_out_baseline: false), no KL penalty, token-level loss.binary_klat 0.01, actor IS weight bounded to [0, 1e9],force_on_policy_ratio.optimizer_offload_fraction: 1.0); 8192 new tokens per turn, temperature 1.0, top_p 1.0, 49152-token window.min_step_batch_fraction: 0.96875lets that step train on the remaining 31 groups.dropped_prompt_groupsrecords the step, and the log names the dataset index of the lost prompt.launch_osworld_v2_cc.py --flashreinforce-b32n4, mutually exclusive with the other recipe flags.osworld_v2/*.shselect the recipe throughOSWORLD_RECIPE(molt-b8k8-checkpointby default, orflashreinforce-b32n4).submit.shadds the AgentENV provider: it builds a CA bundle (system roots plusAGENTENV_TLS_CA) and convertsAGENTENV_TEMPLATE_WEIGHTSfroma:1,b:1to a mapping.submit.sh, and the tool wrappers (osworld_v2/evaluator_tools/bin/) are mounted into/usr/local/bin.Verification
rl.nightly:tests/unit/algorithms/test_loss_functions.py,tests/unit/experience/test_rollout_manager.py,tests/unit/experience/test_rollouts.py,tests/unit/single_controller/test_logical_advantage.py: 478 passed, 47 skipped (GPU-only).tests/unit/test_config_validation.py(FlashREINFORCE recipe),tests/unit/single_controller/test_osworld_v2_recipe.pyandtest_single_controller_actor.py::test_a_lost_group_names_its_promptpass inrl.nightly.launch_osworld_v2_cc.py --flashreinforce-b32n4 --validate-only): resolves to 32 prompts x 4 generations,sampler=in_order,data_plane=transfer_queue; the OSWorld v2 checkpoint recipe still validates.Evaluation
Canonical 361-task OSWorld evaluation (
osworld-v2AgentENV template, 4 rollouts/task, temperature 0.6, top_p 0.95, 200 turns,OSWORLD_PARSE_RETRIES=8,OSWORLD_CONTEXT_PROMPT_TOKEN_LIMIT=null):iter881)step 108)(Final
step 200row will be updated once evaluation completes.)Dependency
Built on #4581 (the base branch), so this diff shows only the FlashREINFORCE changes. Needs NVIDIA-NeMo/Gym#6458.