Repository navigation
fix(sc): skip reference logprobs when KL is disabled - #3771
Merged
Merged
Conversation
Contributor
Author
|
/ok to test 77ad70a |
Signed-off-by: ruit <[email protected]>
With `loss_fn.reference_policy_kl_penalty == 0` the SC path builds no reference model, so SingleControllerActor skips the reference-logprob forward. When the config leaves `grpo.skip_reference_policy_logprobs_calculation` at its default false, nothing asked for that skip and nothing reported it -- the pass simply vanished. grpo.py, grpo_sync.py and ppo.py all print a notice in the equivalent situation; match them. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Signed-off-by: ruit <[email protected]>
RayenTian
force-pushed
the
ruit/v2_2672_refit_sc
branch
from
August 24, 2026 05:08
77ad70a to
68fffae
Compare
Contributor
Author
|
/ok to test 68fffae |
yuki-97
reviewed
Aug 24, 2026
The SC path gates both the reference model (setup._build_trainer) and the reference-logprob forward on `> 0`, but ClippedPGLossFn applies the KL term whenever the penalty is != 0. A negative penalty therefore made the loss read a reference_policy_logprobs column that was never written. Reject it at setup. With negatives rejected, the skip notice can key off `== 0` exactly, matching the message it prints. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Signed-off-by: ruit <[email protected]>
Contributor
Author
|
/ok to test e09f8db |
yuki-97
approved these changes
Aug 24, 2026
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?
Ports the still-applicable reference-policy logprob behavior from #2672 to the SingleController GRPO path (
examples/run_grpo_single_controller.py).When
loss_fn.reference_policy_kl_penalty == 0, SingleController now skips reference-policy logprob computation even whengrpo.skip_reference_policy_logprobs_calculationis left at its default value. This aligns the runtime decision with trainer setup, which does not initialize a reference model when the KL penalty is disabled.Scope note
This PR intentionally does not port the non-colocated refit changes from #2672 (
offload_before_refit()/prepare_for_training()). Those changes were reverted by #2794 because they caused a performance regression, so only the reference-logprob portion is migrated to SingleController.Testing
Related PRs