nm-research commited on
Commit
11dac13
1 Parent(s): 6c12857

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +240 -0
README.md ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ license_link: https://huggingface.co/Qwen/Qwen2.5-7B-Instruct/blob/main/LICENSE
4
+ language:
5
+ - en
6
+ pipeline_tag: text-generation
7
+ base_model: Qwen/Qwen2.5-7B-Instruct
8
+ tags:
9
+ - chat
10
+ - neuralmagic
11
+ - llmcompressor
12
+ ---
13
+
14
+ # Qwen2.5-7B-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-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-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
+ - **Model Developers:** Neural Magic
28
+
29
+ Quantized version of [Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct).
30
+ It achieves an average score of 58.80 on the [OpenLLM](https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard) benchmark version 1 and 35.60 on version 2, whereas the unquantized model achieves 57.50 on version 1 and 35.85 on version 2.
31
+
32
+ ### Model Optimizations
33
+
34
+ This model was obtained by quantizing the weights and activations of [Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct) to INT8 data type.
35
+ 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).
36
+ Weight quantization also reduces disk size requirements by approximately 50%.
37
+
38
+ Only weights and activations of the linear operators within transformers blocks are quantized.
39
+ 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.
40
+ 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.
41
+
42
+ ## Deployment
43
+
44
+ This model can be deployed efficiently using the [vLLM](https://docs.vllm.ai/en/latest/) backend, as shown in the example below.
45
+
46
+ ```python
47
+ from vllm import LLM, SamplingParams
48
+ from transformers import AutoTokenizer
49
+
50
+ model_id = "neuralmagic/Qwen2.5-7B-Instruct-quantized.w8a8"
51
+ number_gpus = 1
52
+ max_model_len = 8192
53
+
54
+ sampling_params = SamplingParams(temperature=0.7, top_p=0.8, max_tokens=256)
55
+
56
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
57
+
58
+ prompt = "Give me a short introduction to large language model."
59
+
60
+ llm = LLM(model=model_id, tensor_parallel_size=number_gpus, max_model_len=max_model_len)
61
+
62
+ outputs = llm.generate(prompt, sampling_params)
63
+
64
+ generated_text = outputs[0].outputs[0].text
65
+ print(generated_text)
66
+ ```
67
+
68
+ vLLM aslo supports OpenAI-compatible serving. See the [documentation](https://docs.vllm.ai/en/latest/) for more details.
69
+
70
+
71
+ ## Evaluation
72
+
73
+ 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/387Bbd54bc621086e05aa1b030d8d4d5635b25e6) (commit 387Bbd54bc621086e05aa1b030d8d4d5635b25e6) and the [vLLM](https://docs.vllm.ai/en/stable/) engine, using the following command:
74
+ ```
75
+ lm_eval \
76
+ --model vllm \
77
+ --model_args pretrained="neuralmagic/Qwen2.5-7B-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 \
78
+ --tasks openllm \
79
+ --batch_size auto
80
+ ```
81
+
82
+ ### Accuracy
83
+
84
+ <table>
85
+ <tr>
86
+ <td><strong>Benchmark</strong>
87
+ </td>
88
+ <td><strong>Qwen2.5-7B-Instruct</strong>
89
+ </td>
90
+ <td><strong>Qwen2.5-7B-Instruct-quantized.w8a8 (this model)</strong>
91
+ </td>
92
+ <td><strong>Recovery</strong>
93
+ </td>
94
+ </tr>
95
+ <tr>
96
+ <td rowspan="7" ><strong>OpenLLM v1</strong>
97
+ </td>
98
+ <td>MMLU (5-shot)
99
+ </td>
100
+ <td>66.27
101
+ </td>
102
+ <td>65.61
103
+ </td>
104
+ <td>99.0%
105
+ </td>
106
+ </tr>
107
+ <tr>
108
+ <td>ARC Challenge (25-shot)
109
+ </td>
110
+ <td>56.91
111
+ </td>
112
+ <td>57.25
113
+ </td>
114
+ <td>100.6%
115
+ </td>
116
+ </tr>
117
+ <tr>
118
+ <td>GSM-8K (5-shot, strict-match)
119
+ </td>
120
+ <td>17.29
121
+ </td>
122
+ <td>28.13
123
+ </td>
124
+ <td>162.7%
125
+ </td>
126
+ </tr>
127
+ <tr>
128
+ <td>Hellaswag (10-shot)
129
+ </td>
130
+ <td>75.19
131
+ </td>
132
+ <td>74.76
133
+ </td>
134
+ <td>99.4%
135
+ </td>
136
+ </tr>
137
+ <tr>
138
+ <td>Winogrande (5-shot)
139
+ </td>
140
+ <td>70.48
141
+ </td>
142
+ <td>69.30
143
+ </td>
144
+ <td>98.3%
145
+ </td>
146
+ </tr>
147
+ <tr>
148
+ <td>TruthfulQA (0-shot, mc2)
149
+ </td>
150
+ <td>58.84
151
+ </td>
152
+ <td>57.73
153
+ </td>
154
+ <td>101.0%
155
+ </td>
156
+ </tr>
157
+ <tr>
158
+ <td><strong>Average</strong>
159
+ </td>
160
+ <td><strong>57.50</strong>
161
+ </td>
162
+ <td><strong>58.80</strong>
163
+ </td>
164
+ <td><strong>102.3%</strong>
165
+ </td>
166
+ </tr>
167
+ <tr>
168
+ <td rowspan="7" ><strong>OpenLLM v2</strong>
169
+ </td>
170
+ <td>MMLU-Pro (5-shot)
171
+ </td>
172
+ <td>42.93
173
+ </td>
174
+ <td>42.40
175
+ </td>
176
+ <td>98.8%
177
+ </td>
178
+ </tr>
179
+ <tr>
180
+ <td>IFEval (0-shot)
181
+ </td>
182
+ <td>76.25
183
+ </td>
184
+ <td>75.30
185
+ </td>
186
+ <td>98.8%
187
+ </td>
188
+ </tr>
189
+ <tr>
190
+ <td>BBH (3-shot)
191
+ </td>
192
+ <td>55.56
193
+ </td>
194
+ <td>55.03
195
+ </td>
196
+ <td>99.1%
197
+ </td>
198
+ </tr>
199
+ <tr>
200
+ <td>Math-lvl-5 (4-shot)
201
+ </td>
202
+ <td>0.00
203
+ </td>
204
+ <td>0.00
205
+ </td>
206
+ <td>***
207
+ </td>
208
+ </tr>
209
+ <tr>
210
+ <td>GPQA (0-shot)
211
+ </td>
212
+ <td>33.07
213
+ </td>
214
+ <td>33.74
215
+ </td>
216
+ <td>102.3%
217
+ </td>
218
+ </tr>
219
+ <tr>
220
+ <td>MuSR (0-shot)
221
+ </td>
222
+ <td>40.60
223
+ </td>
224
+ <td>42.18
225
+ </td>
226
+ <td>103.9%
227
+ </td>
228
+ </tr>
229
+ <tr>
230
+ <td><strong>Average</strong>
231
+ </td>
232
+ <td><strong>41.40</strong>
233
+ </td>
234
+ <td><strong>41.44</strong>
235
+ </td>
236
+ <td><strong>100.1%</strong>
237
+ </td>
238
+ </tr>
239
+ </table>
240
+ *** Reference value too low to report meaningful recovery.