Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

GRPO kept-set refusals: drop the automatic-default wording (#15531)

Daniel Hanc8cef55dff29
diff --git a/tests/test_grpo_truncated_support_policy_gate.py b/tests/test_grpo_truncated_support_policy_gate.py
index 8c262d100fd..8728e516e59 100644
--- a/tests/test_grpo_truncated_support_policy_gate.py
+++ b/tests/test_grpo_truncated_support_policy_gate.py
@@ -162,7 +162,8 @@ def test_policies_with_their_own_kept_set_score_the_full_vocabulary(monkeypatch,
def test_refusals_do_not_claim_the_variable_was_set(monkeypatch):
- # zoo's automatic gate means refusals fire with the variable unset: never say "ignoring ...=1".
+ # An older zoo's automatic gate fires refusals with the variable unset: never say "ignoring ...=1",
+ # and name the variable without claiming a value or an automatic default.
monkeypatch.delenv("UNSLOTH_GRPO_TRUNCATED_SUPPORT", raising = False)
_, messages = _bind(monkeypatch, _trainer(beta = 0.04))
refuse = _refuse_helper(monkeypatch, _SUPPORT)
@@ -178,7 +179,7 @@ def test_refusals_do_not_claim_the_variable_was_set(monkeypatch):
assert message.startswith(
"Unsloth: not scoring over the rollouts' top_k / top_p / min_p kept set"
)
- assert "automatic" in message
+ assert "UNSLOTH_GRPO_TRUNCATED_SUPPORT" in message and "automatic" not in message
def _own_support_logps(logits, index, top_k):
diff --git a/unsloth/models/rl_replacements.py b/unsloth/models/rl_replacements.py
index 11101245a5d..f65aa00cdbc 100644
--- a/unsloth/models/rl_replacements.py
+++ b/unsloth/models/rl_replacements.py
@@ -1669,8 +1669,7 @@ def _unsloth_grpo_refuse_unscored_support(self):
import warnings
warnings.warn(
"Unsloth: not scoring over the rollouts' top_k / top_p / min_p kept set "
- "(UNSLOTH_GRPO_TRUNCATED_SUPPORT=1, or automatic for truncated vLLM rollouts "
- "feeding the IS correction or off-policy mask) because "
+ "(requested by UNSLOTH_GRPO_TRUNCATED_SUPPORT) because "
f"{', '.join(mismatch)}: the scored policy is not the sampler, so its top_k / top_p / "
"min_p kept set differs from vLLM's and the PPO ratio would be unnormalised. "
"Scoring over the full vocabulary instead.",
@@ -3553,7 +3552,7 @@ def grpo_trainer__get_per_token_logps_and_entropies(function_name, function):
**kwargs,
)
- # UNSLOTH_GRPO_TRUNCATED_SUPPORT (=1 or zoo's automatic gate): score over the rollout's
+ # UNSLOTH_GRPO_TRUNCATED_SUPPORT=1 (or an older zoo's automatic gate): score over the rollout's
# top_k / top_p / min_p kept set, matching vLLM's processed_logprobs. The zoo loss refuses to mix
# normalisations unless this marker says the old / ref logps were scored the same way.
try:
@@ -3568,8 +3567,7 @@ def grpo_trainer__get_per_token_logps_and_entropies(function_name, function):
import warnings
warnings.warn(
"Unsloth: not scoring over the rollouts' top_k / top_p / min_p kept set "
- "(UNSLOTH_GRPO_TRUNCATED_SUPPORT=1, or automatic for truncated vLLM "
- "rollouts feeding the IS correction or off-policy mask) because "
+ "(requested by UNSLOTH_GRPO_TRUNCATED_SUPPORT) because "
f"{', '.join(_support_mismatch)}: those logprobs come from weights other "
"than the rollout's, whose top_k / top_p / min_p kept set differs from the "
"sampler's, so per-policy kept sets give unnormalised PPO ratios and KL. "