Repository navigation
Fix SDPO scale_rewards CLI parsing and warn on ignored feedback - #6341
Merged
Merged
Conversation
- scale_rewards was typed `str | bool`, which HfArgumentParser parses as a bool
flag and rejects string values ("Truthy value expected: got group"). Type it
as `str` to match GRPOConfig; __post_init__ still maps legacy True/False.
- Warn once when a batch has `privileged_context` but
`include_environment_feedback=False` (default), so feedback is silently
ignored and distillation loss stays 0.
Add tests for both.
sergiopaniego
force-pushed
the
fix-sdpo-scale-rewards-and-feedback-warning
branch
from
July 9, 2026 13:20
0225223 to
960a974
Compare
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
Replaces the hand-rolled `_warned_feedback_ignored` flag: the accelerate logger already provides `warning_once`, as used in `bco_trainer.py`. Also hoists `HfArgumentParser` to the test module's top-level imports.
4 of 8 tasks
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?
Two small fixes to the experimental SDPO trainer, both covered by CPU tests.
scale_rewardsCLI parsing.SDPOConfig.scale_rewardswas typedstr | bool, whichHfArgumentParserparses as a bool flag, so passing a string value like--scale_rewards groupfails withTruthy value expected: got group. Typed it asstrto matchGRPOConfig.scale_rewards;__post_init__still maps legacyTrue/Falseβ"group"/"none", so programmatic bool usage keeps working. (Thesdpo.pyexample previously worked around this by subclassing the config.)Silent feedback footgun.
include_environment_feedbackdefaults toFalse, which gates off all environment feedback. A dataset with aprivileged_contextcolumn then looks wired up but is silently ignored (feedback_used_fraction=0, distillation loss stays0). Added a one-time warning when feedback is present in a batch but the flag isFalse.Tests:
test_scale_rewards_accepts_string_via_cli,test_warns_when_feedback_available_but_disabled.Fixes # (issue): n/a
Before submitting
AI writing disclosure
Note
Low Risk
Small experimental-trainer config/logging fixes with tests; no change to training math when flags are already set correctly.
Overview
Fixes two experimental SDPO footguns.
SDPOConfig.scale_rewardsis now typed asstr(matchingGRPOConfig) soHfArgumentParseraccepts CLI values like--scale_rewards batchinstead of treating the field as a bool flag.__post_init__still maps programmaticTrue/Falseto"group"/"none".When a batch includes
privileged_contextbutinclude_environment_feedback=False(the default), the trainer now emits a one-time warning that the feedback is ignored rather than failing silently.Reviewed by Cursor Bugbot for commit c53f641. Bugbot is set up for automated code reviews on this repo. Configure here.