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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
license_link: https://huggingface.co/Qwen/Qwen2.5-1.5B/blob/main/LICENSE
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
+
base_model: Qwen/Qwen2.5-1.5B
|
| 8 |
+
tags:
|
| 9 |
+
- chat
|
| 10 |
+
- neuralmagic
|
| 11 |
+
- llmcompressor
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Qwen2.5-1.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-1.5B](https://huggingface.co/Qwen/Qwen2.5-1.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 |
+
- **License(s):** [apache-2.0](https://huggingface.co/Qwen/Qwen2.5-1.5B/blob/main/LICENSE)
|
| 28 |
+
- **Model Developers:** Neural Magic
|
| 29 |
+
|
| 30 |
+
Quantized version of [Qwen2.5-1.5B](https://huggingface.co/Qwen/Qwen2.5-1.5B).
|
| 31 |
+
It achieves an average score of 58.34 on the [OpenLLM](https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard) benchmark (version 1), whereas the unquantized model achieves 58.48.
|
| 32 |
+
|
| 33 |
+
### Model Optimizations
|
| 34 |
+
|
| 35 |
+
This model was obtained by quantizing the weights of [Qwen2.5-1.5B](https://huggingface.co/Qwen/Qwen2.5-1.5B) 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-1.5B-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-1.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 \
|
| 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-1.5B</strong>
|
| 91 |
+
</td>
|
| 92 |
+
<td><strong>Qwen2.5-1.5B-quantized.w8a8 (this model)</strong>
|
| 93 |
+
</td>
|
| 94 |
+
<td><strong>Recovery</strong>
|
| 95 |
+
</td>
|
| 96 |
+
</tr>
|
| 97 |
+
<tr>
|
| 98 |
+
<td>MMLU (5-shot)
|
| 99 |
+
</td>
|
| 100 |
+
<td>60.98
|
| 101 |
+
</td>
|
| 102 |
+
<td>60.35
|
| 103 |
+
</td>
|
| 104 |
+
<td>99.0%
|
| 105 |
+
</td>
|
| 106 |
+
</tr>
|
| 107 |
+
<tr>
|
| 108 |
+
<td>ARC Challenge (25-shot)
|
| 109 |
+
</td>
|
| 110 |
+
<td>49.66
|
| 111 |
+
</td>
|
| 112 |
+
<td>49.66
|
| 113 |
+
</td>
|
| 114 |
+
<td>100.0%
|
| 115 |
+
</td>
|
| 116 |
+
</tr>
|
| 117 |
+
<tr>
|
| 118 |
+
<td>GSM-8K (5-shot, strict-match)
|
| 119 |
+
</td>
|
| 120 |
+
<td>60.96
|
| 121 |
+
</td>
|
| 122 |
+
<td>60.12
|
| 123 |
+
</td>
|
| 124 |
+
<td>98.6%
|
| 125 |
+
</td>
|
| 126 |
+
</tr>
|
| 127 |
+
<tr>
|
| 128 |
+
<td>Hellaswag (10-shot)
|
| 129 |
+
</td>
|
| 130 |
+
<td>67.65
|
| 131 |
+
</td>
|
| 132 |
+
<td>67.72
|
| 133 |
+
</td>
|
| 134 |
+
<td>100.1%
|
| 135 |
+
</td>
|
| 136 |
+
</tr>
|
| 137 |
+
<tr>
|
| 138 |
+
<td>Winogrande (5-shot)
|
| 139 |
+
</td>
|
| 140 |
+
<td>65.04
|
| 141 |
+
</td>
|
| 142 |
+
<td>66.06
|
| 143 |
+
</td>
|
| 144 |
+
<td>101.6%
|
| 145 |
+
</td>
|
| 146 |
+
</tr>
|
| 147 |
+
<tr>
|
| 148 |
+
<td>TruthfulQA (0-shot, mc2)
|
| 149 |
+
</td>
|
| 150 |
+
<td>46.57
|
| 151 |
+
</td>
|
| 152 |
+
<td>46.14
|
| 153 |
+
</td>
|
| 154 |
+
<td>99.1%
|
| 155 |
+
</td>
|
| 156 |
+
</tr>
|
| 157 |
+
<tr>
|
| 158 |
+
<td><strong>Average</strong>
|
| 159 |
+
</td>
|
| 160 |
+
<td><strong>58.48</strong>
|
| 161 |
+
</td>
|
| 162 |
+
<td><strong>58.34</strong>
|
| 163 |
+
</td>
|
| 164 |
+
<td><strong>99.8%</strong>
|
| 165 |
+
</td>
|
| 166 |
+
</tr>
|
| 167 |
+
</table>
|
| 168 |
+
|