nm-research
commited on
Commit
•
2eefe8c
1
Parent(s):
2b637ee
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
license_link: https://huggingface.co/Qwen/Qwen2.5-0.5B/blob/main/LICENSE
|
4 |
+
language:
|
5 |
+
- en
|
6 |
+
pipeline_tag: text-generation
|
7 |
+
base_model: Qwen/Qwen2.5-0.5B
|
8 |
+
tags:
|
9 |
+
- chat
|
10 |
+
- neuralmagic
|
11 |
+
- llmcompressor
|
12 |
+
---
|
13 |
+
|
14 |
+
# Qwen2.5-0.5B-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](https://huggingface.co/Qwen/Qwen2.5-0.5B), 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-0.5B](https://huggingface.co/Qwen/Qwen2.5-0.5B).
|
30 |
+
It achieves an average score of 43.93 on the [OpenLLM](https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard) benchmark (version 1), whereas the unquantized model achieves 44.03.
|
31 |
+
|
32 |
+
### Model Optimizations
|
33 |
+
|
34 |
+
This model was obtained by quantizing the weights of [Qwen2.5-0.5B](https://huggingface.co/Qwen/Qwen2.5-0.5B) 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-0.5B-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/383bbd54bc621086e05aa1b030d8d4d5635b25e6) (commit 383bbd54bc621086e05aa1b030d8d4d5635b25e6) 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-0.5B-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 |
+
#### Open LLM Leaderboard evaluation scores
|
85 |
+
<table>
|
86 |
+
<tr>
|
87 |
+
<td><strong>Benchmark</strong>
|
88 |
+
</td>
|
89 |
+
<td><strong>Qwen2.5-0.5B</strong>
|
90 |
+
</td>
|
91 |
+
<td><strong>Qwen2.5-0.5B-quantized.w8a8 (this model)</strong>
|
92 |
+
</td>
|
93 |
+
<td><strong>Recovery</strong>
|
94 |
+
</td>
|
95 |
+
</tr>
|
96 |
+
<tr>
|
97 |
+
<td>MMLU (5-shot)
|
98 |
+
</td>
|
99 |
+
<td>47.57
|
100 |
+
</td>
|
101 |
+
<td>47.35
|
102 |
+
</td>
|
103 |
+
<td>99.5%
|
104 |
+
</td>
|
105 |
+
</tr>
|
106 |
+
<tr>
|
107 |
+
<td>ARC Challenge (25-shot)
|
108 |
+
</td>
|
109 |
+
<td>34.90
|
110 |
+
</td>
|
111 |
+
<td>34.47
|
112 |
+
</td>
|
113 |
+
<td>98.8%
|
114 |
+
</td>
|
115 |
+
</tr>
|
116 |
+
<tr>
|
117 |
+
<td>GSM-8K (5-shot, strict-match)
|
118 |
+
</td>
|
119 |
+
<td>34.19
|
120 |
+
</td>
|
121 |
+
<td>34.19
|
122 |
+
</td>
|
123 |
+
<td>100.0%
|
124 |
+
</td>
|
125 |
+
</tr>
|
126 |
+
<tr>
|
127 |
+
<td>Hellaswag (10-shot)
|
128 |
+
</td>
|
129 |
+
<td>51.83
|
130 |
+
</td>
|
131 |
+
<td>51.63
|
132 |
+
</td>
|
133 |
+
<td>99.6%
|
134 |
+
</td>
|
135 |
+
</tr>
|
136 |
+
<tr>
|
137 |
+
<td>Winogrande (5-shot)
|
138 |
+
</td>
|
139 |
+
<td>55.80
|
140 |
+
</td>
|
141 |
+
<td>55.64
|
142 |
+
</td>
|
143 |
+
<td>99.7%
|
144 |
+
</td>
|
145 |
+
</tr>
|
146 |
+
<tr>
|
147 |
+
<td>TruthfulQA (0-shot, mc2)
|
148 |
+
</td>
|
149 |
+
<td>39.90
|
150 |
+
</td>
|
151 |
+
<td>40.32
|
152 |
+
</td>
|
153 |
+
<td>101.1%
|
154 |
+
</td>
|
155 |
+
</tr>
|
156 |
+
<tr>
|
157 |
+
<td><strong>Average</strong>
|
158 |
+
</td>
|
159 |
+
<td><strong>44.03</strong>
|
160 |
+
</td>
|
161 |
+
<td><strong>43.93</strong>
|
162 |
+
</td>
|
163 |
+
<td><strong>99.8%</strong>
|
164 |
+
</td>
|
165 |
+
</tr>
|
166 |
+
</table>
|
167 |
+
|