BytedTsinghua-SIA/DAPO: An Open-source RL System from ByteDance Seed and Tsinghua AIR · GitHub
Important
🔥 News!!!
- [2025/05] We replace the wandb training record of full DAPO and the checkpoint which achieved 50%+ on AIME 2024. We additionally present instructions for analysis on AIME 2024.
- [2025/03] We launch the coaching document of an early model of DAPO (w/o Token-level PG Loss & Dynamic Sampling), reaching 44% on AIME 2024, in wandb.
We launch a completely open-sourced system for large-scale LLM RL, together with algorithm, code utilities, and dataset. The system achieves state-of-the-art large-scale LLM RL efficiency. We suggest the Decoupled Clip and Dynamic sAmpling Policy Optimization (DAPO) algorithm.
Through open-sourcing, we offer the broader analysis group and society with sensible entry to scalable reinforcement studying, enabling all to profit from these developments. Our system relies on the superior verl framework. Thanks for his or her nice work!
🤗 If you may have any questions on our paper, points are welcomed and we may focus on there. Thank you!
🚀 DAPO achieves 50 factors on AIME 2024 based mostly on the Qwen2.5-32B base mannequin, outperforming the earlier SoTA DeepSeek-R1-Zero-Qwen-32B with 50% coaching steps.
-
Length stability and progress: The regular improve in response size permits for better exploration, facilitating the mannequin’s skill to be taught extra complicated reasoning behaviors, in the end contributing to coaching stability and efficiency enchancment.
-
Reward rating stability: A steady improve within the reward sign signifies that the mannequin is efficiently becoming the coaching distribution, making certain that the educational course of stays strong and constant with out important fluctuations.
-
Entropy and imply likelihood development: A managed improve in entropy, after an preliminary lower, ensures a wholesome steadiness between exploration and exploitation, avoiding points comparable to overfitting or extreme randomness, and selling sustained mannequin efficiency.
We present the mannequin weights of DAPO-Qwen-32B, which is skilled based mostly on Qwen2.5-32B utilizing the DAPO algorithm.
We suggest utilizing conda to setup the setting:
conda create -n dapo python=3.10
conda activate dapo
pip3 set up -r necessities.txt
We present the mannequin inference code right here:
import torch
from transformers import AutoTokenizer
from vllm import SamplingParams, LLM
examples = [
{
"question": "Solve the following math problem step by step. The last line of your response should be of the form Answer: $Answer (without quotes) where $Answer is the answer to the problem.nnFind the largest possible real part of [(75+117i)z+frac{96+144i}{z}]the place $z$ is a fancy quantity with $|z|=4$.nnRemember to place your reply by itself line after "Answer:".",
"reply": "540"
},
{
"query": "Solve the next math downside step-by-step. The final line of your response needs to be of the shape Answer: $Answer (with out quotes) the place $Answer is the reply to the issue.nnEvery morning Aya goes for a $9$-kilometer-long stroll and stops at a espresso store afterwards. When she walks at a continuing velocity of $s$ kilometers per hour, the stroll takes her 4 hours, together with $t$ minutes spent within the espresso store. When she walks $s+2$ kilometers per hour, the stroll takes her 2 hours and 24 minutes, together with $t$ minutes spent within the espresso store. Suppose Aya walks at $s+frac{1}{2}$ kilometers per hour. Find the variety of minutes the stroll takes her, together with the $t$ minutes spent within the espresso store.nnRemember to place your reply by itself line after "Answer:".",
"reply": "204"
},
{
"query": "Solve the next math downside step-by-step. The final line of your response needs to be of the shape Answer: $Answer (with out quotes) the place $Answer is the reply to the issue.nnLet $mathcal{B}$ be the set of rectangular packing containers with floor space $54$ and quantity $23$. Let $r$ be the radius of the smallest sphere that may include every of the oblong packing containers which can be components of $mathcal{B}$. The worth of $r^2$ may be written as $frac{p}{q}$, the place $p$ and $q$ are comparatively prime constructive integers. Find $p+q$.nnRemember to place your reply by itself line after "Answer:".",
"reply": "721"
}
]
def foremost():
mannequin = "BytedTsinghua-SIA/DAPO-Qwen-32B"
tokenzier = AutoTokenizer.from_pretrained(mannequin)
llm = LLM(
mannequin=mannequin,
dtype=torch.bfloat16,
tensor_parallel_size=8,
gpu_memory_utilization=0.95
)
sampling_params = SamplingParams(
temperature=1.0,
top_p=0.7,
max_tokens=20480
)
for instance in examples:
query = instance["question"]
reply = instance["answer"]
output = llm.generate(
prompts=tokenzier.apply_chat_template(dialog=[{"content": question, "role": "user"}],
add_generation_prompt=True,
tokenize=False),
sampling_params=sampling_params
)
print(f"***QUESTION***:n{query}n***GROUND TRUTH***:n{reply}n***MODEL OUTPUT***:n{output[0].outputs[0].textual content}n")
print("-"*100)
if __name__ == "__main__":
foremost()
To consider the mannequin on AIME 2024, we deploy DAPO-Qwen-32B with Ray Serve and vLLM.
To load the mannequin from Huggingface:
serve run eval.llm:build_app mannequin=BytedTsinghua-SIA/DAPO-Qwen-32B tensor-parallel-size=8
# open one other terminal
python eval/eval_aime24.py --temperature 1.0 --top_p 0.7 --max_tokens 20480 --model BytedTsinghua-SIA/DAPO-Qwen-32B --test_file eval/aime-2024.parquet
To load the mannequin from native path:
serve run eval.llm:build_app mannequin=aaa/bbb/ccc tensor-parallel-size=8
# open one other terminal
python eval/eval_aime24.py --temperature 1.0 --top_p 0.7 --max_tokens 20480 --model ccc --test_file eval/aime-2024.parquet
To profit the broader analysis group, we absolutely open-source the recipe of our RL coaching, together with algorithm particulars, dataset, and infrastructures.
We present coaching and validation datasets for DAPO coaching.
Training: DAPO-Math-17k, a rigorously curated and processed math dataset.
Validation: AIME 2024.
We present the out-of-the-box script for DAPO coaching replica. Quickstart and core code are talked about in README. These are scripts for:
Note:
-
The
DAPO w/o Token-level PG Loss & Dynamic Sampling -- AIME 44script has been verified on the present verl and achieves 44 factors on AIME 2024, whose coaching document may be accessed in wandb. -
The
DAPO Full -- AIME 50script has additionally been validated on the most recent verl model. It scores 50 factors on AIME 2024. You can view the corresponding coaching document on wandb.
We thank the verl for offering the superior open-source RL utilities.
Our open-sourced experiments have been performed on the Volcano Engine Machine Learning Platform. We will present a full replica guideline afterward the Volcano Engine platform to assist customers replicate our experiments.



