Qwen3.8-27B GPTQ 8-bit
GPTQ 8-bit quantization of
Qwen/Qwen3.8-27B, a 27B-parameter dense multimodal model. At 8 bits this is
effectively lossless — measured perplexity is within noise of the BF16 original — at 60% of the disk/VRAM footprint.
Includes the full vision encoder and MTP (Multi-Token Prediction) module for image understanding and speculative decoding support. A 4-bit FOEM variant (+0.81% perplexity, 21 GB) is available at
btbtyler09/Qwen3.8-27B-GPTQ-4bit.
Model Overview
- Architecture: Qwen3_5ForConditionalGeneration (multimodal: text + vision; dense sibling of
qwen3_5_moe)
- Total parameters: ~27B
- Layers: 64 (48 linear-attention + 16 full-attention, repeating 3:1 pattern)
- Hidden size: 5120, intermediate size: 17408 (dense MLP — no MoE)
- Context length: 262,144 tokens
- Vision encoder: 27-block ViT, BF16 (333 tensors)
- MTP module: 1-layer speculative decoding head, BF16 (15 tensors)
Quantization Details
All quantizable Linear modules in the text decoder are quantized to INT8 using GPTQ. The vision encoder, MTP module, norms, embeddings, and LM head remain at BF16/FP16.
| Component | Precision | Notes |
|---|
mlp.{gate_proj, up_proj, down_proj} | INT8 (GPTQ) | All 64 layers |
self_attn.{q,k,v,o}_proj | INT8 (GPTQ) | 16 full-attention layers |
linear_attn.{in_proj_qkv, in_proj_z, out_proj} | INT8 (GPTQ) | 48 linear-attention layers (GatedDeltaNet) |
linear_attn.{in_proj_a, in_proj_b} | FP16 | Tiny projections, kept at full precision |
Vision encoder (model.visual.*) | BF16 | 333 tensors, full precision |
MTP module (mtp.*) | BF16 | 15 tensors, full precision |
| Embeddings, LM head, norms | FP16/BF16 | Full precision |
GPTQ configuration:
- Bits: 8
- Group size: 32
- Symmetric: Yes
- desc_act: No
- true_sequential: Yes
- act_group_aware: Yes
- Fallback: RTN at 0.5% calibration-coverage threshold
Calibration
- Dataset: Mixed — evol-codealpaca-v1 (code) + C4 (general English text)
- Samples: 256, binned uniformly across context lengths 256–2048 tokens
- Quantizer: GPTQModel v6.0.3
- Note: this is general-purpose calibration. Calibrating on wikitext directly would yield lower wikitext perplexity but worse out-of-distribution performance; we optimized for the latter.
The exact quantization script is included in this repo as quantize.py.
Model Size
| Version | Size | Compression |
|---|
| BF16 (original) | ~56 GB | — |
| GPTQ 8-bit (this) | 31 GB | 1.8× |
| GPTQ 4-bit FOEM | 21 GB | 2.6× |
The total includes the BF16 vision encoder (~1.2 GB) and BF16 MTP head (~0.85 GB) which are kept at full precision.
Perplexity
Evaluated on wikitext-2-raw-v1 (test set), seq_len=2048, stride=512:
| Model | Perplexity | Degradation |
|---|
| BF16 (original) | 6.4457 | — |
| GPTQ 8-bit (this) | 6.4446 | -0.02% (within noise, effectively lossless) |
| GPTQ 4-bit FOEM | 6.4982 | +0.81% |
Usage
vLLM (Recommended for Serving)
1vllm serve btbtyler09/Qwen3.8-27B-GPTQ-8bit \
2 --tensor-parallel-size 4 \
3 --gpu-memory-utilization 0.95 \
4 --max-model-len 262144 \
5 --dtype float16 \
6 --skip-mm-profiling \
7 --limit-mm-per-prompt '{"image": 2}'
| Parameter | Description |
|---|
--tensor-parallel-size 4 | Shard across 4 GPUs (adjust to your setup) |
--gpu-memory-utilization 0.95 | Use 95% of GPU VRAM for KV cache + weights |
--max-model-len 262144 | Full 256K context window support |
--dtype float16 | Run in FP16 (required for ROCm GPTQ kernels) |
--skip-mm-profiling | Skip multimodal memory profiling at startup |
--limit-mm-per-prompt '{"image": 2}' | Allow up to 2 images per request |
vLLM bug workaround (may apply): Up through at least vLLM 0.19.x, Qwen3_5TextConfig defines ignore_keys_at_rope_validation as a list instead of a set, causing a TypeError during config parsing. Apply this patch before serving if you hit the error:
1python3 -c "
2for f in [
3 '/usr/local/lib/python3.12/dist-packages/vllm/transformers_utils/configs/qwen3_5.py',
4 '/usr/local/lib/python3.12/dist-packages/vllm/transformers_utils/configs/qwen3_5_moe.py',
5]:
6 t = open(f).read()
7 t = t.replace(
8 'ignore_keys_at_rope_validation\"] = [\n \"mrope_section\",\n \"mrope_interleaved\",\n ]',
9 'ignore_keys_at_rope_validation\"] = {\n \"mrope_section\",\n \"mrope_interleaved\",\n }')
10 open(f,'w').write(t)
11 print('Patched', f)
12"
Vision Example (via OpenAI API)
1import base64, requests
2
3with open("image.png", "rb") as f:
4 b64 = base64.b64encode(f.read()).decode()
5
6response = requests.post("http://localhost:8000/v1/chat/completions", json={
7 "model": "btbtyler09/Qwen3.8-27B-GPTQ-8bit",
8 "messages": [{"role": "user", "content": [
9 {"type": "image_url", "image_url": {"url": f"data:image/png;base64,{b64}"}},
10 {"type": "text", "text": "Describe what you see in this image."},
11 ]}],
12 "max_tokens": 1024,
13})
14print(response.json()["choices"][0]["message"]["content"])
GPTQModel / transformers
Loads natively under GPTQModel v6.0.3+ via the upstream Qwen3_5QModel definition (which uses AutoModelForImageTextToText and the multimodal model.language_model.layers.* weight prefix). No checkpoint patching needed.
1from gptqmodel import GPTQModel
2model = GPTQModel.load("btbtyler09/Qwen3.8-27B-GPTQ-8bit", trust_remote_code=True)
Note: transformers 5.x does not instantiate the MTP submodule for this architecture, so the mtp.* tensors are ignored (with a warning) when loading via transformers/GPTQModel. They are included in the checkpoint for engines that use them for speculative decoding.
Technical Notes
Qwen3.8-27B is a dense multimodal model — it shares the Qwen3_5ForConditionalGeneration wrapper with the MoE-based Qwen3.5/3.6-35B-A3B but uses a standard dense MLP in every decoder layer instead of an expert mixture. The text decoder alternates 3 linear-attention (GatedDeltaNet) layers with 1 full-attention layer, repeated 16 times for 64 total layers.
The vision encoder (27-block ViT) and MTP speculative decoding module are preserved at full BF16 precision from the original model. Only the text decoder's quantizable Linear modules are converted to INT8.
Credits
- Base Model: Qwen — Qwen3.8-27B
- Quantization: GPTQ via GPTQModel v6.0.3
- Quantized by: btbtyler09
License
This model inherits the
Apache 2.0 license from the base model.