Add Mix-Quant paper, project page, and code links
#1
by nielsr HF Staff - opened
README.md
CHANGED
|
@@ -1,7 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
- fp4
|
| 4 |
-
- vllm
|
| 5 |
language:
|
| 6 |
- en
|
| 7 |
- de
|
|
@@ -11,13 +9,22 @@ language:
|
|
| 11 |
- hi
|
| 12 |
- es
|
| 13 |
- th
|
| 14 |
-
pipeline_tag: text-generation
|
| 15 |
license: apache-2.0
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
---
|
| 18 |
|
| 19 |
# Qwen3-8B-NVFP4
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
## Model Overview
|
| 22 |
- **Model Architecture:** Qwen/Qwen3-8B
|
| 23 |
- **Input:** Text
|
|
@@ -30,12 +37,11 @@ base_model: Qwen/Qwen3-8B
|
|
| 30 |
- **Version:** 1.0
|
| 31 |
- **Model Developers:** RedHatAI
|
| 32 |
|
| 33 |
-
This model
|
| 34 |
-
It was evaluated on a several tasks to assess the its quality in comparison to the unquatized model.
|
| 35 |
|
| 36 |
### Model Optimizations
|
| 37 |
|
| 38 |
-
This model was obtained by quantizing the weights and activations of [Qwen/Qwen3-8B](https://huggingface.co/Qwen/Qwen3-8B) to FP4 data type, ready for inference with vLLM>=0.9.1
|
| 39 |
This optimization reduces the number of bits per parameter from 16 to 4, reducing the disk size and GPU memory requirements by approximately 75%.
|
| 40 |
|
| 41 |
Only the weights and activations of the linear operators within transformers blocks are quantized using [LLM Compressor](https://github.com/vllm-project/llm-compressor).
|
|
@@ -72,11 +78,11 @@ generated_text = outputs[0].outputs[0].text
|
|
| 72 |
print(generated_text)
|
| 73 |
```
|
| 74 |
|
| 75 |
-
vLLM
|
| 76 |
|
| 77 |
## Creation
|
| 78 |
|
| 79 |
-
This model was created by applying [LLM Compressor with calibration samples from UltraChat](https://github.com/vllm-project/llm-compressor/blob/main/examples/quantization_w4a4_fp4/llama3_example.py), as presented in the code
|
| 80 |
|
| 81 |
<details>
|
| 82 |
|
|
@@ -177,13 +183,17 @@ oneshot(
|
|
| 177 |
output_dir=SAVE_DIR,
|
| 178 |
)
|
| 179 |
|
| 180 |
-
print("
|
|
|
|
|
|
|
| 181 |
print("========== SAMPLE GENERATION ==============")
|
| 182 |
dispatch_for_generation(model)
|
| 183 |
input_ids = tokenizer("Hello my name is", return_tensors="pt").input_ids.to("cuda")
|
| 184 |
output = model.generate(input_ids, max_new_tokens=100)
|
| 185 |
print(tokenizer.decode(output[0]))
|
| 186 |
-
print("==========================================
|
|
|
|
|
|
|
| 187 |
|
| 188 |
model.save_pretrained(SAVE_DIR, save_compressed=True)
|
| 189 |
tokenizer.save_pretrained(SAVE_DIR)
|
|
@@ -192,7 +202,7 @@ tokenizer.save_pretrained(SAVE_DIR)
|
|
| 192 |
|
| 193 |
## Evaluation
|
| 194 |
|
| 195 |
-
This model was evaluated on the well-known OpenLLM v1, OpenLLM v2 and HumanEval_64 benchmarks using [lm-evaluation-harness](https://github.com/neuralmagic/lm-evaluation-harness). The Reasoning evals were done using [
|
| 196 |
|
| 197 |
### Accuracy
|
| 198 |
<table>
|
|
@@ -327,9 +337,6 @@ This model was evaluated on the well-known OpenLLM v1, OpenLLM v2 and HumanEval_
|
|
| 327 |
</tbody>
|
| 328 |
</table>
|
| 329 |
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
### Reproduction
|
| 334 |
|
| 335 |
The results were obtained using the following commands:
|
|
@@ -346,7 +353,6 @@ lm_eval \
|
|
| 346 |
--batch_size auto
|
| 347 |
```
|
| 348 |
|
| 349 |
-
|
| 350 |
#### OpenLLM v2
|
| 351 |
```
|
| 352 |
lm_eval \
|
|
@@ -392,6 +398,16 @@ lighteval vllm model_args.yaml \
|
|
| 392 |
"lighteval|aime24|0,lighteval|aime25|0,lighteval|gpqa:diamond|0" \
|
| 393 |
--max-samples -1 \
|
| 394 |
--output-dir out_dir
|
| 395 |
-
|
| 396 |
```
|
| 397 |
-
</details>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
base_model: Qwen/Qwen3-8B
|
|
|
|
|
|
|
| 3 |
language:
|
| 4 |
- en
|
| 5 |
- de
|
|
|
|
| 9 |
- hi
|
| 10 |
- es
|
| 11 |
- th
|
|
|
|
| 12 |
license: apache-2.0
|
| 13 |
+
pipeline_tag: text-generation
|
| 14 |
+
library_name: vllm
|
| 15 |
+
tags:
|
| 16 |
+
- fp4
|
| 17 |
+
- vllm
|
| 18 |
+
- mix-quant
|
| 19 |
---
|
| 20 |
|
| 21 |
# Qwen3-8B-NVFP4
|
| 22 |
|
| 23 |
+
This repository contains a quantized version of [Qwen/Qwen3-8B](https://huggingface.co/Qwen/Qwen3-8B) as presented in the paper [Mix-Quant: Quantized Prefilling, Precise Decoding for Agentic LLMs](https://huggingface.co/papers/2605.20315).
|
| 24 |
+
|
| 25 |
+
- **Project Page:** [https://haiquanlu.github.io/Mix-Quant/](https://haiquanlu.github.io/Mix-Quant/)
|
| 26 |
+
- **Code:** [https://github.com/haiquanlu/Mix-Quant](https://github.com/haiquanlu/Mix-Quant)
|
| 27 |
+
|
| 28 |
## Model Overview
|
| 29 |
- **Model Architecture:** Qwen/Qwen3-8B
|
| 30 |
- **Input:** Text
|
|
|
|
| 37 |
- **Version:** 1.0
|
| 38 |
- **Model Developers:** RedHatAI
|
| 39 |
|
| 40 |
+
This model was evaluated on several tasks to assess its quality in comparison to the unquantized model.
|
|
|
|
| 41 |
|
| 42 |
### Model Optimizations
|
| 43 |
|
| 44 |
+
This model was obtained by quantizing the weights and activations of [Qwen/Qwen3-8B](https://huggingface.co/Qwen/Qwen3-8B) to FP4 data type, ready for inference with vLLM>=0.9.1.
|
| 45 |
This optimization reduces the number of bits per parameter from 16 to 4, reducing the disk size and GPU memory requirements by approximately 75%.
|
| 46 |
|
| 47 |
Only the weights and activations of the linear operators within transformers blocks are quantized using [LLM Compressor](https://github.com/vllm-project/llm-compressor).
|
|
|
|
| 78 |
print(generated_text)
|
| 79 |
```
|
| 80 |
|
| 81 |
+
vLLM also supports OpenAI-compatible serving. See the [documentation](https://docs.vllm.ai/en/latest/) for more details.
|
| 82 |
|
| 83 |
## Creation
|
| 84 |
|
| 85 |
+
This model was created by applying [LLM Compressor with calibration samples from UltraChat](https://github.com/vllm-project/llm-compressor/blob/main/examples/quantization_w4a4_fp4/llama3_example.py), as presented in the code snippet below.
|
| 86 |
|
| 87 |
<details>
|
| 88 |
|
|
|
|
| 183 |
output_dir=SAVE_DIR,
|
| 184 |
)
|
| 185 |
|
| 186 |
+
print("
|
| 187 |
+
|
| 188 |
+
")
|
| 189 |
print("========== SAMPLE GENERATION ==============")
|
| 190 |
dispatch_for_generation(model)
|
| 191 |
input_ids = tokenizer("Hello my name is", return_tensors="pt").input_ids.to("cuda")
|
| 192 |
output = model.generate(input_ids, max_new_tokens=100)
|
| 193 |
print(tokenizer.decode(output[0]))
|
| 194 |
+
print("==========================================
|
| 195 |
+
|
| 196 |
+
")
|
| 197 |
|
| 198 |
model.save_pretrained(SAVE_DIR, save_compressed=True)
|
| 199 |
tokenizer.save_pretrained(SAVE_DIR)
|
|
|
|
| 202 |
|
| 203 |
## Evaluation
|
| 204 |
|
| 205 |
+
This model was evaluated on the well-known OpenLLM v1, OpenLLM v2 and HumanEval_64 benchmarks using [lm-evaluation-harness](https://github.com/neuralmagic/lm-evaluation-harness). The Reasoning evals were done using [lighteval](https://github.com/neuralmagic/lighteval).
|
| 206 |
|
| 207 |
### Accuracy
|
| 208 |
<table>
|
|
|
|
| 337 |
</tbody>
|
| 338 |
</table>
|
| 339 |
|
|
|
|
|
|
|
|
|
|
| 340 |
### Reproduction
|
| 341 |
|
| 342 |
The results were obtained using the following commands:
|
|
|
|
| 353 |
--batch_size auto
|
| 354 |
```
|
| 355 |
|
|
|
|
| 356 |
#### OpenLLM v2
|
| 357 |
```
|
| 358 |
lm_eval \
|
|
|
|
| 398 |
"lighteval|aime24|0,lighteval|aime25|0,lighteval|gpqa:diamond|0" \
|
| 399 |
--max-samples -1 \
|
| 400 |
--output-dir out_dir
|
|
|
|
| 401 |
```
|
| 402 |
+
</details>
|
| 403 |
+
|
| 404 |
+
## Citation
|
| 405 |
+
|
| 406 |
+
```bibtex
|
| 407 |
+
@article{lu2026mixquant,
|
| 408 |
+
title={Mix-Quant: Quantized Prefilling, Precise Decoding for Agentic LLMs},
|
| 409 |
+
author={Lu, Haiquan and Chen, Zigeng and Fang, Gongfan and Ma, Xinyin and Wang, Xinchao},
|
| 410 |
+
journal={arXiv preprint arXiv:2605.20315},
|
| 411 |
+
year={2026}
|
| 412 |
+
}
|
| 413 |
+
```
|