feat: add DAPO asymmetric GRPO clipping - #50
Closed
0z5a wants to merge 1 commit into
Closed
Conversation
Collaborator
Author
|
Superseded by #58, which preserves the same Clip-Higher configuration and compatibility tests while adding token/sequence aggregation, overlong shaping, and the complete L20/InfraSWE evidence. Keeping one review target avoids reviewing duplicate objective code. The commit and discussion here remain in history. |
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.
Summary
clip_eps=0.2behavior when the new options are unset--grpo_clip_eps_lowand--grpo_clip_eps_highthrough CLI/YAML configuration0.20/0.28exampleObjective
The importance-ratio clamp becomes:
Setting both values to
0.2is exactly the previous GRPO objective. Settingclip_eps_low=0.2andclip_eps_high=0.28selects the Clip-Higher component described in the DAPO technical report, without implicitly enabling DAPO's separate dynamic-sampling, token-aggregation, or overlong-reward components.L20 microbenchmark
Exact implementation on NVIDIA L20 (SM89), PyTorch 2.11.0+cu128, CUDA 12.8. One loss vector contains 1,048,576 FP32 token ratios/advantages; 30 warmups, then A-B-B-A with 20 samples per path and 100 iterations per sample.
0.20/0.200.20/0.28The −0.8% median difference is measurement noise: both paths launch the same operations and differ only in clamp constants. The feature adds no new tensor pass to the GRPO loss hot path.
Validation
CUDA_VISIBLE_DEVICES=5 bash scripts/pre_commit.sh --skip-deps: 655 passed