FrankC0st1e commited on
Commit
6c769fa
1 Parent(s): 43b498b

update readme

Browse files
Files changed (1) hide show
  1. README.md +267 -0
README.md CHANGED
@@ -1,3 +1,270 @@
1
  ---
2
  license: apache-2.0
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
  ---
4
+ <div align="center">
5
+ <img src="https://github.com/OpenBMB/MiniCPM/tree/main/assets/minicpm_logo.png" width="500em" ></img>
6
+ </div>
7
+
8
+ <p align="center">
9
+ <a href="https://github.com/OpenBMB/MiniCPM/" target="_blank">MiniCPM Repo</a> |
10
+ <a href="https://arxiv.org/abs/2404.06395" target="_blank">MiniCPM Paper</a> |
11
+ <a href="https://github.com/OpenBMB/MiniCPM-V/" target="_blank">MiniCPM-V Repo</a> |
12
+ Join us in <a href="https://discord.gg/3cGQn9b3YM" target="_blank">Discord</a> and <a href="https://github.com/OpenBMB/MiniCPM/blob/main/assets/wechat.jpg" target="_blank">WeChat</a>
13
+
14
+ </p>
15
+
16
+ ## Introduction
17
+ MiniCPM3-4B is the 3rd generation of MiniCPM series. The overall performance of MiniCPM3-4B surpasses Phi-3.5-mini-Instruct and GPT-3.5-Turbo-0125, being comparable with many recent 7B~9B models.
18
+
19
+ Compared to MiniCPM1.0/MiniCPM2.0, MiniCPM3-4B has a more powerful and versatile skill set to enable more general usage. MiniCPM3-4B supports function call, along with code interpreter. Please refer to []() for usage guidelines.
20
+
21
+ MiniCPM3-4B has a 32k context window. Equipped with LLMxMapreduce, MiniCPM3-4B can handle infinite contexts theoretically, without requiring huge amount of memory.
22
+
23
+ ## Usage
24
+ ```python
25
+
26
+ from transformers import AutoModelForCausalLM, AutoTokenizer
27
+ import torch
28
+
29
+ path = "openbmb/MiniCPM3-4B"
30
+ device = "cuda"
31
+
32
+ tokenizer = AutoTokenizer.from_pretrained(path, trust_remote_code=True)
33
+ model = AutoModelForCausalLM.from_pretrained(path, torch_dtype=torch.bfloat16, device_map=device, trust_remote_code=True)
34
+
35
+ messages = [
36
+ {"role": "user", "content": "推荐5个北京的景点。"},
37
+ ]
38
+ model_inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to(device)
39
+
40
+ model_outputs = model.generate(
41
+ model_inputs,
42
+ max_new_tokens=1024,
43
+ top_p=0.7,
44
+ temperature=0.7,
45
+ repetition_penalty=1.02
46
+ )
47
+
48
+ output_token_ids = [
49
+ model_outputs[i][len(model_inputs[i]):] for i in range(len(model_inputs))
50
+ ]
51
+
52
+ responses = tokenizer.batch_decode(output_token_ids, skip_special_tokens=True)[0]
53
+ print(responses)
54
+ ```
55
+
56
+ ## Evaluation Results
57
+
58
+ <table>
59
+ <tr>
60
+ <td>Benchmark</td>
61
+ <td>Qwen2-7B-Instruct</td>
62
+ <td>GLM-4-9B-Chat</td>
63
+ <td>Gemma2-9B-it</td>
64
+ <td>Llama3.1-8B-Instruct</td>
65
+ <td>GPT-3.5-Turbo-0125</td>
66
+ <td>Phi-3.5-mini-Instruct(3.8B)</td>
67
+ <td>MiniCPM3-4B </td>
68
+ </tr>
69
+ <tr>
70
+ <td colspan="15" align="left"><strong>English</strong></td>
71
+ </tr>
72
+ <tr>
73
+ <td>MMLU</td>
74
+ <td>70.5</td>
75
+ <td>72.4</td>
76
+ <td>72.6</td>
77
+ <td>69.4</td>
78
+ <td>69.2</td>
79
+ <td>68.4</td>
80
+ <td>67.2 </td>
81
+ </tr>
82
+ <tr>
83
+ <td>BBH</td>
84
+ <td>64.9</td>
85
+ <td>76.3</td>
86
+ <td>65.2</td>
87
+ <td>67.8</td>
88
+ <td>70.3</td>
89
+ <td>68.6</td>
90
+ <td>70.2 </td>
91
+ </tr>
92
+ <tr>
93
+ <td>MT-Bench</td>
94
+ <td>8.41</td>
95
+ <td>8.35</td>
96
+ <td>7.88</td>
97
+ <td>8.28</td>
98
+ <td>8.17</td>
99
+ <td>8.60</td>
100
+ <td>8.41 </td>
101
+ </tr>
102
+ <tr>
103
+ <td>IFEVAL (Prompt Strict-Acc.)</td>
104
+ <td>51.0</td>
105
+ <td>64.5</td>
106
+ <td>71.9</td>
107
+ <td>71.5</td>
108
+ <td>58.8</td>
109
+ <td>49.4</td>
110
+ <td>68.4 </td>
111
+ </tr>
112
+ <tr>
113
+ <td colspan="15" align="left"><strong>Chinese</strong></td>
114
+ </tr>
115
+ <tr>
116
+ <td>CMMLU</td>
117
+ <td>80.9</td>
118
+ <td>71.5</td>
119
+ <td>59.5</td>
120
+ <td>55.8</td>
121
+ <td>54.5</td>
122
+ <td>46.9</td>
123
+ <td>73.3 </td>
124
+ </tr>
125
+ <tr>
126
+ <td>CEVAL</td>
127
+ <td>77.2</td>
128
+ <td>75.6</td>
129
+ <td>56.7</td>
130
+ <td>55.2</td>
131
+ <td>52.8</td>
132
+ <td>46.1</td>
133
+ <td>73.6 </td>
134
+ </tr>
135
+ <tr>
136
+ <td>AlignBench v1.1</td>
137
+ <td>7.10</td>
138
+ <td>6.61</td>
139
+ <td>7.10</td>
140
+ <td>5.68</td>
141
+ <td>5.82</td>
142
+ <td>5.73</td>
143
+ <td>6.74 </td>
144
+ </tr>
145
+ <tr>
146
+ <td>FollowBench-zh (SSR)</td>
147
+ <td>63.0</td>
148
+ <td>56.4</td>
149
+ <td>57.0</td>
150
+ <td>50.6</td>
151
+ <td>64.6</td>
152
+ <td>58.1</td>
153
+ <td>66.8 </td>
154
+ </tr>
155
+ <tr>
156
+ <td colspan="15" align="left"><strong>Math</strong></td>
157
+ </tr>
158
+ <tr>
159
+ <td>MATH</td>
160
+ <td>49.6</td>
161
+ <td>50.6</td>
162
+ <td>46.0</td>
163
+ <td>51.9</td>
164
+ <td>41.8</td>
165
+ <td>46.4</td>
166
+ <td>46.6 </td>
167
+ </tr>
168
+ <tr>
169
+ <td>GSM8K</td>
170
+ <td>82.3</td>
171
+ <td>79.6</td>
172
+ <td>79.7</td>
173
+ <td>84.5</td>
174
+ <td>76.4</td>
175
+ <td>82.7</td>
176
+ <td>81.1 </td>
177
+ </tr>
178
+ <tr>
179
+ <td>MathBench</td>
180
+ <td>63.4</td>
181
+ <td>59.4</td>
182
+ <td>45.8</td>
183
+ <td>54.3</td>
184
+ <td>48.9</td>
185
+ <td>54.9</td>
186
+ <td>65.6 </td>
187
+ </tr>
188
+ <tr>
189
+ <td colspan="15" align="left"><strong>Code</strong></td>
190
+ </tr>
191
+ <tr>
192
+ <td>HumanEval+</td>
193
+ <td>70.1</td>
194
+ <td>67.1</td>
195
+ <td>61.6</td>
196
+ <td>62.8</td>
197
+ <td>66.5</td>
198
+ <td>68.9</td>
199
+ <td>68.3 </td>
200
+ </tr>
201
+ <tr>
202
+ <td>MBPP+</td>
203
+ <td>57.1</td>
204
+ <td>62.2</td>
205
+ <td>64.3</td>
206
+ <td>55.3</td>
207
+ <td>71.4</td>
208
+ <td>55.8</td>
209
+ <td>63.2 </td>
210
+ </tr>
211
+ <tr>
212
+ <td>LiveCodeBench</td>
213
+ <td>22.2</td>
214
+ <td>20.2</td>
215
+ <td>19.2</td>
216
+ <td>20.4</td>
217
+ <td>24.0</td>
218
+ <td>19.6</td>
219
+ <td>22.6 </td>
220
+ </tr>
221
+ <tr>
222
+ <td colspan="15" align="left"><strong>Function Call</strong></td>
223
+ </tr>
224
+ <tr>
225
+ <td>BFCL</td>
226
+ <td>71.6</td>
227
+ <td>70.1</td>
228
+ <td>19.2</td>
229
+ <td>73.3</td>
230
+ <td>75.4</td>
231
+ <td>48.4</td>
232
+ <td>76.0 </td>
233
+ </tr>
234
+ <tr>
235
+ <td colspan="15" align="left"><strong>Overall</strong></td>
236
+ </tr>
237
+ <tr>
238
+ <td>Average</td>
239
+ <td>65.3</td>
240
+ <td>65.0</td>
241
+ <td>57.9</td>
242
+ <td>60.8</td>
243
+ <td>61.0</td>
244
+ <td>57.2</td>
245
+ <td><strong>66.3</strong></td>
246
+ </tr>
247
+ </table>
248
+
249
+
250
+ ## Statement
251
+ * As a language model, MiniCPM3-4B generates content by learning from a vast amount of text.
252
+ * However, it does not possess the ability to comprehend or express personal opinions or value judgments.
253
+ * Any content generated by MiniCPM3-4B does not represent the viewpoints or positions of the model developers.
254
+ * Therefore, when using content generated by MiniCPM3-4B, users should take full responsibility for evaluating and verifying it on their own.
255
+
256
+ ## LICENSE
257
+ * This repository is released under the [Apache-2.0](https://github.com/OpenBMB/MiniCPM/blob/main/LICENSE) License.
258
+ * The usage of MiniCPM3-4B model weights must strictly follow [MiniCPM Model License.md](https://github.com/OpenBMB/MiniCPM/blob/main/MiniCPM%20Model%20License.md).
259
+ * The models and weights of MiniCPM3-4B are completely free for academic research. after filling out a ["questionnaire"](https://modelbest.feishu.cn/share/base/form/shrcnpV5ZT9EJ6xYjh3Kx0J6v8g) for registration, are also available for free commercial use.
260
+
261
+ ## Citation
262
+
263
+ ```
264
+ @article{hu2024minicpm,
265
+ title={MiniCPM: Unveiling the Potential of Small Language Models with Scalable Training Strategies},
266
+ author={Hu, Shengding and Tu, Yuge and Han, Xu and He, Chaoqun and Cui, Ganqu and Long, Xiang and Zheng, Zhi and Fang, Yewei and Huang, Yuxiang and Zhao, Weilin and others},
267
+ journal={arXiv preprint arXiv:2404.06395},
268
+ year={2024}
269
+ }
270
+ ```