File size: 3,114 Bytes
973c793
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16c6869
 
 
 
973c793
 
 
 
 
16c6869
973c793
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16c6869
973c793
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
---
license: apache-2.0
pipeline_tag: text-generation
tags:
- fp8
- quantized
- llm-compressor
- compressed-tensors
base_model:
- Qwen/Qwen3-30B-A3B-Instruct-2507
---


# Qwen3-30B-A3B-Instruct-2507-FP8-dynamic

## Model Overview
- **Model Architecture:** Qwen3MoeForCausalLM
  - **Input:** Text
  - **Output:** Text
- **Model Optimizations:**
  - **Activation quantization:** FP8
  - **Weight quantization:** FP8
- **Intended Use Cases:**
  - Function calling.
  - Subject matter experts via fine-tuning.
  - Multilingual instruction following.
  - Translation.

Quantized version of [Qwen/Qwen3-30B-A3B-Instruct-2507](https://huggingface.co/Qwen/Qwen3-30B-A3B-Instruct-2507).

### Model Optimizations

This model was obtained by quantizing the weights and activations of [Qwen/Qwen3-30B-A3B-Instruct-2507](https://huggingface.co/Qwen/Qwen3-30B-A3B-Instruct-2507) to FP8 data type.
This optimization reduces the number of bits per parameter from 16 to 8, reducing the disk size and GPU memory requirements by approximately 50%.
Only the weights and activations of the linear operators within transformers blocks of the language model are quantized. 

It's running faster than [Qwen/Qwen3-30B-A3B-Instruct-2507-FP8](https://huggingface.co/Qwen/Qwen3-30B-A3B-Instruct-2507-FP8) in vLLM/sglang in 4090 or H100, 
with no diffrence on model ability on most benchmarks.

[vllm docs of fp8 quantization](https://docs.vllm.ai/en/stable/features/quantization/fp8.html)

## Deployment

### Use with vLLM

You may need to tune moe for best performance with vllm or sglang, almost same as [Qwen3-Next guid on vllm](https://docs.vllm.ai/projects/recipes/en/latest/Qwen/Qwen3-Next.html#tune-moe-kernel) 
```
vllm serve bash99/Qwen3-30B-A3B-Instruct-2507-FP8-Dynamic --tensor_parallel_size 2
```


## Creation

This model was quantized using the [llm-compressor](https://github.com/vllm-project/llm-compressor) library as shown below.

<details>
  <summary>Creation details</summary>

```quantize_tofp8.py
from transformers import AutoProcessor, AutoModelForCausalLM, AutoTokenizer
from llmcompressor import oneshot
from llmcompressor.modifiers.quantization import QuantizationModifier
import sys

MODEL_ID = sys.argv[1]

# Load model.
model = AutoModelForCausalLM.from_pretrained(
    MODEL_ID, device_map="auto", torch_dtype="auto"
)
processor = AutoProcessor.from_pretrained(MODEL_ID)

# Configure the quantization algorithm and scheme.
# In this case, we:
#   * quantize the weights to fp8 with per channel via ptq
#   * quantize the activations to fp8 with dynamic per token
recipe = QuantizationModifier(targets="Linear",scheme="FP8_DYNAMIC",
        ignore=["re:.*lm_head", "re:visual.*", 're:.*mlp.gate$', 're:.*mlp.shared_expert_gate$', 're:.*router$']
    )

# Apply quantization and save to disk in compressed-tensors format.
SAVE_DIR = MODEL_ID + "-FP8-Dynamic"

oneshot(model=model, recipe=recipe, output_dir=SAVE_DIR)
processor.save_pretrained(SAVE_DIR)

print(f"========== quantizeing to {SAVE_DIR}, done ==============")
```

```bash
python quantize_tofp8.py Qwen/Qwen3-30B-A3B-Instruct-2507-FP8
```

</details>