Image-Text-to-Text
Transformers
Safetensors
qwen3_5_moe
quantized
gptq
int4
Mixture of Experts
qwen3.6
mtp
speculative-decoding
conversational
4-bit precision
Instructions to use palmfuture/Qwen3.6-35B-A3B-GPTQ-Int4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use palmfuture/Qwen3.6-35B-A3B-GPTQ-Int4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="palmfuture/Qwen3.6-35B-A3B-GPTQ-Int4") 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("palmfuture/Qwen3.6-35B-A3B-GPTQ-Int4") model = AutoModelForMultimodalLM.from_pretrained("palmfuture/Qwen3.6-35B-A3B-GPTQ-Int4", 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 palmfuture/Qwen3.6-35B-A3B-GPTQ-Int4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "palmfuture/Qwen3.6-35B-A3B-GPTQ-Int4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "palmfuture/Qwen3.6-35B-A3B-GPTQ-Int4", "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/palmfuture/Qwen3.6-35B-A3B-GPTQ-Int4
- SGLang
How to use palmfuture/Qwen3.6-35B-A3B-GPTQ-Int4 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 "palmfuture/Qwen3.6-35B-A3B-GPTQ-Int4" \ --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": "palmfuture/Qwen3.6-35B-A3B-GPTQ-Int4", "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 "palmfuture/Qwen3.6-35B-A3B-GPTQ-Int4" \ --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": "palmfuture/Qwen3.6-35B-A3B-GPTQ-Int4", "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 palmfuture/Qwen3.6-35B-A3B-GPTQ-Int4 with Docker Model Runner:
docker model run hf.co/palmfuture/Qwen3.6-35B-A3B-GPTQ-Int4
File size: 8,746 Bytes
7e5600f b27a61b 7e5600f b27a61b d1fef18 afe11e2 7e5600f b27a61b afe11e2 b27a61b afe11e2 b27a61b f32841f b27a61b afe11e2 b27a61b afe11e2 b27a61b 7e5600f b27a61b 7e5600f b27a61b 7e5600f b27a61b 7e5600f b27a61b 7e5600f b27a61b 7e5600f b27a61b 7e5600f b27a61b 7e5600f b27a61b afe11e2 7e5600f afe11e2 b27a61b d1fef18 a413772 d1fef18 a413772 d1fef18 a413772 d1fef18 a413772 afe11e2 bddd3f8 afe11e2 d1fef18 afe11e2 b27a61b afe11e2 b27a61b 7e5600f a413772 | 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 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | ---
base_model: Qwen/Qwen3.6-35B-A3B
license: apache-2.0
language:
- en
- th
- zh
- multilingual
tags:
- quantized
- gptq
- int4
- moe
- qwen3.6
- qwen3_5_moe
- mtp
- speculative-decoding
library_name: transformers
pipeline_tag: image-text-to-text
---
# Qwen3.6-35B-A3B-GPTQ-Int4
GPTQ Int4 quantization of [Qwen/Qwen3.6-35B-A3B](https://huggingface.co/Qwen/Qwen3.6-35B-A3B), produced on **consumer multi-GPU hardware** (4Γ RTX 3060 12GB) using Python 3.13t free-threading.
This v2 release ships **MTP (Multi-Token Prediction) speculative decoding weights** verified working on both vLLM 0.19.1 and SGLang 0.5.10.
## Quality
| Metric | Value |
|--------|-------|
| GPTQ success rate | **97.42%** |
| RTN fallback rate | 2.58% |
| Loss mean | 1.38e-04 |
| Loss median | 9.29e-05 |
| Loss max | 2.14e-03 |
| Total modules | 30,720 |
| Perplexity (wikitext-2-raw-v1) | 6.1846 (~97.9% BF16 retention) |
## Model specs
| Property | Value |
|----------|-------|
| Base model | Qwen3.6-35B-A3B (MoE, 35B total / 3B active) |
| Architecture | `Qwen3_5MoeForConditionalGeneration` (vision + text) |
| Experts | 256 (top-8 routing per token) |
| Hidden layers | 40 |
| Context length | 262,144 tokens |
| Quantization | GPTQ v2, 4-bit, group_size=128, symmetric |
| Quantized size | 24.4 GB (incl. MTP weights) |
| KV cache support | fp16, bf16, fp8_e4m3 (storage-only on Ampere) |
| MTP head | Included (BF16, 785 keys, split per-expert format) |
### What's quantized vs kept bf16
**Quantized (int4):** All MoE expert weights (`mlp.experts.*`) across layers 0β39
**Kept bf16 (per Qwen3.6 recipe):**
- Attention layers (`*.attn.*`)
- MoE routers (`*.mlp.gate`)
- Shared experts (`*.shared_expert.*`)
- Multi-token prediction heads (`*.mtp.*`) β see [Speculative decoding](#speculative-decoding-mtp) below
- Vision encoder (`*.visual.*`)
- Embeddings and `lm_head`
## Calibration recipe
Domain-mixed calibration set to ensure all 256 experts receive meaningful activation signal:
| Source | Samples | Purpose |
|--------|---------|---------|
| [allenai/c4](https://huggingface.co/datasets/allenai/c4) | 102 | General English text |
| [allenai/tulu-3-sft-mixture](https://huggingface.co/datasets/allenai/tulu-3-sft-mixture) | 77 | Instruction-following |
| [codeparrot/codeparrot-clean-valid](https://huggingface.co/datasets/codeparrot/codeparrot-clean-valid) | 51 | Code generation |
| [HuggingFaceH4/MATH-500](https://huggingface.co/datasets/HuggingFaceH4/MATH-500) | 26 | Mathematical reasoning |
| **Total** | **256** (seq_len=1024) | |
## Hardware used for quantization
- **GPUs**: 4Γ NVIDIA RTX 3060 12GB
- **Motherboard**: SuperMicro C9X299-RPGF (LGA 2066)
- **CPU**: Intel i9-7900X (10c/20t, Skylake-X)
- **RAM**: 32 GB DDR4-2666
- **Runtime**: ~4h 20m wall-clock
## Toolchain
| Component | Version |
|-----------|---------|
| GPTQModel | 6.0.3 |
| Flash Linear Attention (FLA) | 0.4.2 |
| PyTorch | 2.11.0+cu128 |
| Triton | 3.6.0 (cp313t wheel) |
| Python | **3.13.13t** (free-threading, no-GIL) |
| CUDA | 12.8 |
Python 3.13t was the enabler for multi-GPU quantization on consumer cards β the no-GIL runtime let GPTQModel's data-parallel quantizer actually use all 4 GPUs without serializing through the interpreter lock.
## Usage
### SGLang (recommended for production)
```bash
python -m sglang.launch_server \
--model-path palmfuture/Qwen3.6-35B-A3B-GPTQ-Int4 \
--quantization moe_wna16 \
--tp-size 4 \
--mem-fraction-static 0.89 \
--kv-cache-dtype fp8_e4m3 \
--context-length 262144 \
--port 30000
```
Verified on 4Γ RTX 3060 12GB with SGLang 0.5.10 (`max_total_num_tokens=415184`, `context_len=262144`, `max_running_requests=39`).
### vLLM
```bash
vllm serve palmfuture/Qwen3.6-35B-A3B-GPTQ-Int4 \
--tensor-parallel-size 4 \
--max-model-len 200000 \
--gpu-memory-utilization 0.85 \
--kv-cache-dtype fp8 \
--dtype bfloat16 \
--reasoning-parser qwen3 \
--enable-auto-tool-choice \
--tool-call-parser qwen3_coder \
--trust-remote-code
```
> **Important:** Do **not** pass `--quantization moe_wna16` to vLLM. Let vLLM auto-detect quantization from `config.json`. Forcing the flag triggers a `KeyError: 'experts.w2_weight'` in the `Qwen3_5MoeMTP` loader path even when MTP is disabled.
### Transformers (single-GPU, for testing)
Requires `trust_remote_code=True` for the Qwen3.5-MoE architecture.
## Recommended sampling
Follow the [official Qwen3.6 sampling guidance](https://huggingface.co/Qwen/Qwen3.6-35B-A3B). For workloads where you want to cap reasoning length (agents, coding tasks), see [vllm-default-thinking-budget](https://github.com/palmfuture/vllm-default-thinking-budget) β a vLLM plugin I built for setting default `thinking_token_budget` and `presence_penalty`:
```bash
git clone https://github.com/palmfuture/vllm-default-thinking-budget
./vllm-default-thinking-budget/install.sh /path/to/your/vllm/venv
export VLLM_DEFAULT_THINKING_BUDGET=8192
export VLLM_DEFAULT_PRESENCE_PENALTY=1.0
vllm serve palmfuture/Qwen3.6-35B-A3B-GPTQ-Int4 ...
```
## Speculative decoding (MTP)
This release ships **MTP (Multi-Token Prediction) weights** in the per-expert split format expected by vLLM and SGLang loaders (785 MTP keys total, all BF16). Speculative decoding is verified working on both engines.
### vLLM with MTP
```bash
vllm serve palmfuture/Qwen3.6-35B-A3B-GPTQ-Int4 \
--tensor-parallel-size 4 \
--max-model-len 200000 \
--gpu-memory-utilization 0.85 \
--kv-cache-dtype fp8 \
--dtype bfloat16 \
--reasoning-parser qwen3 \
--enable-auto-tool-choice \
--tool-call-parser qwen3_coder \
--speculative-config '{"method": "mtp", "num_speculative_tokens": 2}' \
--trust-remote-code
```
Verified on vLLM 0.19.1 + 4Γ RTX 3060 12GB:
| Metric | Value |
|--------|-------|
| Steady-state decode | 56β82 t/s |
| Avg draft acceptance rate | 70β89% (peak 88.9%) |
| Per-position acceptance | token 1: ~0.93, token 2: ~0.85 |
| Mean acceptance length | 2.4β2.8 / 2 draft tokens |
| KV pool | 160,800 tokens (262K max-model-len, 2.34Γ concurrency) |
### SGLang with MTP (EAGLE)
```bash
SGLANG_ENABLE_SPEC_V2=1 \
SGLANG_MAMBA_CONV_DTYPE=float16 \
python -m sglang.launch_server \
--model-path palmfuture/Qwen3.6-35B-A3B-GPTQ-Int4 \
--tp-size 4 \
--dtype float16 \
--quantization moe_wna16 \
--context-length 200000 \
--mem-fraction-static 0.80 \
--mamba-scheduler-strategy extra_buffer \
--speculative-algorithm EAGLE \
--speculative-eagle-topk 1 \
--speculative-num-steps 3 \
--speculative-num-draft-tokens 4 \
--reasoning-parser qwen3 \
--tool-call-parser qwen3_coder \
--port 30000
```
Verified on SGLang 0.5.10 + 4Γ RTX 3060 12GB: 52β141 t/s decode (peak with batching), 34β70% acceptance rate, 1.4β2.8 mean acceptance length.
### Notes on MTP weight layout
This release stores MTP experts in **per-expert split format** (`mtp.layers.0.mlp.experts.{i}.{gate,up,down}_proj.weight`, 256 experts Γ 3 projections = 768 expert keys), matching the layout that the upstream vLLM/SGLang MTP loaders expect.
The Qwen3.6 BF16 base model stores these as **fused 3D tensors** (`gate_up_proj` shape `[E, 2I, H]`, `down_proj` shape `[E, H, I]`). They are split bit-for-bit during release packaging β there is no quantization or numerical transformation of the MTP head, only a tensor reshape.
## Reproducibility
The full per-module quantization log is published as [`quant_log.csv`](./quant_log.csv) (1.8 MB). Each row records the layer, module, GPTQ loss (or RTN fallback marker), sample count, damping value, and wall-clock time β making the run fully auditable.
## Known characteristics
- **Per-layer RTN distribution.** Layers 32β39 show ~7β10% RTN rate vs ~1β3% for early layers. Consistent with MoE routing concentration in deeper layers and memory pressure late in the run.
- **Cold experts.** 157 of 256 expert IDs fell back to RTN in at least one layer; 99 always got GPTQ. Top cold experts: 235, 249, 234, 197, 237. These rarely route at inference.
- **Ampere-only limitations.** On RTX 3060 (SM86), fp8 KV cache is storage-only (dequantized for attention). No FP8 compute path.
- **vLLM `--quantization` flag.** Do not pass `--quantization moe_wna16` to vLLM β it triggers a `KeyError` in the MTP loader path. SGLang requires the flag; vLLM must auto-detect.
## Credits
- [Qwen Team](https://huggingface.co/Qwen) β base model
- [ModelCloud / GPTQModel](https://github.com/ModelCloud/GPTQModel) β quantization framework
- [sustcsonglin / flash-linear-attention](https://github.com/sustcsonglin/flash-linear-attention) β GDN hybrid attention support
- Python 3.13 free-threading working group β no-GIL runtime
---
Quantized by [@palmfuture](https://huggingface.co/palmfuture). |