feat(experimental): add DAPO training support - #486
Open
CharlesXu-HQ wants to merge 2 commits into
Open
Conversation
CharlesXu-HQ
force-pushed
the
feat/dapo
branch
from
August 15, 2026 05:37
d1ba75b to
ead49f4
Compare
CharlesXu-HQ
marked this pull request as ready for review
August 15, 2026 06:00
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 opt-in, experimental DAPO training support, following the DAPO paper and the maintained verl DAPO recipe.
The implementation includes:
n_samples, and reward/group cardinalityRelated issue
Fixes #485
A follow-up numerical clarification is documented in this issue comment: AReno's current on-policy surrogate has forward value
exp(new - new.detach()) = 1, which leaves Clip-Higher numerically inactive. This PR therefore keeps the real rollout-policy ratio scoped to experimental DAPO while leaving stable GRPO/GSPO behavior unchanged.Type of change
How was it tested?
Local CPU, static, and documentation validation:
python -m pytest tests/test_dapo_cpu.py tests/test_train_cli_config_cpu.py -q— 129 passedpython -m pytest tests/*_cpu.py -q— 492 passed, 11 skippedARENO_LOG_COMPLETIONS=1 python -m pytest tests/test_dapo_cpu.py::DAPODynamicSamplingTest::test_real_multi_prompt_generation_filters_and_truncates_whole_groups -q— passedruff check areno/experimental/dapo/trainer.py tests/test_dapo_cpu.py— passedpython -m py_compile areno/experimental/dapo/trainer.py tests/test_dapo_cpu.py— passedpython -m sphinx -W --keep-going -b html -D html_copy_source=0 docs <output>— 39 documents built without warningsgit diff --check— passedAlgorithm and data correctness coverage includes:
TrainSequence→ packed action tensor field alignmentsplit_data_pack_by_dploss/gradient equivalence for an uneven 3-to-2 splitn_samplesenforcement before prompt-group scoringReal-model validation
Environment: Python 3.12.13, PyTorch 2.11.0+cu128, CUDA 12.8, one NVIDIA GeForce RTX 5090. Source archive SHA-256:
f0f0278f8b83c14a545a58139a1066a4284d22db7d50f6fa873ce72ae7d8faf8(ead49f4).The following bounded Qwen3-0.6B run deliberately makes the first prompt group uninformative and the second informative, so it exercises filter → retry → train rather than only a direct training smoke:
{"prompt":"Continue this short sequence: 1, 2,"} {"prompt":"Name one primary color:"}Observed result (exit code 0):
gen_batches=1 generated_groups=1 qualified_groups=0 filtered_groups=1gen_batches=2 generated_groups=2 qualified_groups=1 filtered_groups=1dapo_sampling_efficiency=0.5,dapo_discarded_qualified_groups=0loss=2.3841858e-07,grad_norm=0.7063947ratio_mean=1.0000181,ratio_std=2.9320003e-05rollout_logprobs_mean=-0.00108719,train_logprobs_mean=-0.00106907The real-model run is a bounded integration test, not a convergence or benchmark reproduction. I did not run a paper-scale AIME experiment or a multi-GPU end-to-end training job; distributed response-token normalization is covered by hand-derived CPU references and tests that invoke the runtime's real DP split function.
Checklist
pytest tests/*_cpu.py).