fix(orchestrator): use raw reward for singleton MaxRL groups#2985
Open
morluto wants to merge 1 commit into
Open
fix(orchestrator): use raw reward for singleton MaxRL groups#2985morluto wants to merge 1 commit into
morluto wants to merge 1 commit into
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Summary
MaxRL currently assigns zero advantage to every singleton rollout. Because
group_sizedefaults to 1, the default MaxRL configuration produces nopolicy-gradient signal.
Use the raw reward for singleton groups so the order-1 estimator recovers
REINFORCE. The existing mean-normalized estimator remains unchanged for larger
groups.
Problem
For groups larger than one, MaxRL computes:
Applying this control variate to a singleton success gives:
A singleton failure also receives zero. As a result, all singleton rollouts
carry zero policy-gradient weight and are removed by the default post-batch
zero-advantage filter.
The MaxRL paper defines$T=1$ as standard
RL. For a single rollout, that requires retaining its reward-weighted score
rather than centering it against itself.
Fix
advantage = rewardwhen a MaxRL group contains one rollout.This changes
[1] -> [0]to[1] -> [1], while existing multi-rollout behaviorsuch as
[1, 0, 0, 0] -> [3, -1, -1, -1]remains unchanged.Verification
test_max_rl_singleton_uses_reward_as_reinforce_advantage.MaxRLAlgorithm.score_grouppath directly withCPU-only PyTorch for singleton success, singleton failure, mixed-reward
groups, and all-success groups.
ruff checkpassed.ruff format --checkpassed.git diff --checkpassed.Related
Follow-up to #2778.
Note
Low Risk
Localized change to MaxRL credit assignment with regression tests; default MaxRL configs gain non-zero PG signal on successes where they previously had none.
Overview
MaxRL no longer assigns zero advantage to every
group_size = 1rollout.MaxRLAlgorithm.score_groupnow sets advantage = raw reward when the group has a single rollout, so the order-1 estimator matches REINFORCE instead of self-centering to zero.For groups larger than one, behavior is unchanged:
(reward − group mean) / group mean, with zero advantages when the group mean is ≤ 0.Docs and
MaxRLAlgoConfigdescribe the singleton exception (vs GRPO-stylegroup_size = 1zeroing). A unit test covers singleton success and failure.Reviewed by Cursor Bugbot for commit 701998c. Bugbot is set up for automated code reviews on this repo. Configure here.