Files changed (1) hide show
  1. README.md +254 -242
README.md CHANGED
@@ -1,242 +1,254 @@
1
- ---
2
- license: apache-2.0
3
- license_link: https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct/blob/main/LICENSE
4
- language:
5
- - en
6
- pipeline_tag: text-generation
7
- base_model: Qwen/Qwen2.5-0.5B-Instruct
8
- tags:
9
- - chat
10
- - neuralmagic
11
- - llmcompressor
12
- ---
13
-
14
- # Qwen2.5-0.5B-Instruct-quantized.w8a8
15
-
16
- ## Model Overview
17
- - **Model Architecture:** Qwen2
18
- - **Input:** Text
19
- - **Output:** Text
20
- - **Model Optimizations:**
21
- - **Activation quantization:** INT8
22
- - **Weight quantization:** INT8
23
- - **Intended Use Cases:** Intended for commercial and research use multiple languages. Similarly to [Qwen2.5-0.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct), this models is intended for assistant-like chat.
24
- - **Out-of-scope:** Use in any manner that violates applicable laws or regulations (including trade compliance laws).
25
- - **Release Date:** 10/09/2024
26
- - **Version:** 1.0
27
- - **License(s):** [apache-2.0](https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct/blob/main/LICENSE)
28
- - **Model Developers:** Neural Magic
29
-
30
- Quantized version of [Qwen2.5-0.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct).
31
- It achieves an average score of 43.38 on the [OpenLLM](https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard) benchmark version 1 and 23.42 on version 2, whereas the unquantized model achieves 43.64 on version 1 and 23.39 on version 2.
32
-
33
- ### Model Optimizations
34
-
35
- This model was obtained by quantizing the weights of [Qwen2.5-0.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct) to INT8 data type.
36
- This optimization reduces the number of bits used to represent weights and activations from 16 to 8, reducing GPU memory requirements (by approximately 50%) and increasing matrix-multiply compute throughput (by approximately 2x).
37
- Weight quantization also reduces disk size requirements by approximately 50%.
38
-
39
- Only weights and activations of the linear operators within transformers blocks are quantized.
40
- Weights are quantized with a symmetric static per-channel scheme, where a fixed linear scaling factor is applied between INT8 and floating point representations for each output channel dimension.
41
- Activations are quantized with a symmetric dynamic per-token scheme, computing a linear scaling factor at runtime for each token between INT8 and floating point representations.
42
-
43
- ## Deployment
44
-
45
- This model can be deployed efficiently using the [vLLM](https://docs.vllm.ai/en/latest/) backend, as shown in the example below.
46
-
47
- ```python
48
- from vllm import LLM, SamplingParams
49
- from transformers import AutoTokenizer
50
-
51
- model_id = "neuralmagic/Qwen2.5-0.5B-Instruct-quantized.w8a8"
52
- number_gpus = 1
53
- max_model_len = 8192
54
-
55
- sampling_params = SamplingParams(temperature=0.7, top_p=0.8, max_tokens=256)
56
-
57
- tokenizer = AutoTokenizer.from_pretrained(model_id)
58
-
59
- prompt = "Give me a short introduction to large language model."
60
-
61
- llm = LLM(model=model_id, tensor_parallel_size=number_gpus, max_model_len=max_model_len)
62
-
63
- outputs = llm.generate(prompt, sampling_params)
64
-
65
- generated_text = outputs[0].outputs[0].text
66
- print(generated_text)
67
- ```
68
-
69
- vLLM aslo supports OpenAI-compatible serving. See the [documentation](https://docs.vllm.ai/en/latest/) for more details.
70
-
71
-
72
- ## Evaluation
73
-
74
- The model was evaluated on the [OpenLLM](https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard) leaderboard tasks (version 1) with the [lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness/tree/383bbd54bc621086e05aa1b030d8d4d5635b25e6) (commit 383bbd54bc621086e05aa1b030d8d4d5635b25e6) and the [vLLM](https://docs.vllm.ai/en/stable/) engine, using the following command:
75
- ```
76
- lm_eval \
77
- --model vllm \
78
- --model_args pretrained="neuralmagic/Qwen2.5-0.5B-Instruct-quantized.w8a8",dtype=auto,gpu_memory_utilization=0.9,add_bos_token=True,max_model_len=4096,enable_chunk_prefill=True,tensor_parallel_size=1 \
79
- --tasks openllm \
80
- --batch_size auto
81
- ```
82
-
83
- ### Accuracy
84
-
85
- #### Open LLM Leaderboard evaluation scores
86
- <table>
87
- <tr>
88
- <td><strong>Benchmark</strong>
89
- </td>
90
- <td><strong>Qwen2.5-0.5B-Instruct</strong>
91
- </td>
92
- <td><strong>Qwen2.5-0.5B-Instruct-quantized.w8a8 (this model)</strong>
93
- </td>
94
- <td><strong>Recovery</strong>
95
- </td>
96
- </tr>
97
- <tr>
98
- <td rowspan="7" ><strong>OpenLLM v1</strong>
99
- </td>
100
- <td>MMLU (5-shot)
101
- </td>
102
- <td>46.83
103
- </td>
104
- <td>46.29
105
- </td>
106
- <td>98.9%
107
- </td>
108
- </tr>
109
- <tr>
110
- <td>ARC Challenge (25-shot)
111
- </td>
112
- <td>33.62
113
- </td>
114
- <td>33.36
115
- </td>
116
- <td>99.2%
117
- </td>
118
- </tr>
119
- <tr>
120
- <td>GSM-8K (5-shot, strict-match)
121
- </td>
122
- <td>33.21
123
- </td>
124
- <td>33.21
125
- </td>
126
- <td>100.0%
127
- </td>
128
- </tr>
129
- <tr>
130
- <td>Hellaswag (10-shot)
131
- </td>
132
- <td>51.31
133
- </td>
134
- <td>50.97
135
- </td>
136
- <td>99.3%
137
- </td>
138
- </tr>
139
- <tr>
140
- <td>Winogrande (5-shot)
141
- </td>
142
- <td>55.01
143
- </td>
144
- <td>55.01
145
- </td>
146
- <td>100.0%
147
- </td>
148
- </tr>
149
- <tr>
150
- <td>TruthfulQA (0-shot, mc2)
151
- </td>
152
- <td>41.85
153
- </td>
154
- <td>41.47
155
- </td>
156
- <td>99.1%
157
- </td>
158
- </tr>
159
- <tr>
160
- <td><strong>Average</strong>
161
- </td>
162
- <td><strong>43.64</strong>
163
- </td>
164
- <td><strong>43.38</strong>
165
- </td>
166
- <td><strong>99.4%</strong>
167
- </td>
168
- </tr>
169
- <tr>
170
- <td rowspan="7" ><strong>OpenLLM v2</strong>
171
- </td>
172
- <td>MMLU-Pro (5-shot)
173
- </td>
174
- <td>17.49
175
- </td>
176
- <td>16.95
177
- </td>
178
- <td>96.9%
179
- </td>
180
- </tr>
181
- <tr>
182
- <td>IFEval (0-shot)
183
- </td>
184
- <td>31.17
185
- </td>
186
- <td>32.04
187
- </td>
188
- <td>102.8%
189
- </td>
190
- </tr>
191
- <tr>
192
- <td>BBH (3-shot)
193
- </td>
194
- <td>32.79
195
- </td>
196
- <td>32.51
197
- </td>
198
- <td>99.2%
199
- </td>
200
- </tr>
201
- <tr>
202
- <td>Math-lvl-5 (4-shot)
203
- </td>
204
- <td>0.21
205
- </td>
206
- <td>0.17
207
- </td>
208
- <td>***
209
- </td>
210
- </tr>
211
- <tr>
212
- <td>GPQA (0-shot)
213
- </td>
214
- <td>25.67
215
- </td>
216
- <td>26.12
217
- </td>
218
- <td>101.8%
219
- </td>
220
- </tr>
221
- <tr>
222
- <td>MuSR (0-shot)
223
- </td>
224
- <td>33.02
225
- </td>
226
- <td>32.75
227
- </td>
228
- <td>99.2%
229
- </td>
230
- </tr>
231
- <tr>
232
- <td><strong>Average</strong>
233
- </td>
234
- <td><strong>23.39</strong>
235
- </td>
236
- <td><strong>23.42</strong>
237
- </td>
238
- <td><strong>100.1%</strong>
239
- </td>
240
- </tr>
241
- </table>
242
- *** Reference value too low to report meaningful recovery.
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ license_link: https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct/blob/main/LICENSE
4
+ language:
5
+ - zho
6
+ - eng
7
+ - fra
8
+ - spa
9
+ - por
10
+ - deu
11
+ - ita
12
+ - rus
13
+ - jpn
14
+ - kor
15
+ - vie
16
+ - tha
17
+ - ara
18
+ pipeline_tag: text-generation
19
+ base_model: Qwen/Qwen2.5-0.5B-Instruct
20
+ tags:
21
+ - chat
22
+ - neuralmagic
23
+ - llmcompressor
24
+ ---
25
+
26
+ # Qwen2.5-0.5B-Instruct-quantized.w8a8
27
+
28
+ ## Model Overview
29
+ - **Model Architecture:** Qwen2
30
+ - **Input:** Text
31
+ - **Output:** Text
32
+ - **Model Optimizations:**
33
+ - **Activation quantization:** INT8
34
+ - **Weight quantization:** INT8
35
+ - **Intended Use Cases:** Intended for commercial and research use multiple languages. Similarly to [Qwen2.5-0.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct), this models is intended for assistant-like chat.
36
+ - **Out-of-scope:** Use in any manner that violates applicable laws or regulations (including trade compliance laws).
37
+ - **Release Date:** 10/09/2024
38
+ - **Version:** 1.0
39
+ - **License(s):** [apache-2.0](https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct/blob/main/LICENSE)
40
+ - **Model Developers:** Neural Magic
41
+
42
+ Quantized version of [Qwen2.5-0.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct).
43
+ It achieves an average score of 43.38 on the [OpenLLM](https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard) benchmark version 1 and 23.42 on version 2, whereas the unquantized model achieves 43.64 on version 1 and 23.39 on version 2.
44
+
45
+ ### Model Optimizations
46
+
47
+ This model was obtained by quantizing the weights of [Qwen2.5-0.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct) to INT8 data type.
48
+ This optimization reduces the number of bits used to represent weights and activations from 16 to 8, reducing GPU memory requirements (by approximately 50%) and increasing matrix-multiply compute throughput (by approximately 2x).
49
+ Weight quantization also reduces disk size requirements by approximately 50%.
50
+
51
+ Only weights and activations of the linear operators within transformers blocks are quantized.
52
+ Weights are quantized with a symmetric static per-channel scheme, where a fixed linear scaling factor is applied between INT8 and floating point representations for each output channel dimension.
53
+ Activations are quantized with a symmetric dynamic per-token scheme, computing a linear scaling factor at runtime for each token between INT8 and floating point representations.
54
+
55
+ ## Deployment
56
+
57
+ This model can be deployed efficiently using the [vLLM](https://docs.vllm.ai/en/latest/) backend, as shown in the example below.
58
+
59
+ ```python
60
+ from vllm import LLM, SamplingParams
61
+ from transformers import AutoTokenizer
62
+
63
+ model_id = "neuralmagic/Qwen2.5-0.5B-Instruct-quantized.w8a8"
64
+ number_gpus = 1
65
+ max_model_len = 8192
66
+
67
+ sampling_params = SamplingParams(temperature=0.7, top_p=0.8, max_tokens=256)
68
+
69
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
70
+
71
+ prompt = "Give me a short introduction to large language model."
72
+
73
+ llm = LLM(model=model_id, tensor_parallel_size=number_gpus, max_model_len=max_model_len)
74
+
75
+ outputs = llm.generate(prompt, sampling_params)
76
+
77
+ generated_text = outputs[0].outputs[0].text
78
+ print(generated_text)
79
+ ```
80
+
81
+ vLLM aslo supports OpenAI-compatible serving. See the [documentation](https://docs.vllm.ai/en/latest/) for more details.
82
+
83
+
84
+ ## Evaluation
85
+
86
+ The model was evaluated on the [OpenLLM](https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard) leaderboard tasks (version 1) with the [lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness/tree/383bbd54bc621086e05aa1b030d8d4d5635b25e6) (commit 383bbd54bc621086e05aa1b030d8d4d5635b25e6) and the [vLLM](https://docs.vllm.ai/en/stable/) engine, using the following command:
87
+ ```
88
+ lm_eval \
89
+ --model vllm \
90
+ --model_args pretrained="neuralmagic/Qwen2.5-0.5B-Instruct-quantized.w8a8",dtype=auto,gpu_memory_utilization=0.9,add_bos_token=True,max_model_len=4096,enable_chunk_prefill=True,tensor_parallel_size=1 \
91
+ --tasks openllm \
92
+ --batch_size auto
93
+ ```
94
+
95
+ ### Accuracy
96
+
97
+ #### Open LLM Leaderboard evaluation scores
98
+ <table>
99
+ <tr>
100
+ <td><strong>Benchmark</strong>
101
+ </td>
102
+ <td><strong>Qwen2.5-0.5B-Instruct</strong>
103
+ </td>
104
+ <td><strong>Qwen2.5-0.5B-Instruct-quantized.w8a8 (this model)</strong>
105
+ </td>
106
+ <td><strong>Recovery</strong>
107
+ </td>
108
+ </tr>
109
+ <tr>
110
+ <td rowspan="7" ><strong>OpenLLM v1</strong>
111
+ </td>
112
+ <td>MMLU (5-shot)
113
+ </td>
114
+ <td>46.83
115
+ </td>
116
+ <td>46.29
117
+ </td>
118
+ <td>98.9%
119
+ </td>
120
+ </tr>
121
+ <tr>
122
+ <td>ARC Challenge (25-shot)
123
+ </td>
124
+ <td>33.62
125
+ </td>
126
+ <td>33.36
127
+ </td>
128
+ <td>99.2%
129
+ </td>
130
+ </tr>
131
+ <tr>
132
+ <td>GSM-8K (5-shot, strict-match)
133
+ </td>
134
+ <td>33.21
135
+ </td>
136
+ <td>33.21
137
+ </td>
138
+ <td>100.0%
139
+ </td>
140
+ </tr>
141
+ <tr>
142
+ <td>Hellaswag (10-shot)
143
+ </td>
144
+ <td>51.31
145
+ </td>
146
+ <td>50.97
147
+ </td>
148
+ <td>99.3%
149
+ </td>
150
+ </tr>
151
+ <tr>
152
+ <td>Winogrande (5-shot)
153
+ </td>
154
+ <td>55.01
155
+ </td>
156
+ <td>55.01
157
+ </td>
158
+ <td>100.0%
159
+ </td>
160
+ </tr>
161
+ <tr>
162
+ <td>TruthfulQA (0-shot, mc2)
163
+ </td>
164
+ <td>41.85
165
+ </td>
166
+ <td>41.47
167
+ </td>
168
+ <td>99.1%
169
+ </td>
170
+ </tr>
171
+ <tr>
172
+ <td><strong>Average</strong>
173
+ </td>
174
+ <td><strong>43.64</strong>
175
+ </td>
176
+ <td><strong>43.38</strong>
177
+ </td>
178
+ <td><strong>99.4%</strong>
179
+ </td>
180
+ </tr>
181
+ <tr>
182
+ <td rowspan="7" ><strong>OpenLLM v2</strong>
183
+ </td>
184
+ <td>MMLU-Pro (5-shot)
185
+ </td>
186
+ <td>17.49
187
+ </td>
188
+ <td>16.95
189
+ </td>
190
+ <td>96.9%
191
+ </td>
192
+ </tr>
193
+ <tr>
194
+ <td>IFEval (0-shot)
195
+ </td>
196
+ <td>31.17
197
+ </td>
198
+ <td>32.04
199
+ </td>
200
+ <td>102.8%
201
+ </td>
202
+ </tr>
203
+ <tr>
204
+ <td>BBH (3-shot)
205
+ </td>
206
+ <td>32.79
207
+ </td>
208
+ <td>32.51
209
+ </td>
210
+ <td>99.2%
211
+ </td>
212
+ </tr>
213
+ <tr>
214
+ <td>Math-lvl-5 (4-shot)
215
+ </td>
216
+ <td>0.21
217
+ </td>
218
+ <td>0.17
219
+ </td>
220
+ <td>***
221
+ </td>
222
+ </tr>
223
+ <tr>
224
+ <td>GPQA (0-shot)
225
+ </td>
226
+ <td>25.67
227
+ </td>
228
+ <td>26.12
229
+ </td>
230
+ <td>101.8%
231
+ </td>
232
+ </tr>
233
+ <tr>
234
+ <td>MuSR (0-shot)
235
+ </td>
236
+ <td>33.02
237
+ </td>
238
+ <td>32.75
239
+ </td>
240
+ <td>99.2%
241
+ </td>
242
+ </tr>
243
+ <tr>
244
+ <td><strong>Average</strong>
245
+ </td>
246
+ <td><strong>23.39</strong>
247
+ </td>
248
+ <td><strong>23.42</strong>
249
+ </td>
250
+ <td><strong>100.1%</strong>
251
+ </td>
252
+ </tr>
253
+ </table>
254
+ *** Reference value too low to report meaningful recovery.