Skip to content

Fix SDPO scale_rewards CLI parsing and warn on ignored feedback - #6341

Merged
sergiopaniego merged 5 commits into
mainfrom
fix-sdpo-scale-rewards-and-feedback-warning
Aug 21, 2026
Merged

sergiopaniego merged 5 commits into
mainfrom
fix-sdpo-scale-rewards-and-feedback-warning

Conversation

@sergiopaniego

@sergiopaniego sergiopaniego commented Jul 9, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Two small fixes to the experimental SDPO trainer, both covered by CPU tests.

  1. scale_rewards CLI parsing. SDPOConfig.scale_rewards was typed str | bool, which HfArgumentParser parses as a bool flag, so passing a string value like --scale_rewards group fails with Truthy value expected: got group. Typed it as str to match GRPOConfig.scale_rewards; __post_init__ still maps legacy True/False β†’ "group"/"none", so programmatic bool usage keeps working. (The sdpo.py example previously worked around this by subclassing the config.)

  2. Silent feedback footgun. include_environment_feedback defaults to False, which gates off all environment feedback. A dataset with a privileged_context column then looks wired up but is silently ignored (feedback_used_fraction=0, distillation loss stays 0). Added a one-time warning when feedback is present in a batch but the flag is False.

Tests: test_scale_rewards_accepts_string_via_cli, test_warns_when_feedback_available_but_disabled.

Fixes # (issue): n/a

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline, Pull Request section?
  • Was this discussed/approved via a GitHub issue?
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

AI writing disclosure

  • AI-assisted: some parts were suggested or improved by AI, but the PR was written and reviewed by a human.

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_rewards is now typed as str (matching GRPOConfig) so HfArgumentParser accepts CLI values like --scale_rewards batch instead of treating the field as a bool flag. __post_init__ still maps programmatic True/False to "group"/"none".

When a batch includes privileged_context but include_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.

- 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
sergiopaniego force-pushed the fix-sdpo-scale-rewards-and-feedback-warning branch from 0225223 to 960a974 Compare July 9, 2026 13:20
@sergiopaniego
sergiopaniego requested a review from kashif July 9, 2026 13:21
@bot-ci-comment

bot-ci-comment Bot commented Jul 9, 2026

Copy link
Copy Markdown

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.

sergiopaniego and others added 4 commits July 21, 2026 16:05
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.

@qgallouedec qgallouedec left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@sergiopaniego
sergiopaniego merged commit 3db2974 into main Aug 21, 2026
5 checks passed
@sergiopaniego
sergiopaniego deleted the fix-sdpo-scale-rewards-and-feedback-warning branch August 21, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants