yuccaaa commited on
Commit
b96bcfa
·
verified ·
1 Parent(s): 691fb66

Upload pretrain_data/cot/README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. pretrain_data/cot/README.md +223 -0
pretrain_data/cot/README.md ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ dataset_info:
3
+ - config_name: all
4
+ features:
5
+ - name: messages
6
+ list:
7
+ - name: content
8
+ dtype: string
9
+ - name: role
10
+ dtype: string
11
+ - name: num_tokens
12
+ dtype: int64
13
+ - name: source
14
+ dtype: string
15
+ splits:
16
+ - name: train
17
+ num_bytes: 7062819826.825458
18
+ num_examples: 349317
19
+ download_size: 3077653717
20
+ dataset_size: 7062819826.825458
21
+ - config_name: code
22
+ features:
23
+ - name: messages
24
+ list:
25
+ - name: content
26
+ dtype: string
27
+ - name: role
28
+ dtype: string
29
+ - name: num_tokens
30
+ dtype: int64
31
+ - name: source
32
+ dtype: string
33
+ splits:
34
+ - name: train
35
+ num_bytes: 3872656251.3167396
36
+ num_examples: 83070
37
+ download_size: 1613338604
38
+ dataset_size: 3872656251.3167396
39
+ - config_name: math
40
+ features:
41
+ - name: messages
42
+ list:
43
+ - name: content
44
+ dtype: string
45
+ - name: role
46
+ dtype: string
47
+ - name: num_tokens
48
+ dtype: int64
49
+ - name: source
50
+ dtype: string
51
+ splits:
52
+ - name: train
53
+ num_bytes: 1599028646
54
+ num_examples: 93733
55
+ download_size: 704448153
56
+ dataset_size: 1599028646
57
+ - config_name: science
58
+ features:
59
+ - name: messages
60
+ list:
61
+ - name: content
62
+ dtype: string
63
+ - name: role
64
+ dtype: string
65
+ - name: num_tokens
66
+ dtype: int64
67
+ - name: source
68
+ dtype: string
69
+ splits:
70
+ - name: train
71
+ num_bytes: 1590765326
72
+ num_examples: 172514
73
+ download_size: 674333812
74
+ dataset_size: 1590765326
75
+ configs:
76
+ - config_name: all
77
+ data_files:
78
+ - split: train
79
+ path: all/train-*
80
+ - config_name: code
81
+ data_files:
82
+ - split: train
83
+ path: code/train-*
84
+ - config_name: math
85
+ data_files:
86
+ - split: train
87
+ path: math/train-*
88
+ - config_name: science
89
+ data_files:
90
+ - split: train
91
+ path: science/train-*
92
+ task_categories:
93
+ - text-generation
94
+ language:
95
+ - en
96
+ pretty_name: Mixture of Thoughts
97
+ size_categories:
98
+ - 100K<n<1M
99
+ ---
100
+
101
+ <img src="mot-thumbnail.png" alt="Centered Image" style="display: block; margin: 0 auto;" width="500">
102
+
103
+ # Dataset summary
104
+
105
+ Mixture-of-Thoughts is a curated dataset of 350k verified reasoning traces distilled from [DeepSeek-R1](https://huggingface.co/deepseek-ai/DeepSeek-R1). The dataset spans tasks in mathematics, coding, and science, and is designed to teach language models to reason step-by-step. It was used in the Open R1 project to train [OpenR1-Distill-7B](https://huggingface.co/open-r1/OpenR1-Distill-7B), an SFT model that replicates the reasoning capabilities of [deepseek-ai/DeepSeek-R1-Distill-Qwen-7B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-7B) from the same base model.
106
+
107
+ To load the dataset, run:
108
+
109
+ ```python
110
+ from datasets import load_dataset
111
+
112
+ dataset = load_dataset("open-r1/Mixture-of-Thoughts", "all", split="train")
113
+
114
+ # Load a specific domain
115
+ dataset_math = load_dataset("open-r1/Mixture-of-Thoughts", "math", split="train")
116
+ ```
117
+
118
+ ## Dataset composition
119
+
120
+ Mixture-of-Thoughts is composed of three domains: math, code, and science. Each domain contains reasoning traces that are designed to teach language models to reason step-by-step. The dataset is structured as follows:
121
+
122
+ - **math**: 93.7k reasoning traces for mathematical problems, sourced from the `default` subset of [open-r1/OpenR1-Math-220k](https://huggingface.co/datasets/open-r1/OpenR1-Math-220k)
123
+ - **code**: 83.1k reasoning traces for competitive programming problems in Python and C++, sourced from the `solutions` and `solutions_w_editorials` subsets of [open-r1/codeforces-cots](https://huggingface.co/datasets/open-r1/codeforces-cots)
124
+ - **science**: 173k reasoning traces for scientific problems, sourced from the `science` subset of [nvidia/Llama-Nemotron-Post-Training-Dataset](https://huggingface.co/datasets/nvidia/Llama-Nemotron-Post-Training-Dataset)
125
+ - **all**: Contains all reasoning traces from the three domains, for a total of 350k traces.
126
+
127
+ ## Curation methodology
128
+
129
+ To optimise the data mixture, we followed the same methodology described in the [Phi-4-reasoning tech report](https://huggingface.co/papers/2504.21318), namely that mixtures can be optimised independently per domain, and then combined into a single dataset. For each ablation, we evaluate on AIME 2024, GPQA Diamond, and LiveCodeBench v4 every epoch and take the best performing model checkpoint. The figure below shows the results from post-training [open-r1/Qwen2.5-Math-7B-RoPE-300k](https://huggingface.co/open-r1/Qwen2.5-Math-7B-RoPE-300k) on each individual domain compared to the final mixture:
130
+
131
+ <img src="data_mix.png" alt="Centered Image" style="display: block; margin: 0 auto;">
132
+
133
+ Overall, we find that training on all domains simultaneously yields the best results. See the subsections below for more details on optimising the data mixture per domain.
134
+
135
+ > [!NOTE]
136
+ > We use LiveCodeBench v4 to accelerate evaluation during our ablations as it contains around half the problems of v5, yet is still representative of the full benchmark.
137
+
138
+ ### Code
139
+
140
+ During the development of [open-r1/OlympicCoder-7B](https://huggingface.co/open-r1/OlympicCoder-7B), we observed that generating R1 reasoning traces in C++ produced better results on the challenging [IOI 2024 benchmark](https://github.com/huggingface/ioi), while Python traces produced better results on LiveCodeBench (a Python-only benchmark). To optimise the data mixture, we therefore used a mix of C++ and Python traces sourced from the following subsets of [open-r1/codeforces-cots](https://huggingface.co/datasets/open-r1/codeforces-cots):
141
+
142
+ - `solutions`: we prompt R1 to solve the problem and produce code in C++.
143
+ - `solutions_py`: same as `solutions`, but with R1 prompted to produce code in Python.
144
+ - `solutions_w_editorials`: we prompt R1 to solve the problem and produce code, but also provide it with a human-written solution.
145
+ - `solutions_w_editorials_py`: same as `solutions_w_editorials`, but with R1 prompted to produce code in Python.
146
+
147
+ The figure below shows the evolution of our ablations on these subsets, using [Qwen/Qwen2.5-Coder-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct) as the base model:
148
+
149
+ <img src="code_mix.png" alt="Centered Image" style="display: block; margin: 0 auto;">
150
+
151
+ The individual experiments correspond to the following:
152
+
153
+ * **exp1 - exp3:** scaling the learning rate on the `solutions` subset from 1e-5 to 2e-5, and 4e-5 respectively.
154
+ * **exp4 - exp5:** measuring the impact of training on the `solutions_w_editorials` subset vs the combined `solutions` and `solutions_w_editorials` subsets.
155
+ * **exp6 - exp9:** measuring the impact of blending in Python traces from the `solutions_py` and `solutions_w_editorials_py` subsets. exp6 combines the `solutions_w_editorials` and `solutions_w_editorials_py` subsets, while exp7 combines the `solutions` and `solutions_py` subsets. Finally, exp8 combines all four subsets.
156
+
157
+ We found that combining all subsets of C++ and Python traces yielded the best results on LiveCodeBench. We also found that using this data mixture to fine-tune [open-r1/Qwen2.5-Coder-7B-RoPE-300k](https://huggingface.co/open-r1/Qwen2.5-Coder-7B-RoPE-300k) led to comparable performance improvements, which shows the effectiveness of our curation strategy.
158
+
159
+ ### Math
160
+
161
+ For the math domain, we mostly focused on comparing the `default` and `extended` subsets of [open-r1/OpenR1-Math-220k](https://huggingface.co/datasets/open-r1/OpenR1-Math-220k). The `default` subset contains 93.7k reasoning traces, while the `extended` subset contains an additional 131k traces, containing simpler problems than the `default` subset. The figure below shows performance on each subset, using [Qwen/Qwen2.5-Math-7B-RoPE-300k](https://huggingface.co/Qwen/Qwen2.5-Math-7B-RoPE-300k) as the base model:
162
+
163
+ <img src="math_mix.png" alt="Centered Image" style="display: block; margin: 0 auto;">
164
+
165
+ Overall, we found that training on the `default` subset yielded better results than training on the `extended` subset, and that training on both subsets together yielded the best results. Nevertheless, we opted to use the `default` subset only for the final mixture, as including both would have led to a significant increase in the size of the dataset, for a modest improvement in performance.
166
+
167
+ ### Science
168
+
169
+ For the science domain, we used the `science` subset of [nvidia/Llama-Nemotron-Post-Training-Dataset](https://huggingface.co/datasets/nvidia/Llama-Nemotron-Post-Training-Dataset/viewer/SFT/science), which contains 483k reasoning traces. However, we found that the subset was too large to be used in its entirety, as it would have led to a significant increase in the size of the dataset. Instead, we selected the subset of traces where no Qwen models were used for prompt pre-processing--see this [discussion](https://huggingface.co/datasets/nvidia/Llama-Nemotron-Post-Training-Dataset/discussions/6) for more details. The result was 173k reasoning traces, which we used in the final mixture after ablating on the learning rate.
170
+
171
+ ## Citation
172
+
173
+ If you find this dataset is useful in your own work, please consider citing it as follows, together with the source of the specific domain you are using:
174
+
175
+ ```bibtex
176
+ @misc{openr1,
177
+ title = {Open R1: A fully open reproduction of DeepSeek-R1},
178
+ url = {https://github.com/huggingface/open-r1},
179
+ author = {Hugging Face},
180
+ month = {January},
181
+ year = {2025}
182
+ }
183
+ ```
184
+
185
+ **open-r1/codeforces-cots**
186
+
187
+ ```bibtex
188
+ @misc{penedo2025codeforces,
189
+ title={CodeForces CoTs},
190
+ author={Guilherme Penedo and Anton Lozhkov and Hynek Kydlíček and Loubna Ben Allal and Edward Beeching and Agustín Piqueres Lajarín and Quentin Gallouédec and Nathan Habib and Lewis Tunstall and Leandro von Werra},
191
+ year={2025},
192
+ publisher = {Hugging Face},
193
+ journal = {Hugging Face repository},
194
+ howpublished = {\url{https://huggingface.co/datasets/open-r1/codeforces-cots}}
195
+ }
196
+ ```
197
+
198
+ **open-r1/OpenR1-Math-220k**
199
+
200
+ ```bibtex
201
+ @misc{lozhkov2025openr1math220k,
202
+ title={OpenR1-Math-220k},
203
+ author={Anton Lozhkov and Hynek Kydlíček and Loubna Ben Allal and Guilherme Penedo and Edward Beeching and Quentin Gallouédec and Nathan Habib and Lewis Tunstall and Leandro von Werra},
204
+ year={2025},
205
+ publisher = {Hugging Face},
206
+ journal = {Hugging Face repository},
207
+ howpublished = {\url{https://huggingface.co/datasets/open-r1/OpenR1-Math-220k}}
208
+ }
209
+ ```
210
+
211
+ **nvidia/Llama-Nemotron-Post-Training-Dataset**
212
+
213
+ ```bibtex
214
+ @misc{bercovich2025llamanemotronefficientreasoningmodels,
215
+ title={Llama-Nemotron: Efficient Reasoning Models},
216
+ author={Akhiad Bercovich and Itay Levy and Izik Golan and Mohammad Dabbah and Ran El-Yaniv and Omri Puny and Ido Galil and Zach Moshe and Tomer Ronen and Najeeb Nabwani and Ido Shahaf and Oren Tropp and Ehud Karpas and Ran Zilberstein and Jiaqi Zeng and Soumye Singhal and Alexander Bukharin and Yian Zhang and Tugrul Konuk and Gerald Shen and Ameya Sunil Mahabaleshwarkar and Bilal Kartal and Yoshi Suhara and Olivier Delalleau and Zijia Chen and Zhilin Wang and David Mosallanezhad and Adi Renduchintala and Haifeng Qian and Dima Rekesh and Fei Jia and Somshubra Majumdar and Vahid Noroozi and Wasi Uddin Ahmad and Sean Narenthiran and Aleksander Ficek and Mehrzad Samadi and Jocelyn Huang and Siddhartha Jain and Igor Gitman and Ivan Moshkov and Wei Du and Shubham Toshniwal and George Armstrong and Branislav Kisacanin and Matvei Novikov and Daria Gitman and Evelina Bakhturina and Jane Polak Scowcroft and John Kamalu and Dan Su and Kezhi Kong and Markus Kliegl and Rabeeh Karimi and Ying Lin and Sanjeev Satheesh and Jupinder Parmar and Pritam Gundecha and Brandon Norick and Joseph Jennings and Shrimai Prabhumoye and Syeda Nahida Akter and Mostofa Patwary and Abhinav Khattar and Deepak Narayanan and Roger Waleffe and Jimmy Zhang and Bor-Yiing Su and Guyue Huang and Terry Kong and Parth Chadha and Sahil Jain and Christine Harvey and Elad Segal and Jining Huang and Sergey Kashirsky and Robert McQueen and Izzy Putterman and George Lam and Arun Venkatesan and Sherry Wu and Vinh Nguyen and Manoj Kilaru and Andrew Wang and Anna Warno and Abhilash Somasamudramath and Sandip Bhaskar and Maka Dong and Nave Assaf and Shahar Mor and Omer Ullman Argov and Scot Junkin and Oleksandr Romanenko and Pedro Larroy and Monika Katariya and Marco Rovinelli and Viji Balas and Nicholas Edelman and Anahita Bhiwandiwalla and Muthu Subramaniam and Smita Ithape and Karthik Ramamoorthy and Yuting Wu and Suguna Varshini Velury and Omri Almog and Joyjit Daw and Denys Fridman and Erick Galinkin and Michael Evans and Katherine Luna and Leon Derczynski and Nikki Pope and Eileen Long and Seth Schneider and Guillermo Siman and Tomasz Grzegorzek and Pablo Ribalta and Monika Katariya and Joey Conway and Trisha Saar and Ann Guan and Krzysztof Pawelec and Shyamala Prayaga and Oleksii Kuchaiev and Boris Ginsburg and Oluwatobi Olabiyi and Kari Briski and Jonathan Cohen and Bryan Catanzaro and Jonah Alben and Yonatan Geifman and Eric Chung and Chris Alexiuk},
217
+ year={2025},
218
+ eprint={2505.00949},
219
+ archivePrefix={arXiv},
220
+ primaryClass={cs.CL},
221
+ url={https://arxiv.org/abs/2505.00949},
222
+ }
223
+ ```