Repository navigation
Conversation
…apture grpo.invalid_tool_call_advantage and grpo.malformed_thinking_advantage were rejected with token capture because the finalizer emitted no invalid_tool_call_mask / malformed_thinking_mask. Setup now asks Gym to record each call's last served output item in the capture ledger (token_id_capture.record_last_output_item), and the finalizer runs the echo path's detector, with env.nemo_gym's patterns and tags, on each call of the terminal chain. It writes both masks over that call's generated tokens and logs finalize/invalid_tool_call_rate and finalize/malformed_thinking_rate. A chain call without a recorded item rejects the rollout. Forest keeps its own guard. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
Gym 5911d628c plus the commit that adds token_id_capture.record_last_output_item. Move the pin to a Gym main commit after that change merges. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
7 tasks done
Main gained #4776, which adds a thinking_tags argument to RolloutReassembler and RolloutReassemblerActorConfig for the malformed think-tag reward penalty. This branch added an argument with the same name for the message-level detector, and the auto-merge kept both. Both resolve to env.nemo_gym.thinking_tags or the default, so one argument now serves both checks: setup sets it when the think-tag penalty or a message-level penalty is on. Other conflicts: _spinup_gym keeps main's rollout-recovery arguments, and the single-controller guide keeps main's reflowed text and drops its "remain unsupported with capture" sentence for the new paragraph. Also: - Pin Gym to c3e5931262, NVIDIA-NeMo/Gym#5447 merged with Gym main. It descends from main's pin 9e2e5d0ad0, and Gym's dependencies and version did not change, so uv.lock stays valid. - Every check reads the active algorithm block, so PPO gets the same support. Add a PPO validation test, and name both blocks in the guide. - Shorten three in-function comments to two lines. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
…pin Gym Review fixes for message-level advantage penalties under token capture. - Gym pin: e70909a30e, Gym #5447 with the Chat think-block fix. Calls through /v1/chat/completions no longer get false malformed_thinking flags. - Metrics: ordinary capture rows publish num_assistant_messages, num_invalid_tool_calls and num_malformed_thinking in the row tags, as the echo path does. The controller then pools invalid_tool_call_rate and malformed_thinking_rate per step. The per-group finalize/ rates are gone. - message_level_advantage_penalties_enabled moves to config.py as the one check that setup, the validator and the advantage stage use. - Tests: setup passes the penalties to the partitions, Gym and the finalizers; the actor forwards the detector settings; the masks test uses non-default tags and patterns. - Docs: the rates are pooled per step, and turning on an override when resuming from a checkpoint saved without it is not supported. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
Brings in #5290 (test-only, no overlap with this PR). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
Gym 4a47e2086 is e70909a30e merged with Gym main a57f9cd437, which now has #5771 (allow_system_suffix, Messages harnesses under source-history capture). It descends from RL main's Gym pin 9e2e5d0ad0. #5771 closed the Messages gap, so a Messages request is no longer refused with 422. Drop that case from test_existing_framework_capture_protocol_gap. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do ?
This PR lets
grpo.malformed_thinking_advantageandgrpo.invalid_tool_call_advantagerun with token capture. Today setup rejects them, because the capture finalizer writes nomalformed_thinking_maskorinvalid_tool_call_mask.How it works:
token_id_capture.record_last_output_item, added in feat(capture): opt-in last output item on ordinary capture rows Gym#5447). Setup asks only when one of the two penalties is set, so other runs send Gym the same configuration as before.RolloutReassembler) runs the echo path's detector,_detect_invalid_tool_call_and_malformed_thinking, on that item for each call of the terminal chain. It uses the sameenv.nemo_gym.invalid_tool_call_patternsandenv.nemo_gym.thinking_tagsas the echo path. Forest already uses this detector onlast_output_item.finalize/invalid_tool_call_rateandfinalize/malformed_thinking_rate, the capture versions of the echo path'sinvalid_tool_call_rateandmalformed_thinking_rate.missing_last_output_item, so the penalty never turns off without a sign.validate_forest_objective).This PR pins the Gym submodule to the Gym PR's head, which is the current pin
5911d628cplus that one commit. After the Gym PR merges, the pin must move to a Gymmaincommit.Overlap with #4776: #4776 adds a
thinking_tagsargument toRolloutReassemblerfor the malformed think-tag reward penalty. Both come fromenv.nemo_gym.thinking_tags, so the second PR to merge can use one argument for both. I tested the two PRs together (see Testing).Issues
Removes the guard and its
TODO(token-capture)insingle_controller_utils/config.py.Usage
Testing
test_finalize_group_masks_flagged_calls_from_last_output_items: one call leaks a thinking tag and one writes a tool call as text. Each mask covers exactly that call's generated tokens, and a placeholder row has no flags.test_finalize_rollout_rejects_a_chain_call_without_last_output_item.test_spinup_asks_gym_for_last_output_items_only_when_requested: validates the generated Gym configuration with Gym'sTokenIdCaptureConfig.test_token_capture_allows_message_level_advantage_penaltiesreplaces the test of the removed guard.tests/unit/single_controller,tests/unit/experience,tests/unit/data_plane,tests/unit/algorithms/test_grpo.py: 3,959 passed, 24 skipped.tests/unit/experience,tests/unit/data_plane,tests/unit/single_controller,tests/unit/environments/test_nemo_gym_utils.py: 705 passed, 4 skipped. Three tests error in the setup ofnemo_gym_vllm_generation, which starts vLLM and Gym servers. That setup times out after 300 s on my workstation:test_async_nemo_gym_rollout_manager,test_async_nemo_gym_rollout_manager_matches_originalandtest_run_async_nemo_gym_rollout.pyrefly, which needs the submodules that my local worktree does not have.grpo.malformed_thinking_advantage: -5.0, on 32 GB200 nodes. The code was main6e68b179+ fix(sc): SWE PPO fixes for token capture and Megatron critic memory #4776 + this PR + the one-line routed-expert fix from fix(vllm): router replay for MoE models with >255 experts #4543, with Gym5911d628c+ feat(capture): opt-in last output item on ordinary capture rows Gym#5447.last_output_item.finalize/malformed_thinking_ratewas 0.001, 0.0005 and 0.0005 at steps 3, 8 and 10, and 0 at the other steps.finalize/invalid_tool_call_ratewas 0.finalize/invalid_row_ratewas 0 at every step, so no rollout was rejected asmissing_last_output_item.token_mult_prob_error(1.013-1.015) andgen_kl_error(0.0012-0.0015) matched the same recipe without capture.num_workers: 8). An earlier run with the default 1 worker lost 24% and 39% of its rows in steps 1 and 2 to manifest request timeouts.Before your PR is "Ready for review"
Pre checks:
Additional Information
Draft until the Gym PR merges.
🤖 Generated with Claude Code