Commit
ยท
22cb1c2
0
Parent(s):
Initialized
Browse files- .gitattributes +35 -0
- README.md +274 -0
- assets/dna-r1-logo.png +0 -0
- assets/dna-r1-pipeline.png +0 -0
.gitattributes
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,274 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
- ko
|
5 |
+
license: cc-by-nc-4.0
|
6 |
+
tags:
|
7 |
+
- dnotitia
|
8 |
+
- nlp
|
9 |
+
- llm
|
10 |
+
- slm
|
11 |
+
- conversation
|
12 |
+
- chat
|
13 |
+
- reasoning
|
14 |
+
- r1
|
15 |
+
base_model:
|
16 |
+
- microsoft/phi-4
|
17 |
+
library_name: transformers
|
18 |
+
pipeline_tag: text-generation
|
19 |
+
---
|
20 |
+
|
21 |
+
# DNA-R1
|
22 |
+
|
23 |
+
<p align="center">
|
24 |
+
<img src="assets/dna-r1-logo.png" width="400" style="margin: 40px auto;">
|
25 |
+
</p>
|
26 |
+
|
27 |
+
We introduce **DNA-R1**, a specialized reasoning model optimized for Korean language based on Microsoft's Phi-4. By applying large-scale reinforcement learning (RL) using the same methodology as DeepSeek-R1, we have significantly enhanced the model's Korean reasoning capabilities. This model demonstrates deep understanding of Korean text and exhibits exceptional reasoning abilities across mathematics, coding, and general reasoning tasks.
|
28 |
+
|
29 |
+
<p align="center">
|
30 |
+
<img src="assets/dna-r1-pipeline.png" width="100%" style="margin: 40px auto;">
|
31 |
+
</p>
|
32 |
+
|
33 |
+
## Training Methodology
|
34 |
+
|
35 |
+
Our comprehensive training pipeline consists of three strategic stages:
|
36 |
+
|
37 |
+
- **Stage 1:** Initial SFT with a large Korean non-reasoning dataset (760k examples) reused from our [DNA 1.0 8B Instruct](https://huggingface.co/dnotitia/Llama-DNA-1.0-8B-Instruct) training pipeline
|
38 |
+
- **Stage 2:** Strategic integration of Korean reasoning patterns from DeepSeek R1 using a specialized Korean reasoning dataset (300k examples)
|
39 |
+
- **Stage 3:** Advanced reinforcement learning with GRPO using a combined Korean/English reasoning dataset, with format, accuracy, and language consistency as rewards
|
40 |
+
|
41 |
+
DNA-R1 has learned reasoning patterns specifically tailored for Korean language, and demonstrates capabilities such as self-verification, reflection, and generation of long chains-of-thought (CoT). This represents a significant milestone for the AI research community in the Korean language environment.
|
42 |
+
|
43 |
+
## Model Specifications
|
44 |
+
|
45 |
+
- **Developed by:** Dnotitia Inc.
|
46 |
+
- **Supported Languages:** Korean, English
|
47 |
+
- **Model Release Date:** Mar 4, 2025
|
48 |
+
- **Number of Parameters:** 14B
|
49 |
+
- **License:** CC BY-NC 4.0
|
50 |
+
|
51 |
+
<div style="padding: 2px 8px; background-color: hsl(240, 100%, 50%, 0.1); border-radius: 5px">
|
52 |
+
<p><strong>NOTICE (Korean):</strong></p>
|
53 |
+
<p>๋ณธ ๋ชจ๋ธ์ ์์
์ ๋ชฉ์ ์ผ๋ก ํ์ฉํ์ค ์ ์์ต๋๋ค. ์์
์ ์ด์ฉ์ ์ํ์๋ ๊ฒฝ์ฐ, ๋๋
ธํฐ์์ ํํ์ด์ง์ <a href="https://www.dnotitia.com/contact/post-form">Contact us</a>๋ฅผ ํตํด ๋ฌธ์ํด ์ฃผ์๊ธฐ ๋ฐ๋๋๋ค. ๊ฐ๋จํ ํ์ ์ ์ฐจ๋ฅผ ๊ฑฐ์ณ ์์
์ ํ์ฉ์ ์น์ธํด ๋๋ฆฌ๋๋ก ํ๊ฒ ์ต๋๋ค.</p>
|
54 |
+
</div>
|
55 |
+
|
56 |
+
## Technical Details
|
57 |
+
|
58 |
+
### Multi-Stage Training Pipeline
|
59 |
+
|
60 |
+
We implemented a sophisticated training approach to enhance Phi-4's Korean reasoning capabilities:
|
61 |
+
|
62 |
+
1. **Initial Foundation (Stage 1):** Supervised Fine-Tuning using our extensive Korean non-reasoning dataset from the established [DNA 1.0 8B Instruct](https://huggingface.co/dnotitia/Llama-DNA-1.0-8B-Instruct) training pipeline
|
63 |
+
2. **Reasoning Integration (Stage 2):** Specialized adaptation of DeepSeek R1's reasoning patterns with Korean-specific optimization through a meticulously curated dataset
|
64 |
+
3. **Advanced Refinement (Stage 3):** Reinforcement learning optimization using GRPO to perfect reasoning in both Korean and English, with comprehensive reward signals for format structure, factual accuracy, and language consistency
|
65 |
+
|
66 |
+
This methodical approach enables DNA-R1 to develop sophisticated chain-of-thought (CoT) reasoning for complex problem solving, resulting in a model finely calibrated for Korean language reasoning while maintaining robust general capabilities.
|
67 |
+
|
68 |
+
### Performance Highlights
|
69 |
+
|
70 |
+
Our Korean-specific multi-stage training pipeline significantly enhances the Phi-4 base model's understanding of Korean context, reasoning depth, and response capabilities. The model excels at:
|
71 |
+
|
72 |
+
- Generating nuanced Korean chains-of-thought (CoT)
|
73 |
+
- Performing rigorous self-verification
|
74 |
+
- Solving multi-step complex problems
|
75 |
+
- Maintaining cultural and linguistic context in reasoning
|
76 |
+
- Distinguishing between deep thinking and concise answers using the `<think>` and `<answer>` tags
|
77 |
+
|
78 |
+
## Evaluation Results
|
79 |
+
|
80 |
+
Below, we present our evaluation results for the DNA-R1 model across math, coding, science, Korean, and general-performance benchmarks.
|
81 |
+
Despite being only 14B in size, the DNA-R1 model demonstrates superior performance compared to many larger models across various benchmarks.
|
82 |
+
|
83 |
+
<table>
|
84 |
+
<thead>
|
85 |
+
<tr>
|
86 |
+
<th>Benchmark</th>
|
87 |
+
<th>Task</th>
|
88 |
+
<th>DNA-R1-14B v1.0</th>
|
89 |
+
<th>DeepSeek-R1-Distill-Qwen-14B</th>
|
90 |
+
<th>DeepSeek-R1-Distill-Qwen-32B</th>
|
91 |
+
<th>EXAONE-3.5-32B-Instruct<th>
|
92 |
+
<th>QwQ-32B-Preview</th>
|
93 |
+
<th>gpt-4o-0513</th>
|
94 |
+
<th>o1-mini</th>
|
95 |
+
<th>o1-preview</th>
|
96 |
+
</tr>
|
97 |
+
</thead>
|
98 |
+
<tbody>
|
99 |
+
<tr>
|
100 |
+
<td>GSM8K</td>
|
101 |
+
<td rowspan="4">Math</td>
|
102 |
+
<td><b>92.49</b></td>
|
103 |
+
<td>88.63</td>
|
104 |
+
<td>82.64</td>
|
105 |
+
<td><u>91.9</u></td>
|
106 |
+
<td>82.41</td>
|
107 |
+
<td>-</td>
|
108 |
+
<td>-</td>
|
109 |
+
<td>-</td>
|
110 |
+
</tr>
|
111 |
+
<tr>
|
112 |
+
<td>Math500</td>
|
113 |
+
<td><u>89.4</u></td>
|
114 |
+
<td>88.2</td>
|
115 |
+
<td>87.4</td>
|
116 |
+
<td>-</td>
|
117 |
+
<td><b>92.2</b></td>
|
118 |
+
<td>75.8</td>
|
119 |
+
<td>85.6</td>
|
120 |
+
<td>81.4</td>
|
121 |
+
</tr>
|
122 |
+
<tr>
|
123 |
+
<td>AIME2024</td>
|
124 |
+
<td>53.3</td>
|
125 |
+
<td><u>69.7</u></td>
|
126 |
+
<td><b>72.6</b></td>
|
127 |
+
<td>6.67</td>
|
128 |
+
<td>50.0</td>
|
129 |
+
<td>8.6</td>
|
130 |
+
<td>64.0</td>
|
131 |
+
<td>40</td>
|
132 |
+
</tr>
|
133 |
+
<tr>
|
134 |
+
<td>OlympiadBench (Math, EN)</td>
|
135 |
+
<td><u>59.3</u></td>
|
136 |
+
<td>56.82</td>
|
137 |
+
<td>55.34</td>
|
138 |
+
<td>-</td>
|
139 |
+
<td><b>62.17</b></td>
|
140 |
+
<td>-</td>
|
141 |
+
<td>-</td>
|
142 |
+
<td>59.2</td>
|
143 |
+
</tr>
|
144 |
+
<tr>
|
145 |
+
<td>GPQA-Diamond</td>
|
146 |
+
<td>Science/Reasoning</td>
|
147 |
+
<td><u>61.11</u></td>
|
148 |
+
<td>59.1</td>
|
149 |
+
<td>58.08</td>
|
150 |
+
<td>33.33</td>
|
151 |
+
<td>52.5</td>
|
152 |
+
<td>46.5</td>
|
153 |
+
<td>60</td>
|
154 |
+
<td><b>75.2</b></td>
|
155 |
+
</tr>
|
156 |
+
<tr>
|
157 |
+
<td>LiveCodeBench</td>
|
158 |
+
<td>Coding</td>
|
159 |
+
<td>50.58</td>
|
160 |
+
<td>59.88</td>
|
161 |
+
<td><u>61.65</u></td>
|
162 |
+
<td>-</td>
|
163 |
+
<td>59.12</td>
|
164 |
+
<td>50.48</td>
|
165 |
+
<td><b>72.75</b></td>
|
166 |
+
<td>59.14</td>
|
167 |
+
</tr>
|
168 |
+
<tr>
|
169 |
+
<td>KMMLU-direct</td>
|
170 |
+
<td rowspan="3">Korean</td>
|
171 |
+
<td><u>59.9</u></td>
|
172 |
+
<td>50.5</td>
|
173 |
+
<td>58.62</td>
|
174 |
+
<td>-</td>
|
175 |
+
<td><b>62.96</b></td>
|
176 |
+
<td>-</td>
|
177 |
+
<td>-</td>
|
178 |
+
<td>-</td>
|
179 |
+
</tr>
|
180 |
+
<tr>
|
181 |
+
<td>KMMLU-hard</td>
|
182 |
+
<td><u>36.65</u></td>
|
183 |
+
<td>25.34</td>
|
184 |
+
<td>33.67</td>
|
185 |
+
<td>-</td>
|
186 |
+
<td><b>37.98</b></td>
|
187 |
+
<td>-</td>
|
188 |
+
<td>-</td>
|
189 |
+
<td>-</td>
|
190 |
+
</tr>
|
191 |
+
<tr>
|
192 |
+
<td>KoBEST</td>
|
193 |
+
<td><u>83.05</u></td>
|
194 |
+
<td>74.32</td>
|
195 |
+
<td>78.53</td>
|
196 |
+
<td>-</td>
|
197 |
+
<td><b>85.93</b></td>
|
198 |
+
<td>-</td>
|
199 |
+
<td>-</td>
|
200 |
+
<td>-</td>
|
201 |
+
</tr>
|
202 |
+
<tr>
|
203 |
+
<td>MMLU-Pro</td>
|
204 |
+
<td rowspan="3">General</td>
|
205 |
+
<td><u>57.64</u></td>
|
206 |
+
<td>50.55</td>
|
207 |
+
<td><b>59.58</b></td>
|
208 |
+
<td>-</td>
|
209 |
+
<td>46.82</td>
|
210 |
+
<td>-</td>
|
211 |
+
<td>-</td>
|
212 |
+
<td>-</td>
|
213 |
+
</tr>
|
214 |
+
</tbody>
|
215 |
+
</table>
|
216 |
+
|
217 |
+
- The *highest* *scores* are in **bold** form, and the *second*\-*highest* *scores* are <u>underlined</u>.
|
218 |
+
- All benchmarks are evaluated with [lm-eval](https://github.com/EleutherAI/lm-evaluation-harness) and [skythought-eval](https://github.com/NovaSky-AI/SkyThought/tree/main/skythought/evals).
|
219 |
+
|
220 |
+
## Quickstart
|
221 |
+
|
222 |
+
```python
|
223 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
|
224 |
+
|
225 |
+
tokenizer = AutoTokenizer.from_pretrained('dnotitia/DNA-R1')
|
226 |
+
model = AutoModelForCausalLM.from_pretrained('dnotitia/DNA-R1', device_map='auto')
|
227 |
+
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
|
228 |
+
|
229 |
+
conversation = [
|
230 |
+
{"role": "user", "content": """
|
231 |
+
์ด๋ ค์๋ถํฐ ์ฐ๋ฆฌ ์ง์ ๊ฐ๋ํ์๊ณ
|
232 |
+
๋จ๋ค ๋คํ๋ ์ธ์ ๋ช ๋ฒ ํ ์ ์ด ์์๊ณ
|
233 |
+
์ผํฐ์ ๋๊ฐ์ ์ด๋จธ๋ ์ง์ ์์ผ๋ฉด
|
234 |
+
์ธ์ ๋ ํผ์์ ๋์ฌ ๋จน์๋ ๋ผ๋ฉด
|
235 |
+
๊ทธ๋ฌ๋ค ๋ผ๋ฉด์ด ๋๋ฌด ์ง๊ฒจ์์
|
236 |
+
๋ง์๋ ๊ฒ ์ข ๋จน์๊ณ ๋๋ค์์์ด
|
237 |
+
๊ทธ๋ฌ์ ์ด๋จธ๋์ด ๋ง์ง๋ชปํด ๊บผ๋ด์
|
238 |
+
์จ๊ฒจ๋์ ๋น์๊ธ์ผ๋ก ์์ผ์ฃผ์
|
239 |
+
์ง์ฅ๋ฉด ํ๋์ ๋๋ฌด๋ ํ๋ณตํ์์ด
|
240 |
+
ํ์ง๋ง ์ด๋จธ๋์ ์ ์ง ๋์์ง ์์์ด
|
241 |
+
์ด๋จธ๋์ ์ง์ฅ๋ฉด์ด ์ซ๋ค๊ณ ํ์
จ์ด
|
242 |
+
์ด๋จธ๋์ ์ง์ฅ๋ฉด์ด ์ซ๋ค๊ณ ํ์
จ์ด
|
243 |
+
์ผ์ด์ผ~์ผ ๊ทธ๋ ๊ฒ ์ด์๊ฐ๊ณ
|
244 |
+
๊ทธ๋ ๊ฒ ํํํ๊ณ ๋๋ฌผ๋ ํ๋ฆฌ๊ณ
|
245 |
+
์ผ์ด์ผ~์ผ ๊ทธ๋ ๊ฒ ์ด์๊ฐ๊ณ
|
246 |
+
๋๋ฌด๋ ์ํ๊ณ ํ์ง๋ง ๋ค์ ์๊ณ
|
247 |
+
---
|
248 |
+
์น๊ตฌ๊ฐ ์ด ์์ธ๋ฐ, ์ฌ๊ธฐ์ ์น๊ตฌ์ ์ด๋จธ๋๊ฐ ์ง์ฅ๋ฉด์ด ์ซ๋ค๊ณ ํ์ ์ด์ ๋?"""},
|
249 |
+
]
|
250 |
+
inputs = tokenizer.apply_chat_template(conversation,
|
251 |
+
add_generation_prompt=True,
|
252 |
+
return_dict=True,
|
253 |
+
return_tensors="pt").to(model.device)
|
254 |
+
_ = model.generate(**inputs, streamer=streamer)
|
255 |
+
```
|
256 |
+
|
257 |
+
|
258 |
+
## License
|
259 |
+
|
260 |
+
This model is released under CC BY-NC 4.0 license. If you have any questions or commercial usage inquiries, please [Contact us](https://www.dnotitia.com/contact/post-form).
|
261 |
+
|
262 |
+
## Citation
|
263 |
+
|
264 |
+
If you use or discuss this model in your academic research, please cite the project to help spread awareness:
|
265 |
+
|
266 |
+
```
|
267 |
+
@misc{dnar12025,
|
268 |
+
title={DNA R1},
|
269 |
+
author={Jungyup Lee and Jemin Kim and Sang Park and SeungJae Lee},
|
270 |
+
year={2025},
|
271 |
+
publisher={HuggingFace},
|
272 |
+
url={https://huggingface.co/dnotitia/DNA-R1}
|
273 |
+
}
|
274 |
+
```
|
assets/dna-r1-logo.png
ADDED
![]() |
assets/dna-r1-pipeline.png
ADDED
![]() |