Repository navigation
Turn off Dr GRPO reward scaling under TRL's "group" default - #11951
Conversation
The dr_grpo check only overrode scale_rewards == True. TRL 0.22 made "group" the default and documents it as the same setting as True, so a plain GRPOConfig(loss_type="dr_grpo") kept dividing advantages by the per-group std. Match "group" too, and fix the hint: None keeps scaling.
|
Confirmed that main in unsloth/models/rl.py only overrides scale_rewards when it is True, so the default "group" leaves Dr GRPO still dividing by the reward std. Will get this reviewed. |
|
Review record for #11951, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#123. Findings are quoted as posted and attributed to the account that posted them. The reactions shown are the triage recorded on the mirror; none were re-applied here. Commits are named as the mirror's, with this PR's equivalent where one was found. Round 1: reviewed mirror
|
…i#11951) * Turn off Dr GRPO reward scaling under TRL's "group" default The dr_grpo check only overrode scale_rewards == True. TRL 0.22 made "group" the default and documents it as the same setting as True, so a plain GRPOConfig(loss_type="dr_grpo") kept dividing advantages by the per-group std. Match "group" too, and fix the hint: None keeps scaling. * Trim Dr GRPO comments and drop unreachable scale_rewards skip --------- Co-authored-by: Daniel Han <[email protected]>
GRPOConfig(loss_type="dr_grpo")still divides advantages by the per-group reward std, which is the step Dr GRPO removes.Unsloth's generated config overrides
scale_rewardsto False for dr_grpo, but only when it equalsTrue. Since TRL 0.22 the default is"group", which TRL documents as the same setting asTrue, so the override never fires on the default. PassingTruegives'none'while the identical"group"gives'group'.The fix matches
"group"as well. An explicit"batch"is left alone, and the hint now saysNonekeeps scaling, which is what that branch does.Before, on main with TRL 1.9.2: default gives
'group'. After:'none'.Added a case to
tests/version_compat/test_trl_loss_normalization_contract.py: that file goes from 1 failed, 11 passed before the fix to 12 passed after.test_trl_grpo_fake_run.pyandtest_rl_config_compat.py: 35 passed, 1 skipped. Pinned ruff is clean.