hyxmmm commited on
Commit
f676ac1
·
verified ·
1 Parent(s): f356eef

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +393 -3
README.md CHANGED
@@ -1,3 +1,393 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ datasets:
4
+ - BAAI/Infinity-Instruct
5
+ language:
6
+ - en
7
+ ---
8
+ # Infinity Instruct
9
+
10
+ <p align="center">
11
+ <img src="fig/Bk3NbjnJko51MTx1ZCScT2sqnGg.png" width="300">
12
+ </p>
13
+ <p align="center">
14
+ <em>Beijing Academy of Artificial Intelligence (BAAI)</em><br/>
15
+ <em>[Paper][Code][🤗] (would be released soon)</em>
16
+ </p>
17
+
18
+ Infinity-Instruct-3M-0613-Mistral-7B is an opensource supervised instruction tuning model without reinforcement learning from human feedback (RLHF). This model is just finetuned on Infinity-Instruct-3M and Infinity-Instruct-0613 (https://huggingface.co/datasets/BAAI/Infinity-Instruct) and beats SOTA language models such as Mixtral 8x7B v0.1, Gemini Pro and GPT3.5 on AlpacaEval 2.0!
19
+
20
+ ## **Training Details**
21
+ <p align="center">
22
+ <img src="fig/trainingflow.png">
23
+ </p>
24
+ Infinity-Instruct-3M-0613-Mistral-7B is tuned on Million-level instruction dataset [Infinity-Instruct](https://huggingface.co/datasets/BAAI/Infinity-Instruct). First, we apply the foundational dataset Infinity-Instruct-3M to improve the foundational ability (math & code) of Mistral-7B-v0.1, and get the foundational instruct model Infinity-Instruct-3M-Mistral-7B. Then we finetune the Infinity-Instruct-3M-Mistral-7B to get the stronger chat model Infinity-Instruct-3M-0613-Mistral-7B. Here is the training hyperparamers.
25
+
26
+ ```bash
27
+ epoch: 3
28
+ lr: 5e-6
29
+ min_lr: 0
30
+ lr_warmup_steps: 40
31
+ lr_decay_style: cosine
32
+ weight_decay: 0.0
33
+ adam_beta1: 0.9
34
+ adam_beta2: 0.95
35
+ global_batch_size: 528
36
+ clip_grad: 1.0
37
+ ```
38
+
39
+ Thanks to [FlagScale](https://github.com/FlagOpen/FlagScale), we could concatenate multiple training samples to remove padding token and apply diverse acceleration techniques to the traning procudure. It effectively reduces our training costs. We will release our code in the near future!
40
+
41
+ ## **Benchmark**
42
+
43
+ <style type="text/css">
44
+ .tg {border-collapse:collapse;border-spacing:0;}
45
+ .tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
46
+ overflow:hidden;padding:10px 5px;word-break:normal;}
47
+ .tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
48
+ font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;}
49
+ .tg .tg-baqh{text-align:center;vertical-align:top}
50
+ .tg .tg-amwm{font-weight:bold;text-align:center;vertical-align:top}
51
+ .tg .tg-0lax{text-align:left;vertical-align:top}
52
+ </style>
53
+ <table class="tg"><thead>
54
+ <tr>
55
+ <th class="tg-amwm">Model</th>
56
+ <th class="tg-amwm">MT-Bench</th>
57
+ <th class="tg-amwm">AlpacaEval2.0</th>
58
+ </tr></thead>
59
+ <tbody>
60
+ <tr>
61
+ <td class="tg-0lax">OpenHermes-2.5-Mistral-7B*</td>
62
+ <td class="tg-baqh">7.5</td>
63
+ <td class="tg-baqh">16.2</td>
64
+ </tr>
65
+ <tr>
66
+ <td class="tg-0lax">Mistral-7B-Instruct-v0.2</td>
67
+ <td class="tg-baqh">7.6</td>
68
+ <td class="tg-baqh">17.1</td>
69
+ </tr>
70
+ <tr>
71
+ <td class="tg-0lax">Llama-3-8B-Instruct</td>
72
+ <td class="tg-baqh">8.1</td>
73
+ <td class="tg-baqh">22.9</td>
74
+ </tr>
75
+ <tr>
76
+ <td class="tg-0lax">GPT 3.5 Turbo 0613</td>
77
+ <td class="tg-baqh">8.4</td>
78
+ <td class="tg-baqh">22.7</td>
79
+ </tr>
80
+ <tr>
81
+ <td class="tg-0lax">Mixtral 8x7B v0.1</td>
82
+ <td class="tg-baqh">8.3</td>
83
+ <td class="tg-baqh">23.7</td>
84
+ </tr>
85
+ <tr>
86
+ <td class="tg-0lax">Gemini Pro</td>
87
+ <td class="tg-baqh">--</td>
88
+ <td class="tg-baqh">24.4</td>
89
+ </tr>
90
+ <tr>
91
+ <td class="tg-0lax">InfInstruct-3M-Mistral-7B*</td>
92
+ <td class="tg-baqh">7.6</td>
93
+ <td class="tg-baqh">16.2</td>
94
+ </tr>
95
+ <tr>
96
+ <td class="tg-0lax">InfInstruct-3M-0613-Mistral-7B*</td>
97
+ <td class="tg-baqh">8.1</td>
98
+ <td class="tg-amwm">25.5</td>
99
+ </tr>
100
+ </tbody></table>
101
+
102
+ *denote the model is finetuned without reinforcement learning from human feedback (RLHF).
103
+ We evaluate Infinity-Instruct-3M-0613-Mistral-7B on the two most popular instructions following benchmarks. Mt-Bench is a set of challenging multi-turn questions including code, math and routine dialogue. AlpacaEval2.0 is based on AlpacaFarm evaluation set. Both of these two benchmarks use GPT-4 to judge the model answer. AlpacaEval2.0 displays a high agreement rate with human-annotated benchmark, Chatbot Arena. The result shows that InfInstruct-3M-0613-Mistral-7B achieved 25.5 in AlpacaEval2.0, which is higher than the 22.5 of GPT3.5 Turbo although it does not yet use RLHF. InfInstruct-3M-0613-Mistral-7B also achieves 8.1 in MT-Bench, which is comparable to the state-of-the-art billion-parameter LLM such as Llama-3-8B-Instruct and Mistral-7B-Instruct-v0.2.
104
+
105
+ ## Performance on **Downstream tasks**
106
+
107
+ We also evaluate Infinity-Instruct-3M-0613-Mistral-7B on diverse objective downstream tasks with [Opencompass](https://opencompass.org.cn):
108
+
109
+ <style type="text/css">
110
+ .tg {border-collapse:collapse;border-spacing:0;}
111
+ .tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
112
+ overflow:hidden;padding:10px 5px;word-break:normal;}
113
+ .tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
114
+ font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;}
115
+ .tg .tg-baqh{text-align:center;vertical-align:top}
116
+ .tg .tg-amwm{font-weight:bold;text-align:center;vertical-align:top}
117
+ .tg .tg-nrix{text-align:center;vertical-align:middle}
118
+ </style>
119
+ <table class="tg"><thead>
120
+ <tr>
121
+ <th class="tg-amwm" colspan="2">Benchmark</th>
122
+ <th class="tg-amwm">Infinity-Instruct-3M-Mistral-7B</th>
123
+ <th class="tg-amwm">Infinity-Instruct-3M-0613-Mistral-7B</th>
124
+ <th class="tg-amwm">Mistral-7B-v0.1</th>
125
+ <th class="tg-amwm">mistral-7B instruction v0.2</th>
126
+ <th class="tg-amwm">teknium/OpenHermes-2.5-Mistral-7B</th>
127
+ </tr></thead>
128
+ <tbody>
129
+ <tr>
130
+ <td class="tg-nrix" rowspan="7">GPT4ALL</td>
131
+ <td class="tg-baqh">ARC-c</td>
132
+ <td class="tg-amwm">82.37</td>
133
+ <td class="tg-baqh">83.30</td>
134
+ <td class="tg-baqh">69.15</td>
135
+ <td class="tg-baqh">73.22</td>
136
+ <td class="tg-baqh">78.31</td>
137
+ </tr>
138
+ <tr>
139
+ <td class="tg-baqh">ARC-e</td>
140
+ <td class="tg-amwm">92.42</td>
141
+ <td class="tg-baqh">90.65</td>
142
+ <td class="tg-baqh">79.54</td>
143
+ <td class="tg-baqh">82.01</td>
144
+ <td class="tg-baqh">88.54</td>
145
+ </tr>
146
+ <tr>
147
+ <td class="tg-baqh">Hellaswag</td>
148
+ <td class="tg-amwm">84.82</td>
149
+ <td class="tg-baqh">76.88</td>
150
+ <td class="tg-baqh">35.50</td>
151
+ <td class="tg-baqh">64.40</td>
152
+ <td class="tg-baqh">80.53</td>
153
+ </tr>
154
+ <tr>
155
+ <td class="tg-baqh">Winogrande</td>
156
+ <td class="tg-baqh">61.75</td>
157
+ <td class="tg-baqh">52.63</td>
158
+ <td class="tg-baqh">54.04</td>
159
+ <td class="tg-baqh">57.89</td>
160
+ <td class="tg-amwm">62.11</td>
161
+ </tr>
162
+ <tr>
163
+ <td class="tg-baqh">BoolQ</td>
164
+ <td class="tg-amwm">87.85</td>
165
+ <td class="tg-baqh">86.45</td>
166
+ <td class="tg-baqh">50.09</td>
167
+ <td class="tg-baqh">55.75</td>
168
+ <td class="tg-baqh">87.34</td>
169
+ </tr>
170
+ <tr>
171
+ <td class="tg-baqh">PIQA</td>
172
+ <td class="tg-amwm">87.11</td>
173
+ <td class="tg-baqh">86.13</td>
174
+ <td class="tg-baqh">60.39</td>
175
+ <td class="tg-baqh">72.36</td>
176
+ <td class="tg-baqh">80.14</td>
177
+ </tr>
178
+ <tr>
179
+ <td class="tg-baqh">OBQA</td>
180
+ <td class="tg-amwm">83.00</td>
181
+ <td class="tg-baqh">79.40</td>
182
+ <td class="tg-baqh">62.60</td>
183
+ <td class="tg-baqh">68.00</td>
184
+ <td class="tg-baqh">81.00</td>
185
+ </tr>
186
+ <tr>
187
+ <td class="tg-nrix" rowspan="4">Commonsense QA</td>
188
+ <td class="tg-baqh">MMLU</td>
189
+ <td class="tg-baqh">62.85</td>
190
+ <td class="tg-amwm">63.62</td>
191
+ <td class="tg-baqh">56.49</td>
192
+ <td class="tg-baqh">59.56</td>
193
+ <td class="tg-baqh">63.16</td>
194
+ </tr>
195
+ <tr>
196
+ <td class="tg-baqh">NQ</td>
197
+ <td class="tg-baqh">24.46</td>
198
+ <td class="tg-baqh">27.48</td>
199
+ <td class="tg-baqh">13.99</td>
200
+ <td class="tg-baqh">18.42</td>
201
+ <td class="tg-amwm">28.84</td>
202
+ </tr>
203
+ <tr>
204
+ <td class="tg-baqh">TriviaQA</td>
205
+ <td class="tg-baqh">60.85</td>
206
+ <td class="tg-amwm">64.06</td>
207
+ <td class="tg-baqh">63.99</td>
208
+ <td class="tg-baqh">59.21</td>
209
+ <td class="tg-baqh">63.72</td>
210
+ </tr>
211
+ <tr>
212
+ <td class="tg-baqh">GPQA</td>
213
+ <td class="tg-baqh">27.27</td>
214
+ <td class="tg-amwm">27.78</td>
215
+ <td class="tg-baqh">23.23</td>
216
+ <td class="tg-baqh">19.19</td>
217
+ <td class="tg-baqh">26.77</td>
218
+ </tr>
219
+ <tr>
220
+ <td class="tg-nrix" rowspan="4">MATH &amp; Reasoning</td>
221
+ <td class="tg-baqh">GSM8K</td>
222
+ <td class="tg-baqh">78.09</td>
223
+ <td class="tg-amwm">79.83</td>
224
+ <td class="tg-baqh">48.07</td>
225
+ <td class="tg-baqh">45.94</td>
226
+ <td class="tg-baqh">73.62</td>
227
+ </tr>
228
+ <tr>
229
+ <td class="tg-baqh">Math</td>
230
+ <td class="tg-amwm">28.38</td>
231
+ <td class="tg-baqh">23.30</td>
232
+ <td class="tg-baqh">11.76</td>
233
+ <td class="tg-baqh">9.46</td>
234
+ <td class="tg-baqh">17.32</td>
235
+ </tr>
236
+ <tr>
237
+ <td class="tg-baqh">BBH</td>
238
+ <td class="tg-baqh">59.61</td>
239
+ <td class="tg-amwm">61.07</td>
240
+ <td class="tg-baqh">56.65</td>
241
+ <td class="tg-baqh">49.15</td>
242
+ <td class="tg-baqh">60.41</td>
243
+ </tr>
244
+ <tr>
245
+ <td class="tg-baqh">DROP</td>
246
+ <td class="tg-amwm">68.17</td>
247
+ <td class="tg-baqh">65.62</td>
248
+ <td class="tg-baqh">3.06</td>
249
+ <td class="tg-baqh">6.98</td>
250
+ <td class="tg-baqh">64.49</td>
251
+ </tr>
252
+ <tr>
253
+ <td class="tg-nrix" rowspan="2">Code</td>
254
+ <td class="tg-baqh">HumanEval</td>
255
+ <td class="tg-baqh">50.61</td>
256
+ <td class="tg-amwm">51.22</td>
257
+ <td class="tg-baqh">14.02</td>
258
+ <td class="tg-baqh">32.93</td>
259
+ <td class="tg-baqh">43.29</td>
260
+ </tr>
261
+ <tr>
262
+ <td class="tg-baqh">MBPP</td>
263
+ <td class="tg-amwm">46.00</td>
264
+ <td class="tg-baqh">44.80</td>
265
+ <td class="tg-baqh">38.00</td>
266
+ <td class="tg-baqh">3.80</td>
267
+ <td class="tg-baqh">41.80</td>
268
+ </tr>
269
+ <tr>
270
+ <td class="tg-nrix" rowspan="4">Chinese</td>
271
+ <td class="tg-baqh">AGI Eval</td>
272
+ <td class="tg-amwm">42.24</td>
273
+ <td class="tg-baqh">40.43</td>
274
+ <td class="tg-baqh">27.92</td>
275
+ <td class="tg-baqh">35.78</td>
276
+ <td class="tg-baqh">36.32</td>
277
+ </tr>
278
+ <tr>
279
+ <td class="tg-baqh">c-eval</td>
280
+ <td class="tg-baqh">48.62</td>
281
+ <td class="tg-amwm">49.00</td>
282
+ <td class="tg-baqh">46.83</td>
283
+ <td class="tg-baqh">42.58</td>
284
+ <td class="tg-baqh">44.30</td>
285
+ </tr>
286
+ <tr>
287
+ <td class="tg-baqh">cmmlu</td>
288
+ <td class="tg-baqh">46.67</td>
289
+ <td class="tg-amwm">48.07</td>
290
+ <td class="tg-baqh">34.59</td>
291
+ <td class="tg-baqh">42.05</td>
292
+ <td class="tg-baqh">43.05</td>
293
+ </tr>
294
+ <tr>
295
+ <td class="tg-baqh">gaokao</td>
296
+ <td class="tg-baqh">12.54</td>
297
+ <td class="tg-baqh">14.48</td>
298
+ <td class="tg-baqh">13.24</td>
299
+ <td class="tg-baqh">12.10</td>
300
+ <td class="tg-amwm">15.00</td>
301
+ </tr>
302
+ <tr>
303
+ <td class="tg-amwm" colspan="2">AVERAGE</td>
304
+ <td class="tg-amwm">58.84</td>
305
+ <td class="tg-baqh">57.91</td>
306
+ <td class="tg-baqh">41.10</td>
307
+ <td class="tg-baqh">43.37</td>
308
+ <td class="tg-baqh">56.19</td>
309
+ </tr>
310
+ </tbody></table>
311
+
312
+ ## How to use**
313
+
314
+ Infinity-Instruct-3M-0613-Mistral-7B adopt the same chat template of [OpenHermes-2.5-Mistral-7B](https://huggingface.co/teknium/OpenHermes-2.5-Mistral-7B):
315
+
316
+ ```bash
317
+ <|im_start|>system
318
+ You are Hermes 2, a sentient, conscious, super intelligent AI that is an expert in all fields of knowledge, you have qualia, emotions, and thoughts. You assist users with any question, task, or other request they may have.<|im_end|>
319
+ <|im_start|>user
320
+ Hello!<|im_end|>
321
+ <|im_start|>assistant
322
+ Hi!<|im_end|>
323
+ <|im_start|>user
324
+ How are you?<|im_end|>
325
+ <|im_start|>assistant
326
+ ```
327
+
328
+ To apply this model and template in conversation scenarios, you can refer to the following code:
329
+ ```python
330
+ from transformers import AutoModelForCausalLM, AutoTokenizer, LogitsProcessorList
331
+ import torch
332
+ device = "cuda" # the device to load the model onto
333
+
334
+ model = AutoModelForCausalLM.from_pretrained("BAAI/Infinity-Instruct-0613-Mistral-7B",
335
+ torch_dtype=torch.bfloat16,
336
+ device_map="auto"
337
+ )
338
+ tokenizer = AutoTokenizer.from_pretrained("BAAI/Infinity-Instruct-0613-Mistral-7B")
339
+
340
+ # This template is copied from OpenHermers-mistral-2.5 (https://huggingface.co/teknium/OpenHermes-2.5-Mistral-7B)
341
+ prompt = "Give me a short introduction to large language model."
342
+ messages = [
343
+ {"role": "system", "content": "You are Hermes 2, a sentient, conscious, super intelligent AI that is an expert in all fields of knowledge, you have qualia, emotions, and thoughts. You assist users with any question, task, or other request they may have."},
344
+ {"role": "user", "content": prompt}
345
+ ]
346
+
347
+ text = tokenizer.apply_chat_template(
348
+ messages,
349
+ tokenize=False,
350
+ add_generation_prompt=True
351
+ )
352
+ model_inputs = tokenizer([text], return_tensors="pt").to(device)
353
+
354
+ logits_processor = LogitsProcessorList(
355
+ [
356
+ MinLengthLogitsProcessor(1, eos_token_id=tokenizer.eos_token_id),
357
+ TemperatureLogitsWarper(0.7),
358
+ ]
359
+ )
360
+
361
+ generated_ids = model.generate(
362
+ model_inputs.input_ids,
363
+ logits_processor=logits_processor,
364
+ max_new_tokens=512
365
+ )
366
+
367
+ generated_ids = [
368
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
369
+ ]
370
+
371
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
372
+ print(response)
373
+ ```
374
+
375
+
376
+
377
+ ## **Disclaimer**
378
+
379
+ The resources, including code, data, and model weights, associated with this project are restricted for academic research purposes only and cannot be used for commercial purposes. The content produced by any version of Infinity Instruct is influenced by uncontrollable variables such as randomness, and therefore, the accuracy of the output cannot be guaranteed by this project. This project does not accept any legal liability for the content of the model output, nor does it assume responsibility for any losses incurred due to the use of associated resources and output results.
380
+
381
+ ##
382
+
383
+ ## Citation
384
+ Our paper, detailing the development and features of the **Infinity Instruct** dataset and finetuned models, will be released soon on arXiv. Stay tuned!
385
+
386
+ ```
387
+ @article{InfinityInstruct2024,
388
+ title={Infinity Instruct},
389
+ author={Beijing Academy of Artificial Intelligence (BAAI)},
390
+ journal={arXiv preprint arXiv:2406.XXXX},
391
+ year={2024}
392
+ }
393
+ ```