Signed-off-by: esmeetu <jasonailu87@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
196 lines
5.5 KiB
YAML
196 lines
5.5 KiB
YAML
meta:
|
||
title: "Qwen3.5-4B"
|
||
slug: "qwen3.5-4b"
|
||
provider: "Qwen"
|
||
description: "Qwen3.5 compact dense multimodal model (4B) — fits on 16 GB consumer GPUs with full 262K context or one Xeon 6 NUMA node or Intel Arc Pro B60/B70"
|
||
date_added: 2026-04-22
|
||
date_updated: 2026-09-14
|
||
tasks:
|
||
- multimodal
|
||
- text
|
||
performance_headline: "Consumer-GPU-friendly Qwen3.5 dense with MTP support"
|
||
related_recipes:
|
||
- "Qwen/Qwen3.5-9B"
|
||
- "Qwen/Qwen3.5-2B"
|
||
hardware:
|
||
xeon6: verified
|
||
arc_pro_b60: verified
|
||
arc_pro_b70: verified
|
||
|
||
model:
|
||
model_id: "Qwen/Qwen3.5-4B"
|
||
min_vllm_version: "0.17.0"
|
||
default_frontend: rust
|
||
architecture: dense
|
||
parameter_count: "4B"
|
||
active_parameters: "4B"
|
||
context_length: 262144
|
||
base_args:
|
||
- "--trust-remote-code"
|
||
base_env: {}
|
||
|
||
features:
|
||
tool_calling:
|
||
description: "Enable automatic tool choice with Qwen3 Coder parser"
|
||
args:
|
||
- "--enable-auto-tool-choice"
|
||
- "--tool-call-parser"
|
||
- "qwen3_coder"
|
||
reasoning:
|
||
description: "Enable chain-of-thought reasoning with Qwen3 parser"
|
||
args:
|
||
- "--reasoning-parser"
|
||
- "qwen3"
|
||
spec_decoding:
|
||
description: "Multi-token prediction speculative decoding for lower latency"
|
||
args:
|
||
- "--speculative-config"
|
||
- '{"method":"mtp","num_speculative_tokens":1}'
|
||
text_only:
|
||
description: "Skip loading the vision encoder for text-only workloads."
|
||
args:
|
||
- "--language-model-only"
|
||
long_context:
|
||
description: "YaRN RoPE scaling past the native 262,144-token window to ~1,010,000 tokens. Static YaRN holds the scaling factor constant regardless of input length, so leave this off unless you actually serve long prompts; for ~524K, halve the factor to 2.0."
|
||
args:
|
||
- "--hf-overrides"
|
||
- '{"text_config": {"rope_parameters": {"mrope_interleaved": true, "mrope_section": [11, 11, 10], "rope_type": "yarn", "rope_theta": 10000000, "partial_rotary_factor": 0.25, "factor": 4.0, "original_max_position_embeddings": 262144}}}'
|
||
- "--max-model-len"
|
||
- "1010000"
|
||
env:
|
||
VLLM_ALLOW_LONG_MAX_MODEL_LEN: "1"
|
||
|
||
opt_in_features:
|
||
- spec_decoding
|
||
- text_only
|
||
- long_context
|
||
|
||
variants:
|
||
default:
|
||
precision: bf16
|
||
vram_minimum_gb: 10
|
||
description: "Full precision BF16 — fits on a single 16 GB GPU or one Xeon 6 NUMA node or one Intel Arc Pro B60/B70"
|
||
supported_hardware: [xeon6, arc_pro_b60, arc_pro_b70]
|
||
|
||
fp8:
|
||
model_id: "RedHatAI/Qwen3.5-4B-FP8-dynamic"
|
||
precision: fp8
|
||
vram_minimum_gb: 5
|
||
description: "RedHatAI FP8 (E4M3) with dynamic per-token activation quantization"
|
||
supported_hardware: [arc_pro_b60, arc_pro_b70]
|
||
extra_args:
|
||
- "--kv-cache-dtype"
|
||
- "fp8"
|
||
|
||
compatible_strategies:
|
||
- single_node_tp
|
||
|
||
hardware_overrides:
|
||
xpu:
|
||
extra_args:
|
||
- "--enforce-eager"
|
||
|
||
strategy_overrides: {}
|
||
|
||
guide: |
|
||
## Overview
|
||
|
||
[Qwen3.5-4B](https://huggingface.co/Qwen/Qwen3.5-4B) is the compact dense
|
||
entry in the Qwen3.5 family — same gated delta networks architecture, vision
|
||
encoder, 262K context, and MTP decoding as the larger siblings, sized for
|
||
16 GB consumer GPUs.
|
||
|
||
## Prerequisites
|
||
|
||
- **vLLM version:** >= 0.17.0
|
||
- **Hardware:** single 16 GB GPU (RTX 4080 / L4 / A10 / T4-24GB) or one Xeon 6 NUMA node or one Intel Arc Pro B60/B70
|
||
|
||
### Install vLLM
|
||
|
||
```bash
|
||
uv venv
|
||
source .venv/bin/activate
|
||
uv pip install -U vllm --torch-backend=auto
|
||
```
|
||
|
||
### pip (Intel Xeon 6 CPUs)
|
||
For Intel and AMD x86 CPUs, follow the [CPU pre-built wheels](https://docs.vllm.ai/en/latest/getting_started/installation/cpu/#pre-built-wheels) installation instructions.
|
||
|
||
### Docker
|
||
```bash
|
||
docker pull vllm/vllm-openai-xpu:latest # Intel XPU (B60 / B70)
|
||
```
|
||
|
||
## Launching the Server
|
||
|
||
```bash
|
||
vllm serve Qwen/Qwen3.5-4B \
|
||
--max-model-len 262144 \
|
||
--reasoning-parser qwen3
|
||
```
|
||
|
||
### Intel Xeon 6 Deployment via Docker
|
||
|
||
Launch the x86 CPU vLLM Docker container for `Qwen/Qwen3.5-4B`:
|
||
|
||
```bash
|
||
docker run \
|
||
--privileged --ipc=host -p 8000:8000 \
|
||
-v ~/.cache/huggingface:/root/.cache/huggingface \
|
||
vllm/vllm-openai-cpu:latest-x86_64 Qwen/Qwen3.5-4B \
|
||
--trust-remote-code \
|
||
--tensor-parallel-size 1 \
|
||
--enable-auto-tool-choice \
|
||
--tool-call-parser qwen3_coder \
|
||
--reasoning-parser qwen3
|
||
```
|
||
|
||
### Docker (Intel XPU B60 / B70)
|
||
|
||
Validated on 1× Intel Arc Pro B60 / B70 (B60 24 GB, B70 32 GB per card) with the
|
||
official vLLM XPU image `vllm/vllm-openai-xpu:latest`.
|
||
|
||
```bash
|
||
docker run --device /dev/dri \
|
||
-v /dev/dri/by-path:/dev/dri/by-path --shm-size=16g \
|
||
--privileged --ipc=host -p 8000:8000 \
|
||
-v ~/.cache/huggingface:/root/.cache/huggingface \
|
||
vllm/vllm-openai-xpu:latest \
|
||
Qwen/Qwen3.5-4B \
|
||
--reasoning-parser qwen3 \
|
||
--enforce-eager
|
||
```
|
||
|
||
|
||
### MTP speculative decoding
|
||
|
||
```bash
|
||
vllm serve Qwen/Qwen3.5-4B \
|
||
--speculative-config '{"method": "mtp", "num_speculative_tokens": 1}' \
|
||
--reasoning-parser qwen3
|
||
```
|
||
|
||
## Client Usage
|
||
|
||
```python
|
||
from openai import OpenAI
|
||
|
||
client = OpenAI(api_key="EMPTY", base_url="http://localhost:8000/v1")
|
||
resp = client.chat.completions.create(
|
||
model="Qwen/Qwen3.5-4B",
|
||
messages=[{"role": "user", "content": "Hello!"}],
|
||
max_tokens=128,
|
||
)
|
||
print(resp.choices[0].message.content)
|
||
```
|
||
|
||
## Troubleshooting
|
||
|
||
- **CUDA graph / Mamba cache size error:** reduce `--max-cudagraph-capture-size`.
|
||
- **Disable reasoning:** add `--default-chat-template-kwargs '{"enable_thinking": false}'`.
|
||
|
||
## References
|
||
|
||
- [Model card](https://huggingface.co/Qwen/Qwen3.5-4B)
|
||
- [Base checkpoint](https://huggingface.co/Qwen/Qwen3.5-4B-Base)
|