Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,122 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
---
|
4 |
+
# TinyDeepSeek: Reproduction of DeepSeek-R1 and Beyond
|
5 |
+
|
6 |
+
<p align="center">
|
7 |
+
📃 <a href="" target="_blank">Paper</a> • 🤗 <a href="https://huggingface.co/FreedomIntelligence/TinyDeepSeek-0.5B-base" target="_blank">TinyDeepSeek-0.5B-base</a> • 🤗 <a href="https://huggingface.co/FreedomIntelligence/TinyDeepSeek-3.3B-base" target="_blank">TinyDeepSeek-3.3B-base</a>
|
8 |
+
<br> 🤗 <a href="https://huggingface.co/FreedomIntelligence/TinyDeepSeek-3.3B-checkpoints" target="_blank"> TinyDeepSeek-3.3B-checkpoints</a> • 🤗 <a href="https://huggingface.co/FreedomIntelligence/TinyDeepSeek-0.5B-checkpoints" target="_blank">TinyDeepSeek-0.5B-checkpoints</a>
|
9 |
+
|
10 |
+
</p>
|
11 |
+
|
12 |
+
**Innovation and Open source are the best tributes and reproductions of DeepSeek**.
|
13 |
+
|
14 |
+
The open-source ethos, rooted in technological equity, upholds two key principles: **free access for all developers** and **the opportunity for technical contributions**. While DeepSeek exemplifies the first principle, the second principle is hindered by restrictive training strategies, unclear data sources, and the high costs of model training. These constraints limit the open-source community's capacity to contribute and impede technological progress.
|
15 |
+
|
16 |
+
To overcome these challenges, we launched a comprehensive reproduction project of DeepSeek. This initiative involves training models from scratch, replicating DeepSeek's architecture and algorithms. We will **fully open-source** the training code, datasets, and models, offering code framework, reference solution, and base models for low-cost continual exploration.
|
17 |
+
|
18 |
+
|
19 |
+
|
20 |
+
## 🌈 Update
|
21 |
+
|
22 |
+
* **[2025.03.11]** TinyDeepSeek repo is published!🎉
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
## Reproduction of DeepSeek-R1
|
28 |
+
|
29 |
+
### Architecture
|
30 |
+
|
31 |
+
<details><summary>Click to expand</summary>
|
32 |
+
|
33 |
+

|
34 |
+
|
35 |
+
As shown in above Figure, the DeepSeek technical report introduces three architectural designs:
|
36 |
+
|
37 |
+
- A. *Multi-Head Latent Attention (MLA)*
|
38 |
+
|
39 |
+
- B. *Load Balancing Strategy without Auxiliary Loss*: Please refer [code](https://github.com/FreedomIntelligence/TinyDeepSeek/blob/main/src/modeling/tinydeepseek/modeling_tinydeepseek.py#L550) for implementation.
|
40 |
+
|
41 |
+
- C. *Multi-Token Prediction*: Please refer [code](https://github.com/FreedomIntelligence/TinyDeepSeek/blob/main/src/modeling/tinydeepseek/modeling_tinydeepseek.py#L1875) for implementation.
|
42 |
+
|
43 |
+
Our Detailed architectural parameter are shown in Table below.
|
44 |
+
|
45 |
+

|
46 |
+
|
47 |
+
</details>
|
48 |
+
|
49 |
+
### Data Construction
|
50 |
+
|
51 |
+
<details><summary>Click to expand</summary>
|
52 |
+
|
53 |
+

|
54 |
+
|
55 |
+
- Pretrain:
|
56 |
+
- Meta & Labeled Data: *TBD*
|
57 |
+
- Process Code: Please refer to [Link](/pretrain_data/Readme.md) for implementation.
|
58 |
+
- SFT:
|
59 |
+
- [HuggingFaceTB/smoltalk](https://huggingface.co/datasets/HuggingFaceTB/smoltalk)
|
60 |
+
- [allenai/tulu-3-sft-olmo-2-mixture](https://huggingface.co/datasets/allenai/tulu-3-sft-olmo-2-mixture)
|
61 |
+
- RL:
|
62 |
+
- [SynthLabsAI/Big-Math-RL-Verified](https://huggingface.co/datasets/SynthLabsAI/Big-Math-RL-Verified)
|
63 |
+
|
64 |
+
</details>
|
65 |
+
|
66 |
+
### Model Training
|
67 |
+
|
68 |
+
```
|
69 |
+
bash examples/pretrainStage1.sh
|
70 |
+
bash examples/pretrainStage2.sh
|
71 |
+
bash examples/sft.sh
|
72 |
+
|
73 |
+
bash examples/rl.sh (TBD)
|
74 |
+
```
|
75 |
+
|
76 |
+
### Results
|
77 |
+
|
78 |
+
*TBD*
|
79 |
+
|
80 |
+
## Beyond Reproduction
|
81 |
+
|
82 |
+
### Scale Up RL to Pretrain
|
83 |
+
|
84 |
+
> **RWO: Reward Weighted Optimization**
|
85 |
+
|
86 |
+
For the training, please include the include the following flags in the training command.
|
87 |
+
|
88 |
+
- For Pretrain please prepare data item with key 'text_evaluation':{"knowledge":4, "reasoning":3, ...}.
|
89 |
+
- For SFT, please provide data file 'General.json' and reward file 'General_reward.json' in the same directory.
|
90 |
+
|
91 |
+
```
|
92 |
+
--reward_weighted_optimization True \
|
93 |
+
--remove_unused_columns False \
|
94 |
+
```
|
95 |
+
|
96 |
+
## 📃 To do
|
97 |
+
|
98 |
+
- [ ] Release Evaluation Results
|
99 |
+
- [ ] Release RL Training Code and Model
|
100 |
+
- [ ] Release Pretrain Data quality annotation label
|
101 |
+
- [ ] Release TinyDeepSeek Technical Report
|
102 |
+
|
103 |
+
|
104 |
+
## Acknowledgment
|
105 |
+
|
106 |
+
- [DeepSeek-R1](https://github.com/deepseek-ai/DeepSeek-R1)
|
107 |
+
|
108 |
+
|
109 |
+
## Citation
|
110 |
+
Please use the following citation if you intend to use our dataset for training or evaluation:
|
111 |
+
|
112 |
+
```
|
113 |
+
@misc{tinydeepseek,
|
114 |
+
title={TinyDeepSeek},
|
115 |
+
author={FreedomIntelligence Team},
|
116 |
+
year = {2025},
|
117 |
+
publisher = {GitHub},
|
118 |
+
journal = {GitHub repository},
|
119 |
+
howpublished = {\url{https://github.com/FreedomIntelligence/TinyDeepSeek}},
|
120 |
+
}
|
121 |
+
```
|
122 |
+
|