Official implementation of DualDistill: A trajectory-composition distillation method for integrating tool use into long-chain-of-thought reasoning.
Weihua Du, Pranjal Aggarwal, Sean Welleck, & Yiming Yang
"Agentic-R1: Distilled Dual-Strategy Reasoning." (2025)
Overview of DualDistill methodology
| Dataset | Description | Link |
|---|---|---|
| Training Set | Complete training dataset with teacher trajectories | 🤗 HuggingFace |
| Test Set | Evaluation benchmarks | dataset/test/ |
Clone the repository:
git clone https://github.com/StigLidu/DualDistill.git
cd DualDistill
Create environment (optional but recommended):
conda create -n dualdistill python=3.11
conda activate dualdistill
Install dependencies:
pip install -r requirements.txt
pip install flash-attn --no-build-isolation
Download the base model:
python script/data_script/model_download.py \
--repo_id deepseek-ai/DeepSeek-R1-Distill-Qwen-7B \
--local_dir models
Prepare training data:
python script/data_script/teacher_data_download.py
Train the student model using teacher trajectories:
bash script/sft_script/SFT.sh
Start inference server:
bash script/eval_script/start_inference_server.sh [model_path] [display_name] [port]
Sample self-distillation trajectories:
python sft/self_distillation_sampler.py \
--server_url http://localhost:$port/v1 \
--model_name [display_name] \
--model_path [model_path] \
--save_path [path_to_save_trajectories]
Prepare self-distillation data:
# Extract teacher solutions
python script/data_script/extract_training_solution.py
# Construct training dataset
python script/data_script/processing_self_distillation_traj.py
Fine-tune on self-distillation data:
bash script/sft_script/expert_iteration.sh [model_path] [data_path] [save_path]
bash script/eval_script/start_inference_server.sh [model_path] [display_name] [port]
bash script/eval_script/eval_remote_server.sh \
[url] [display_name] [data_path] [code_mode] [max_token]
Example:
bash script/eval_script/eval_remote_server.sh \
"http://localhost:8080/v1" "agentic-r1" "dataset/test/math.json" "true" "4096"
| Model | Description | HuggingFace Link |
|---|---|---|
| Agentic-R1-7B | Base model with teacher distillation | 🤗 Download |
| Agentic-R1-7B-SD | Enhanced model with self-distillation | 🤗 Download |
model_max_length in tokenizer_config.json.This project is licensed under the MIT License - see the LICENSE file for details.
We thank the following open-source projects for their foundational contributions:
For questions or support, please contact:
If you find our work useful, please consider citing:
@inproceedings{du2025agentic,
title={Agentic-r1: Distilled dual-strategy reasoning},
author={Du, Weihua and Aggarwal, Pranjal and Welleck, Sean and Yang, Yiming},
booktitle={Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing},
pages={12040--12054},
year={2025}
}
⭐ Star us on GitHub if this project helped you!
13 commits
Python
96.9%
Shell
3.1%
Official implementation of DualDistill: A trajectory-composition distillation method for integrating tool use into long-chain-of-thought reasoning.
Weihua Du, Pranjal Aggarwal, Sean Welleck, & Yiming Yang
"Agentic-R1: Distilled Dual-Strategy Reasoning." (2025)
Overview of DualDistill methodology
| Dataset | Description | Link |
|---|---|---|
| Training Set | Complete training dataset with teacher trajectories | 🤗 HuggingFace |
| Test Set | Evaluation benchmarks | dataset/test/ |
Clone the repository:
git clone https://github.com/StigLidu/DualDistill.git
cd DualDistill
Create environment (optional but recommended):
conda create -n dualdistill python=3.11
conda activate dualdistill
Install dependencies:
pip install -r requirements.txt
pip install flash-attn --no-build-isolation
Download the base model:
python script/data_script/model_download.py \
--repo_id deepseek-ai/DeepSeek-R1-Distill-Qwen-7B \
--local_dir models
Prepare training data:
python script/data_script/teacher_data_download.py
Train the student model using teacher trajectories:
bash script/sft_script/SFT.sh
Start inference server:
bash script/eval_script/start_inference_server.sh [model_path] [display_name] [port]
Sample self-distillation trajectories:
python sft/self_distillation_sampler.py \
--server_url http://localhost:$port/v1 \
--model_name [display_name] \
--model_path [model_path] \
--save_path [path_to_save_trajectories]
Prepare self-distillation data:
# Extract teacher solutions
python script/data_script/extract_training_solution.py
# Construct training dataset
python script/data_script/processing_self_distillation_traj.py
Fine-tune on self-distillation data:
bash script/sft_script/expert_iteration.sh [model_path] [data_path] [save_path]
bash script/eval_script/start_inference_server.sh [model_path] [display_name] [port]
bash script/eval_script/eval_remote_server.sh \
[url] [display_name] [data_path] [code_mode] [max_token]
Example:
bash script/eval_script/eval_remote_server.sh \
"http://localhost:8080/v1" "agentic-r1" "dataset/test/math.json" "true" "4096"
| Model | Description | HuggingFace Link |
|---|---|---|
| Agentic-R1-7B | Base model with teacher distillation | 🤗 Download |
| Agentic-R1-7B-SD | Enhanced model with self-distillation | 🤗 Download |
model_max_length in tokenizer_config.json.This project is licensed under the MIT License - see the LICENSE file for details.
We thank the following open-source projects for their foundational contributions:
For questions or support, please contact:
If you find our work useful, please consider citing:
@inproceedings{du2025agentic,
title={Agentic-r1: Distilled dual-strategy reasoning},
author={Du, Weihua and Aggarwal, Pranjal and Welleck, Sean and Yang, Yiming},
booktitle={Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing},
pages={12040--12054},
year={2025}
}
⭐ Star us on GitHub if this project helped you!
13 commits
Python
96.9%
Shell
3.1%