feat: add SAPO loss variant#2464
Draft
pengdurice wants to merge 1 commit into
Draft
Conversation
Signed-off-by: pengdurice <pengduhit@gmail.com>
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 ?
Add SAPO loss and test cases
Issues
#1677
Usage
In your GRPO yaml file, add the following
Reproduction recipe — Qwen3-30B-A3B (Megatron + vLLM, 2×8 H200)
Three arms sharing every hyperparameter except the loss. Follows the existing
tests/test_suites/llm/<name>.sh↔examples/configs/recipes/llm/<name>.yamlconvention.(sapo_enabled, τ_pos, τ_neg)sapo-baseline(False, –, –)sapo-asym(True, 1.0, 1.05)sapo-symm(True, 1.0, 1.0)Files added:
All three arms inherit: Megatron TP=2 × EP=8, vLLM TP=4 colocated, 32 prompts × 16 generations = 512 trajectories per step,
train_global_batch_size=128→ 4 mini-batches per rollout (matches GSPO §5.1 off-policy regime), KL β=0, temperature 1.0, seq=4096.Empirical results (200 steps, math env, 2×8 H200)
Three confirmations of paper claims: (1) SAPO asym wins on validation, (2) GRPO drifts off-policy while SAPO stays on-policy (the mechanism), (3) asymmetric τ > symmetric τ (Fig. 5 ordering). Magnitude is smaller than the paper's because our setting (Instruct + frozen router) is friendlier to GRPO than the paper's (Base + cold-start SFT, no routing replay).
Checklist
(sapo_enabled, sapo_tau_pos, sapo_tau_neg); YAML inheritance verified.Before your PR is "Ready for review"
Pre checks:
Additional Information