This is code repo for paper DUMP: Automated Distribution-Level Curriculum Learning for RL-based LLM Post-training
DUMP is a plug-and-play curriculum learning module for RL-based LLM post-training.
It automatically prioritizes data distributions that are most beneficial for learningβ
based on live advantage signals from your modelβand schedules them using a bandit-based UCB strategy.
π§ If you're training LLMs with PPO / GRPO / RLHF on a mixture of training data from diverse distributions and difficulties, DUMP will:
π Effectiveness of DUMP on the K&K puzzle dataset mixed with 12 distributions defined by the number of characters in each puzzle. DUMP consistently achieves higher answer reward on test dataset compared to baseline:
The project builds upon and integrates several existing components:
Follow these steps to set up the environment:
# Create and activate conda environment
conda create -n dump python=3.9
conda activate dump
# Clone the repository
git clone https://github.com/ZhentingWang/DUMP.git
cd DUMP
# Install PyTorch
pip install torch==2.4.0 --index-url https://download.pytorch.org/whl/cu121
# Install vllm and ray
pip3 install vllm==0.5.4 ray
# Install flash-attention
pip3 install flash-attn --no-build-isolation
# Install project dependencies
pip install -e . # For verl integration
# Install additional tools
pip install wandb IPython matplotlib
pip install tensordict==0.5.0
pip install scipy
Before using the project, you need to authenticate with Weights & Biases (for experiment tracking) and Hugging Face (for model uploading):
# Install wandb if you haven't already
pip install wandb
# Log in to wandb
wandb login
# Follow the instructions to enter your API key
You can find your Wandb API key in your Wandb account settings.
# Install huggingface_hub if you haven't already
pip install huggingface_hub
# Log in to Hugging Face
huggingface-cli login
# Follow the instructions to enter your token
You can find or create your Hugging Face token in your Hugging Face account settings.
The training scripts automatically use these credentials for:
trainer.hf_account)Important: Before running the training scripts, you need to modify the trainer.hf_account parameter in the .sh files from xxx to your own Hugging Face username. For example:
# Change this line in the training scripts
trainer.hf_account=xxx # Change to your Hugging Face username
Knights and Knaves puzzles are classic logical reasoning problems where:
The project uses K&K puzzles of varying complexity (from 3 to 14 people) to train and evaluate LLMs' logical reasoning capabilities.
combinedkk.sh) - Custom implementation focus of this projectcombinedkk_nocl.sh) - For comparative evaluationThe project includes two primary training scripts:
conda activate dump
./main_grpo_Qwen2.5-7B-Instruct-1M_combined_logic_longseq_combinedkk.sh
conda activate dump
./main_grpo_Qwen2.5-7B-Instruct-1M_combined_logic_longseq_combinedkk_nocl.sh
Important: Before running these scripts, remember to modify the trainer.hf_account parameter in the scripts from xxx to your own Hugging Face username to enable model uploading.
The dataset generation process is optional, you can directly use our generated data located in ./combined_logic_dataset/generate_combined_kk. The dataset generation process consists of the following steps:
Generate K&K puzzles:
cd kk
conda env create -f environment.yml
conda activate kk
cd ..
python kk/data_prep/data_gen_kk.py
This generates various Knights and Knaves puzzles in JSONL format.
Move generated files to combined_logic_dataset:
# Move all generated JSONL files to the appropriate directory
mv data/*/clean/*.jsonl combined_logic_dataset/kk/
Generate combined dataset:
# Run the dataset combiner in background
conda activate dump
nohup python ./combined_logic_dataset/generate_combined_kk.py --local_dir ./combined_logic_dataset/generate_combined_kk > generate_combined_kk.log 2>&1 &
This processes the JSONL files into parquet files with carefully formatted prompts suitable for instruction-tuned models.
βββ verl/ # Reinforcement learning framework (external dependency with modifications)
β βββ trainer/ # RL training implementation
β βββ ...
βββ kk/ # Knights and Knaves utilities
β βββ data_prep/ # Data preparation utilities
β β βββ data_gen_kk.py # Main data generation script used in this project
β βββ ... # Other utilities (not directly used)
βββ combined_logic_dataset/ # Combined dataset generation
β βββ kk/ # Location for generated KK dataset files
β βββ generate_combined_kk/ # Output directory for processed datasets
β βββ generate_combined_kk.py # Dataset combination script
βββ main_grpo_*.sh # Training scripts
Environment Preparation: Refer to Installation and Service Authentication.
Generate K&K dataset (Optional):
cd kk
conda env create -f environment.yml
conda activate kk
cd ..
python ./kk/data_prep/data_gen_kk.py
Move generated files (Optional):
mv data/train/clean/*.jsonl combined_logic_dataset/kk/
Generate combined dataset (Optional):
conda activate dump
nohup python ./combined_logic_dataset/generate_combined_kk.py --local_dir ./combined_logic_dataset/generate_combined_kk > generate_combined_kk.log 2>&1 &
Running experiments:
trainer.hf_account=xxx parameter in the .sh files to your own Hugging Face username../combined_logic_dataset/generate_combined_kk/.Start training with DUMP curriculum learning:
conda activate dump
./main_grpo_Qwen2.5-7B-Instruct-1M_combined_logic_longseq_combinedkk.sh
Start training without DUMP curriculum learning (for comparison):
conda activate dump
./main_grpo_Qwen2.5-7B-Instruct-1M_combined_logic_longseq_combinedkk_nocl.sh
The main contribution of this project is the implementation of curriculum learning strategies in the verl reinforcement learning framework. The curriculum learning approach enables more effective training by:
data_source_key parameter to identify different data sourcesOur implementation in verl/utils/curriculum_learning.py provides a robust framework for distribution-level curriculum learning in RL-based LLM training. The system dynamically adjusts sampling probabilities to focus on distributions with the highest learning potential.
The LearnabilityEstimator tracks performance metrics for individual data distributions:
@dataclass
class LearnabilityEstimator:
"""Learnability estimator for curriculum learning."""
# Beta distribution parameters (for reward modeling)
alpha: float = 1.0
beta: float = 1.0
# Normal distribution parameters (for advantage function modeling)
mu: float = 0.0
# Additional statistics
n_samples: int = 0
total_reward: float = 0.0
# Sliding window for recent performance tracking
window_size: int = 300 # sliding window size
recent_rewards: List[float] = field(default_factory=list)
recent_advantages: List[float] = field(default_factory=list)
The CurriculumController manages multiple estimators and computes optimal sampling weights:
def compute_sampling_weights(self) -> Dict[str, float]:
"""Compute sampling weights for each data source."""
stats = self.get_source_stats()
# Calculate UCB scores for each source
base_scores = []
source_to_index = {}
# Calculate total samples across all sources
total_samples = sum(stat['n_samples'] for stat in stats.values())
total_samples = max(1, total_samples) # Avoid division by zero
for i, source in enumerate(self.data_sources):
source_to_index[source] = i
stat = stats[source]
# Weight parameters
uncertainty_weight = 1.0 # uncertainty term weight
exploration_weight = 1.0 # exploration term weight
# Base UCB score using the advantage mean
ucb_score = stat['advantage_mean']
# Add exploration bonus (more exploration for less sampled sources)
exploration_bonus = exploration_weight * np.sqrt(
2 * np.log(total_samples + 1) / (stat['n_samples'] + 1)
)
ucb_score += exploration_bonus
base_scores.append(ucb_score)
advantage_mean serves as the exploitation term, prioritizing distributions with higher potential gainsThe CurriculumSampler implements the actual sampling logic:
class CurriculumSampler:
"""Sampler that implements curriculum learning based on task difficulty."""
def __init__(self,
dataset,
data_source_key: str = 'data_source',
batch_size: int = 1,
seed: Optional[int] = None):
Data Source Identification: Training data is tagged with a data_source_key to identify different distributions.
Performance Tracking: During training, the system tracks:
Dynamic Weight Adjustment: The UCB-based algorithm adjusts sampling weights to:
Robust Sampling: The sampler handles practical implementation challenges like:
This implementation realizes the theoretical framework proposed in our paper, creating a principled approach to curriculum learning that adapts to the model's changing capabilities during training.
https://github.com/volcengine/verl
https://github.com/AlphaPav/mem-kk-logic
https://github.com/Unakar/Logic-RL
If you find this project useful, please consider citing our paper:
@article{wang2025dump,
title={DUMP: Automated Distribution-Level Curriculum Learning for RL-based LLM Post-training},
author={Wang, Zhenting and Cui, Guofeng and Wan, Kun and Zhao, Wentian},
journal={arXiv preprint arXiv:2504.09710},
year={2025}
}
32 commits
Python
97.4%
Shell
1.6%
Jupyter Notebook
1.0%
This is code repo for paper DUMP: Automated Distribution-Level Curriculum Learning for RL-based LLM Post-training
DUMP is a plug-and-play curriculum learning module for RL-based LLM post-training.
It automatically prioritizes data distributions that are most beneficial for learningβ
based on live advantage signals from your modelβand schedules them using a bandit-based UCB strategy.
π§ If you're training LLMs with PPO / GRPO / RLHF on a mixture of training data from diverse distributions and difficulties, DUMP will:
π Effectiveness of DUMP on the K&K puzzle dataset mixed with 12 distributions defined by the number of characters in each puzzle. DUMP consistently achieves higher answer reward on test dataset compared to baseline:
The project builds upon and integrates several existing components:
Follow these steps to set up the environment:
# Create and activate conda environment
conda create -n dump python=3.9
conda activate dump
# Clone the repository
git clone https://github.com/ZhentingWang/DUMP.git
cd DUMP
# Install PyTorch
pip install torch==2.4.0 --index-url https://download.pytorch.org/whl/cu121
# Install vllm and ray
pip3 install vllm==0.5.4 ray
# Install flash-attention
pip3 install flash-attn --no-build-isolation
# Install project dependencies
pip install -e . # For verl integration
# Install additional tools
pip install wandb IPython matplotlib
pip install tensordict==0.5.0
pip install scipy
Before using the project, you need to authenticate with Weights & Biases (for experiment tracking) and Hugging Face (for model uploading):
# Install wandb if you haven't already
pip install wandb
# Log in to wandb
wandb login
# Follow the instructions to enter your API key
You can find your Wandb API key in your Wandb account settings.
# Install huggingface_hub if you haven't already
pip install huggingface_hub
# Log in to Hugging Face
huggingface-cli login
# Follow the instructions to enter your token
You can find or create your Hugging Face token in your Hugging Face account settings.
The training scripts automatically use these credentials for:
trainer.hf_account)Important: Before running the training scripts, you need to modify the trainer.hf_account parameter in the .sh files from xxx to your own Hugging Face username. For example:
# Change this line in the training scripts
trainer.hf_account=xxx # Change to your Hugging Face username
Knights and Knaves puzzles are classic logical reasoning problems where:
The project uses K&K puzzles of varying complexity (from 3 to 14 people) to train and evaluate LLMs' logical reasoning capabilities.
combinedkk.sh) - Custom implementation focus of this projectcombinedkk_nocl.sh) - For comparative evaluationThe project includes two primary training scripts:
conda activate dump
./main_grpo_Qwen2.5-7B-Instruct-1M_combined_logic_longseq_combinedkk.sh
conda activate dump
./main_grpo_Qwen2.5-7B-Instruct-1M_combined_logic_longseq_combinedkk_nocl.sh
Important: Before running these scripts, remember to modify the trainer.hf_account parameter in the scripts from xxx to your own Hugging Face username to enable model uploading.
The dataset generation process is optional, you can directly use our generated data located in ./combined_logic_dataset/generate_combined_kk. The dataset generation process consists of the following steps:
Generate K&K puzzles:
cd kk
conda env create -f environment.yml
conda activate kk
cd ..
python kk/data_prep/data_gen_kk.py
This generates various Knights and Knaves puzzles in JSONL format.
Move generated files to combined_logic_dataset:
# Move all generated JSONL files to the appropriate directory
mv data/*/clean/*.jsonl combined_logic_dataset/kk/
Generate combined dataset:
# Run the dataset combiner in background
conda activate dump
nohup python ./combined_logic_dataset/generate_combined_kk.py --local_dir ./combined_logic_dataset/generate_combined_kk > generate_combined_kk.log 2>&1 &
This processes the JSONL files into parquet files with carefully formatted prompts suitable for instruction-tuned models.
βββ verl/ # Reinforcement learning framework (external dependency with modifications)
β βββ trainer/ # RL training implementation
β βββ ...
βββ kk/ # Knights and Knaves utilities
β βββ data_prep/ # Data preparation utilities
β β βββ data_gen_kk.py # Main data generation script used in this project
β βββ ... # Other utilities (not directly used)
βββ combined_logic_dataset/ # Combined dataset generation
β βββ kk/ # Location for generated KK dataset files
β βββ generate_combined_kk/ # Output directory for processed datasets
β βββ generate_combined_kk.py # Dataset combination script
βββ main_grpo_*.sh # Training scripts
Environment Preparation: Refer to Installation and Service Authentication.
Generate K&K dataset (Optional):
cd kk
conda env create -f environment.yml
conda activate kk
cd ..
python ./kk/data_prep/data_gen_kk.py
Move generated files (Optional):
mv data/train/clean/*.jsonl combined_logic_dataset/kk/
Generate combined dataset (Optional):
conda activate dump
nohup python ./combined_logic_dataset/generate_combined_kk.py --local_dir ./combined_logic_dataset/generate_combined_kk > generate_combined_kk.log 2>&1 &
Running experiments:
trainer.hf_account=xxx parameter in the .sh files to your own Hugging Face username../combined_logic_dataset/generate_combined_kk/.Start training with DUMP curriculum learning:
conda activate dump
./main_grpo_Qwen2.5-7B-Instruct-1M_combined_logic_longseq_combinedkk.sh
Start training without DUMP curriculum learning (for comparison):
conda activate dump
./main_grpo_Qwen2.5-7B-Instruct-1M_combined_logic_longseq_combinedkk_nocl.sh
The main contribution of this project is the implementation of curriculum learning strategies in the verl reinforcement learning framework. The curriculum learning approach enables more effective training by:
data_source_key parameter to identify different data sourcesOur implementation in verl/utils/curriculum_learning.py provides a robust framework for distribution-level curriculum learning in RL-based LLM training. The system dynamically adjusts sampling probabilities to focus on distributions with the highest learning potential.
The LearnabilityEstimator tracks performance metrics for individual data distributions:
@dataclass
class LearnabilityEstimator:
"""Learnability estimator for curriculum learning."""
# Beta distribution parameters (for reward modeling)
alpha: float = 1.0
beta: float = 1.0
# Normal distribution parameters (for advantage function modeling)
mu: float = 0.0
# Additional statistics
n_samples: int = 0
total_reward: float = 0.0
# Sliding window for recent performance tracking
window_size: int = 300 # sliding window size
recent_rewards: List[float] = field(default_factory=list)
recent_advantages: List[float] = field(default_factory=list)
The CurriculumController manages multiple estimators and computes optimal sampling weights:
def compute_sampling_weights(self) -> Dict[str, float]:
"""Compute sampling weights for each data source."""
stats = self.get_source_stats()
# Calculate UCB scores for each source
base_scores = []
source_to_index = {}
# Calculate total samples across all sources
total_samples = sum(stat['n_samples'] for stat in stats.values())
total_samples = max(1, total_samples) # Avoid division by zero
for i, source in enumerate(self.data_sources):
source_to_index[source] = i
stat = stats[source]
# Weight parameters
uncertainty_weight = 1.0 # uncertainty term weight
exploration_weight = 1.0 # exploration term weight
# Base UCB score using the advantage mean
ucb_score = stat['advantage_mean']
# Add exploration bonus (more exploration for less sampled sources)
exploration_bonus = exploration_weight * np.sqrt(
2 * np.log(total_samples + 1) / (stat['n_samples'] + 1)
)
ucb_score += exploration_bonus
base_scores.append(ucb_score)
advantage_mean serves as the exploitation term, prioritizing distributions with higher potential gainsThe CurriculumSampler implements the actual sampling logic:
class CurriculumSampler:
"""Sampler that implements curriculum learning based on task difficulty."""
def __init__(self,
dataset,
data_source_key: str = 'data_source',
batch_size: int = 1,
seed: Optional[int] = None):
Data Source Identification: Training data is tagged with a data_source_key to identify different distributions.
Performance Tracking: During training, the system tracks:
Dynamic Weight Adjustment: The UCB-based algorithm adjusts sampling weights to:
Robust Sampling: The sampler handles practical implementation challenges like:
This implementation realizes the theoretical framework proposed in our paper, creating a principled approach to curriculum learning that adapts to the model's changing capabilities during training.
https://github.com/volcengine/verl
https://github.com/AlphaPav/mem-kk-logic
https://github.com/Unakar/Logic-RL
If you find this project useful, please consider citing our paper:
@article{wang2025dump,
title={DUMP: Automated Distribution-Level Curriculum Learning for RL-based LLM Post-training},
author={Wang, Zhenting and Cui, Guofeng and Wan, Kun and Zhao, Wentian},
journal={arXiv preprint arXiv:2504.09710},
year={2025}
}
32 commits
Python
97.4%
Shell
1.6%
Jupyter Notebook
1.0%