feat(experimental): add Dr. GRPO - #484
Open
CharlesXu-HQ wants to merge 1 commit into
Open
Conversation
xsuler
self-requested a review
August 14, 2026 18:40
Collaborator
|
@CharlesXu-HQ Thanks for your contribution, I will give this implementation a full test, after that your pr will be merged. |
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?
Adds Dr. GRPO as an opt-in experimental policy-training algorithm, following Understanding R1-Zero-Like Training: A Critical Perspective.
The implementation keeps AReno's existing rollout and policy-only training flow while applying the two Dr. GRPO objective changes:
reward - group_mean, without standard-deviation normalization;num_sequences * max_completion_lengthinstead of the number of sampled response tokens.The change also:
drgrpolazily underareno.experimentaland keeps it out of the stable algorithm listing;PolicyOnlyTrainer;grpo_clip_epsandmax_new_tokensto the experimental loss;Existing GRPO behavior and defaults are unchanged. Users opt in with
--algo drgrpo.Related issue
Fixes #483
Type of change
How was it tested?
Local static and CPU validation on the final rebased commit:
Result:
474 passed, 11 skipped, with 12 existing FastAPI deprecation warnings.Result: all checks passed; 267 files were already formatted.
The new CPU coverage includes:
Target-side validation used the final commit with Qwen3-0.6B, PyTorch 2.9.1+cu130, native attention, TP 1, world size 1, four samples per prompt, mini-batch size 2, gradient accumulation 2, and 64 generated tokens:
tests/test_drgrpo_cpu.py:21 passed;2.4697, 6.2598, 2.8107, 5.6674, 7.0344;Hardware limitation: GPU validation was single-device only (one NVIDIA RTX 5090). Multi-GPU CUDA execution was not available; DP denominator/scaling behavior is covered by deterministic CPU tests, including uneven real pack sharding.
Checklist
pytest tests/ -k cpu).