Image-Text-to-Text
Transformers
Safetensors
qwen3_5
autoround
int4
w4g128
w4a16
quantization
vllm
multimodal
mtp
speculative-decoding
conversational
4-bit precision
auto-round
Instructions to use webhie/Qwen3.6-27B-int4-AutoRound with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use webhie/Qwen3.6-27B-int4-AutoRound with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="webhie/Qwen3.6-27B-int4-AutoRound") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("webhie/Qwen3.6-27B-int4-AutoRound") model = AutoModelForMultimodalLM.from_pretrained("webhie/Qwen3.6-27B-int4-AutoRound", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use webhie/Qwen3.6-27B-int4-AutoRound with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "webhie/Qwen3.6-27B-int4-AutoRound" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "webhie/Qwen3.6-27B-int4-AutoRound", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/webhie/Qwen3.6-27B-int4-AutoRound
- SGLang
How to use webhie/Qwen3.6-27B-int4-AutoRound with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "webhie/Qwen3.6-27B-int4-AutoRound" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "webhie/Qwen3.6-27B-int4-AutoRound", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "webhie/Qwen3.6-27B-int4-AutoRound" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "webhie/Qwen3.6-27B-int4-AutoRound", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use webhie/Qwen3.6-27B-int4-AutoRound with Docker Model Runner:
docker model run hf.co/webhie/Qwen3.6-27B-int4-AutoRound
Upload README.md with huggingface_hub
#2
by edwinbrowwn - opened
README.md
CHANGED
|
@@ -1,3 +1,179 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
-
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
license_link: https://huggingface.co/Qwen/Qwen3.6-27B/blob/main/LICENSE
|
| 4 |
+
base_model: Qwen/Qwen3.6-27B
|
| 5 |
+
base_model_relation: quantized
|
| 6 |
+
pipeline_tag: image-text-to-text
|
| 7 |
+
library_name: transformers
|
| 8 |
+
tags:
|
| 9 |
+
- qwen3_5
|
| 10 |
+
- autoround
|
| 11 |
+
- int4
|
| 12 |
+
- w4g128
|
| 13 |
+
- w4a16
|
| 14 |
+
- quantization
|
| 15 |
+
- vllm
|
| 16 |
+
- multimodal
|
| 17 |
+
- mtp
|
| 18 |
+
- speculative-decoding
|
| 19 |
+
---
|
| 20 |
+
# Qwen3.6-27B INT4 AutoRound (Best Recipe)
|
| 21 |
+
|
| 22 |
+
A **W4A16 (INT4 weight, FP16 activation) quantization** of [`Qwen/Qwen3.6-27B`](https://huggingface.co/Qwen/Qwen3.6-27B), produced with [Intel's AutoRound](https://github.com/intel/auto-round).
|
| 23 |
+
|
| 24 |
+
> **Key difference from other AutoRound quants of this model:** This was quantized using the **`auto-round-best` preset** — 1000 iterations and 512 calibration samples instead of the standard 200/128. This preset runs ~4–5× slower but achieves the best possible accuracy at INT4, as it performs a more thorough weight rounding optimization. MTP (speculative decoding) and image/vision inputs work out of the box with no post-processing required.
|
| 25 |
+
|
| 26 |
+
## TL;DR
|
| 27 |
+
|
| 28 |
+
- **Base**: Qwen3.6-27B (27B dense VLM)
|
| 29 |
+
- **Quant**: INT4 W4A16, group_size 128, symmetric
|
| 30 |
+
- **Tool**: `auto-round-best` (1000 iters, 512 samples, torch.compile)
|
| 31 |
+
- **Size**: ~18 GB (down from ~54 GB BF16) — **3× reduction**
|
| 32 |
+
- **MTP**: Native Multi-Token Prediction head preserved in BF16 — enables **native speculative decoding** in vLLM (~85–90% draft acceptance, ~2× throughput)
|
| 33 |
+
- **Vision**: Image inputs work via the MoonViT encoder (weights kept at original BF16/FP16 precision)
|
| 34 |
+
|
| 35 |
+
## Quick inference with vLLM (with MTP speculative decoding)
|
| 36 |
+
|
| 37 |
+
Requires vLLM v0.19.1+ with Qwen3_5 MTP support. Set the following environment variables before starting:
|
| 38 |
+
|
| 39 |
+
```bash
|
| 40 |
+
export VLLM_USE_FLASHINFER_SAMPLER=1
|
| 41 |
+
export VLLM_ALLOW_LONG_MAX_MODEL_LEN=1
|
| 42 |
+
export VLLM_FLOAT32_MATMUL_PRECISION=high
|
| 43 |
+
export PYTORCH_CUDA_ALLOC_CONF="expandable_segments:True,max_split_size_mb:512"
|
| 44 |
+
export VLLM_NO_USAGE_STATS=1
|
| 45 |
+
export VLLM_MEMORY_PROFILER_ESTIMATE_CUDAGRAPHS=1
|
| 46 |
+
export VLLM_MARLIN_USE_ATOMIC_ADD=1
|
| 47 |
+
export OMP_NUM_THREADS=1
|
| 48 |
+
export CUDA_DEVICE_MAX_CONNECTIONS=8
|
| 49 |
+
export NCCL_CUMEM_ENABLE=0
|
| 50 |
+
export NCCL_P2P_DISABLE=1
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
```bash
|
| 54 |
+
vllm serve webhie/Qwen3.6-27B-int4-AutoRound \
|
| 55 |
+
--served-model-name qwen3.6-27b \
|
| 56 |
+
--host 0.0.0.0 --port 11434 \
|
| 57 |
+
--trust-remote-code \
|
| 58 |
+
--dtype auto \
|
| 59 |
+
--quantization auto_round \
|
| 60 |
+
--max-model-len 200704 \
|
| 61 |
+
--gpu-memory-utilization 0.92 \
|
| 62 |
+
--max-num-seqs 4 \
|
| 63 |
+
--kv-cache-dtype fp8_e4m3 \
|
| 64 |
+
--attention-backend flashinfer \
|
| 65 |
+
--performance-mode throughput \
|
| 66 |
+
--max-num-batched-tokens 2048 \
|
| 67 |
+
--enable-chunked-prefill \
|
| 68 |
+
--enable-auto-tool-choice \
|
| 69 |
+
--tool-call-parser qwen3_coder \
|
| 70 |
+
--reasoning-parser qwen3 \
|
| 71 |
+
--default-chat-template-kwargs '{"preserve_thinking":true}' \
|
| 72 |
+
--override-generation-config '{"temperature":0.6,"top_p":0.95,"top_k":20,"min_p":0.0,"presence_penalty":0.0,"repetition_penalty":1.0}' \
|
| 73 |
+
--enable-prompt-tokens-details \
|
| 74 |
+
--speculative-config '{"method":"mtp","num_speculative_tokens":3}'
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
Remove `--speculative-config` to disable MTP speculative decoding. See the [vllm-blackwell-guide](https://github.com/lastloop-ai/vllm-blackwell-guide) repo for a full Docker Compose setup with all env vars pre-configured.
|
| 78 |
+
|
| 79 |
+
### OpenAI-compatible request
|
| 80 |
+
|
| 81 |
+
```python
|
| 82 |
+
from openai import OpenAI
|
| 83 |
+
client = OpenAI(base_url="http://localhost:11434/v1", api_key="EMPTY")
|
| 84 |
+
r = client.chat.completions.create(
|
| 85 |
+
model="qwen3.6-27b",
|
| 86 |
+
messages=[{"role": "user", "content": "Write a quicksort in Python."}],
|
| 87 |
+
max_tokens=512,
|
| 88 |
+
)
|
| 89 |
+
print(r.choices[0].message.content)
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
### Transformers (no spec decoding)
|
| 93 |
+
|
| 94 |
+
```python
|
| 95 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 96 |
+
m = AutoModelForCausalLM.from_pretrained(
|
| 97 |
+
"webhie/Qwen3.6-27B-int4-AutoRound",
|
| 98 |
+
trust_remote_code=True,
|
| 99 |
+
device_map="auto",
|
| 100 |
+
)
|
| 101 |
+
tok = AutoTokenizer.from_pretrained("webhie/Qwen3.6-27B-int4-AutoRound")
|
| 102 |
+
msg = [{"role": "user", "content": "Explain quantum computing briefly."}]
|
| 103 |
+
ids = tok.apply_chat_template(msg, add_generation_prompt=True, return_tensors="pt").to(m.device)
|
| 104 |
+
print(tok.decode(m.generate(ids, max_new_tokens=256)[0]))
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
+
## Quantization details
|
| 108 |
+
|
| 109 |
+
| Field | Value |
|
| 110 |
+
|---|---|
|
| 111 |
+
| Base | `Qwen/Qwen3.6-27B` |
|
| 112 |
+
| Method | AutoRound (`intel/auto-round`), **best recipe** |
|
| 113 |
+
| Scheme | W4A16 (4-bit weights, FP16 activations) |
|
| 114 |
+
| Bits | 4 |
|
| 115 |
+
| Group size | 128 |
|
| 116 |
+
| Symmetric | yes |
|
| 117 |
+
| Packing format | `auto_round:auto_gptq` |
|
| 118 |
+
| Unquantized layers | `linear_attn.in_proj_a/b`, all LayerNorms, RMSNorms, router gates |
|
| 119 |
+
| Calibration samples | 512 |
|
| 120 |
+
| Iterations | 1000 |
|
| 121 |
+
| torch.compile | enabled |
|
| 122 |
+
| GPU used for quant | 1× RTX 5090 (32 GB, SM120), `low_gpu_mem_usage=True` |
|
| 123 |
+
|
| 124 |
+
### Unquantized layers — why
|
| 125 |
+
|
| 126 |
+
- **`linear_attn.in_proj_a/b`**: low-rank projections in Qwen3.6's Gated DeltaNet whose shapes aren't divisible by 32 (group_size), so AutoRound skips them automatically. Tiny fraction of total parameters.
|
| 127 |
+
- **Norms, routers**: precision-sensitive and very small — kept at full precision.
|
| 128 |
+
|
| 129 |
+
## Performance
|
| 130 |
+
|
| 131 |
+
Benchmarked on **1× RTX 5090 (32 GB)** with vLLM + FP8 KV cache + MTP n=3:
|
| 132 |
+
|
| 133 |
+
| Config | Throughput |
|
| 134 |
+
|---|---:|
|
| 135 |
+
| vLLM + MTP n=3 | **~150 tok/s** |
|
| 136 |
+
| vLLM (MTP disabled) | **~70 tok/s** |
|
| 137 |
+
|
| 138 |
+
The ~2× speedup comes from ~85–90% draft acceptance via MTP speculative decoding with `num_speculative_tokens: 3`.
|
| 139 |
+
|
| 140 |
+
## Reproduction
|
| 141 |
+
|
| 142 |
+
```bash
|
| 143 |
+
pip install auto-round
|
| 144 |
+
auto-round-best \
|
| 145 |
+
--model Qwen/Qwen3.6-27B \
|
| 146 |
+
--scheme W4A16 \
|
| 147 |
+
--format auto_round \
|
| 148 |
+
--output_dir Qwen3.6-27B-int4-AutoRound \
|
| 149 |
+
--enable_torch_compile \
|
| 150 |
+
--low_gpu_mem_usage \
|
| 151 |
+
--device_map 0
|
| 152 |
+
```
|
| 153 |
+
|
| 154 |
+
No post-processing needed — MTP and image inputs work out of the box.
|
| 155 |
+
|
| 156 |
+
## Acknowledgements
|
| 157 |
+
|
| 158 |
+
- [Alibaba / Qwen team](https://huggingface.co/Qwen) for the base [Qwen3.6-27B](https://huggingface.co/Qwen/Qwen3.6-27B) model
|
| 159 |
+
- [Intel AutoRound](https://github.com/intel/auto-round) team for the quantization framework
|
| 160 |
+
- [Lorbus](https://huggingface.co/Lorbus) for the original AutoRound quant of this model that inspired this release
|
| 161 |
+
- [@eugr](https://github.com/eugr) for the [spark-vllm-docker](https://github.com/eugr/spark-vllm-docker) fork and TurboQuant KV cache work
|
| 162 |
+
- [vLLM project](https://github.com/vllm-project/vllm) for the inference engine and Qwen3_5 MTP support
|
| 163 |
+
|
| 164 |
+
## License
|
| 165 |
+
|
| 166 |
+
Apache 2.0 — same as [Qwen3.6-27B base](https://huggingface.co/Qwen/Qwen3.6-27B).
|
| 167 |
+
|
| 168 |
+
## Citation
|
| 169 |
+
|
| 170 |
+
If you use this quant, please cite the original Qwen3.6 release (see base model card) and the AutoRound paper:
|
| 171 |
+
|
| 172 |
+
```bibtex
|
| 173 |
+
@article{cheng2023autoround,
|
| 174 |
+
title = {Optimize Weight Rounding via Signed Gradient Descent for the Quantization of LLMs},
|
| 175 |
+
author = {Cheng, Wenhua and Zhang, Weiwei and Shen, Haihao and Cai, Yiyang and He, Xin and Lv, Kaokao and Liu, Yi},
|
| 176 |
+
journal = {arXiv preprint arXiv:2309.05516},
|
| 177 |
+
year = {2023}
|
| 178 |
+
}
|
| 179 |
+
```
|