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
Collaborator
|
@CharlesXu-HQ Please resolve merge conflicts |
CharlesXu-HQ
force-pushed
the
feat/dapo
branch
from
September 5, 2026 07:52
ead49f4 to
790995e
Compare
Author
|
Resolved — I rebased the branch onto current The conflict resolution adapts DAPO to the modular CUDA backend and canonical packed loss layout introduced by #493, propagates the current common trainer options, and rejects MLX at CLI preflight because DAPO is currently CUDA/Torch-only. Fresh validation on the rebased head:
GitHub now reports the PR as mergeable. |
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 cardinalityLatest-main integration
The branch is rebased onto upstream
mainat01b2321and adapted to the new backend architecture introduced by #493:areno.api.backend.cuda.trainingDAPOTrainerConfigRelated 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?
Fresh validation for rebased head
790995e:python -m pytest tests/test_dapo_cpu.py -q— 27 passedCUDA_VISIBLE_DEVICES= python -m pytest tests/test_train_cli_config_cpu.py -q -k dapo— 11 passed, 99 deselectedruff check areno/api/algorithms.py areno/api/backend/cuda/backend.py areno/api/backend/cuda/training.py areno/cli/train.py areno/experimental/dapo tests/test_dapo_cpu.py tests/test_train_cli_config_cpu.py— passedruff format --check ...on the same changed Python paths — passedpython -m compileall -q areno/experimental/dapo areno/api/backend/cuda areno/cli/train.py— passedpython -m sphinx -W --keep-going -b html -D html_copy_source=0 docs <output>— 46 documents built without warningsTORCH_CUDA_ARCH_LIST=12.0 MAX_JOBS=2 python setup.py build_ext --inplace— all 12 extension units compiled and linked forsm_120git diff --check— passedAlgorithm and data correctness coverage includes:
TrainSequence→ canonical packed action tensor field alignmentsplit_data_pack_by_dploss/gradient equivalence for an uneven 3-to-2 splitn_samplesenforcement before prompt-group scoringThe full CPU suite is designed for the CPU-only GitHub matrix. In the available CUDA PyTorch environment, installing Triton makes three untouched upstream MoE CPU tests run instead of skip; they fail because their
SimpleNamespacefixtures do not contain the newly requiredrouting_layer_slot. With CUDA hidden, the run reached 586 passed and 8 skipped before those 3 unrelated failures, then was stopped at a blocked Hugging Face download. None of the reported failing files are changed by this PR.Real-model validation
Environment: Python 3.12.13, PyTorch 2.11.0+cu128, CUDA 12.8, one NVIDIA GeForce RTX 5090. Exact source archive SHA-256:
529f91bb4c6b5d7b3ee7e26ef45f2d4f2ca8fd27c7d97779cf2efc25529ff15e(790995e).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=1.4305115e-06,grad_norm=0.6675834ratio_mean=1.0000181,ratio_std=2.9320003e-05rollout_logprobs_mean=-0.00108719,train_logprobs_mean=-0.00107050The 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/ -k cpu); the clean CPU-only GitHub matrix is the authoritative full-suite run.