# yaml-language-server: $schema=https://recipes.vllm.ai/recipe.schema.json meta: title: "Qwen4-35B-A3B" slug: "qwen4-35b-a3b" provider: "Qwen" description: "Qwen4 multimodal MoE (35B with 3B active, plus 20B N-gram embeddings and 2B MTP) with a native NVFP4 KV cache, built-in MTP and a 1M-token context window" date_added: 2026-12-04 date_updated: 2026-12-04 tasks: - multimodal - text performance_headline: "Native NVFP4 K/V cache, about 3.6x smaller than BF16 K/V, with 3B active parameters on a single GPU" default_hardware: b300 default_variant: mi350x: bf16 mi355x: bf16 m890: bf16 810e: bf16 hardware: b300: verified gb200: verified h200: verified h100: supported rtx_pro_6000: supported dgx_spark_gb10: verified mi350x: verified mi355x: verified m890: verified 810e: verified related_recipes: - "Qwen/Qwen3.8-Flash-Next" - "Qwen/Qwen3.6-35B-A3B" model: model_id: "Qwen/Qwen4-35B-A3B" docker_image: nvidia: "vllm/vllm-openai:qwen4" amd: "vllm/vllm-openai-rocm:qwen4" install: docker: note: "Use the dedicated Qwen4 image" pip: false default_frontend: rust architecture: moe parameter_count: "35B" active_parameters: "3B" context_length: 1048576 base_args: - "--trust-remote-code" - "--enable-prefix-caching" base_env: {} features: tool_calling: description: "Enable automatic tool choice with the Qwen4 tool parser" args: - "--enable-auto-tool-choice" - "--tool-call-parser" - "qwen4" reasoning: description: "Extract thinking output with the Qwen4 reasoning parser" args: - "--reasoning-parser" - "qwen4" spec_decoding: description: "Use the checkpoint's Multi-Token Prediction module with 3 draft tokens" args: - "--speculative-config" - '{"method":"mtp","num_speculative_tokens":3,"index_share_for_mtp_iteration":true}' hardware_overrides: amd: args: - "--speculative-config" - '{"method":"mtp","num_speculative_tokens":3,"index_share_for_mtp_iteration":true,"draft_lm_head_quantization":"fp8"}' ppu: args: - "--speculative-config" - '{"method":"mtp","num_speculative_tokens":3}' text_only: description: "Skip the vision encoder for text-only workloads and leave more memory for KV cache" args: - "--language-model-only" opt_in_features: - text_only # vram_minimum_gb: GPU-resident weights x 1.2. The N-gram table stays in host memory. variants: default: model_id: "Qwen/Qwen4-35B-A3B-FP8" precision: fp8 vram_minimum_gb: 48 supported_hardware: [h100, h200, b200, gb200, b300, gb300, rtx_pro_6000, dgx_spark_gb10, mi350x, mi355x, m890] precision_hardware: {} description: "Official FP8 checkpoint: 39.7 GB model and 20.5 GB N-gram table; the MI350X / MI355X command adds --quantization-config '{\"moe\":\"mxfp4\"}' to re-quantize the routed experts to MXFP4 at load" hardware_overrides: amd: extra_args: - "--quantization-config" - '{"moe":"mxfp4"}' m890: extra_env: VLLM_ENGINE_READY_TIMEOUT_S: "3600" docker_image: "egslingjun-registry.cn-wulanchabu.cr.aliyuncs.com/egslingjun-tmp/vllm:sail-qwen4-35b-a3b" docker_serve_command: "vllm serve" install: pip: false docker: vllm_version: "0.34.0" bf16: precision: bf16 vram_minimum_gb: 88 precision_hardware: {} description: "Official BF16 checkpoint: 72.7 GB model and 41 GB N-gram table; the MI350X / MI355X command adds --quantization mxfp4 to quantize the routed experts to MXFP4 at load" hardware_overrides: amd: extra_args: - "--quantization" - "mxfp4" - "--quantization-config" - '{"linear":{"activation":null,"weight":null}}' ppu: extra_env: VLLM_ENGINE_READY_TIMEOUT_S: "3600" docker_image: "egslingjun-registry.cn-wulanchabu.cr.aliyuncs.com/egslingjun-tmp/vllm:sail-qwen4-35b-a3b" docker_serve_command: "vllm serve" install: pip: false docker: vllm_version: "0.34.0" default_strategy: single_node_tp compatible_strategies: - single_node_tp strategy_overrides: single_node_tp: tp: default: 1 810e: 2 hardware_overrides: 810e: extra_args: - "--enable-expert-parallel" dgx_spark_gb10: extra_args: # NVFP4 K/V cache is not supported on SM121. - "--kv-cache-dtype" - "fp8" # Unified memory; leave room for the host. - "--gpu-memory-utilization" - "0.75" hardware_overrides: hopper: extra_args: - "--max-model-len" - "auto" - "--disable-flashinfer-autotune" - "--kv-cache-dtype" - "nvfp4" - "--attention-config.indexer_kv_dtype" - "fp8" blackwell: extra_args: - "--max-model-len" - "auto" - "--disable-flashinfer-autotune" - "--kv-cache-dtype" - "nvfp4" - "--attention-config.indexer_kv_dtype" - "fp8" amd: extra_args: - "--max-model-len" - "auto" - "--monokernel" extra_env: VLLM_ROCM_USE_AITER: "1" troubleshooting: - title: "engine input registration timed out after 600s" when: { hardware: [dgx_spark_gb10] } body: | On DGX Spark, the first start after downloading the checkpoint can take longer than the 600 s ready timeout. Set `VLLM_ENGINE_READY_TIMEOUT_S=1800`, or flush the page cache first as NVIDIA's [DGX Spark known issues](https://docs.nvidia.com/dgx/dgx-spark/known-issues.html) page describes. guide: | ## Overview [Qwen4-35B-A3B](https://huggingface.co/Qwen/Qwen4-35B-A3B) is a multimodal Mixture-of-Experts model: 35B parameters with 3B activated, plus 20B N-gram embeddings and a 2B MTP module, with a native 1,048,576-token context window. Highlights from the model card: - **Efficient architecture:** the Qwen4 architecture, introduced in [Qwen3.8-Flash-Next](../Qwen3.8-Flash-Next), interleaves Gated DeltaNet linear attention with Qwen Sparse Attention (3:1) for fast long-context inference and a small cache. N-gram embeddings add quality without extra compute or GPU memory. - **Long-horizon agentic work:** stronger sustained, multi-step task delivery, and stronger coding for visual and creative deliverables. - **Token efficiency:** more concise thinking at every effort level and fewer rounds per task. ## Native NVFP4 KV cache The model is trained with quantization-aware training for a native NVFP4 KV cache (`--kv-cache-dtype nvfp4`), about 3.6x smaller than BF16 K/V; the QSA indexer cache uses FP8 (`--attention-config.indexer_kv_dtype fp8`). ## Prerequisites - **Hardware:** one NVIDIA GPU, such as H200 or datacenter Blackwell (B200, B300, GB200, GB300), one AMD MI350X or MI355X, one Zhenwu M890 PPU, or two Zhenwu 810E PPUs (TP2 with expert parallelism); H100 and DGX Spark (GB10) fit the FP8 checkpoint. GPU-resident weights take 39.7 GB (FP8) or 72.7 GB (BF16). - **Host memory:** 20.5 GB (FP8) or 41 GB (BF16) for the N-gram table, which is offloaded to host RAM by default, plus runtime headroom. - **vLLM:** the `vllm/vllm-openai:qwen4` Docker image on NVIDIA, `vllm/vllm-openai-rocm:qwen4` on AMD MI350X and MI355X, and the Zhenwu PPU image on M890 and 810E. ## Serving notes - **Context length:** `--max-model-len auto` uses the full window when KV cache allows and otherwise lowers it to fit (logged at startup); pass an explicit `--max-model-len` to pin a limit. - **Features:** tool calling and reasoning use the `qwen4` parsers on both the Rust and Python frontends; MTP drafts 3 tokens; enable **Text only** to skip the vision encoder for text-only workloads. - **Startup speed:** on NVIDIA, `--disable-flashinfer-autotune` speeds up startup; remove it for the best prefill speed. - **DGX Spark (GB10):** NVFP4 K/V cache is not supported on SM121; the command uses FP8 instead. GPU and CPU share memory, so `--gpu-memory-utilization 0.75` leaves room for the host. - **MI350X / MI355X:** both checkpoints serve the routed experts as MXFP4. The default command serves the BF16 checkpoint with `--quantization mxfp4`, which quantizes them at load; its `--quantization-config` keeps attention and the other linear layers in BF16. The FP8 command re-quantizes its block-FP8 experts (`--quantization-config '{"moe":"mxfp4"}'`) and keeps the other layers FP8 as shipped. AITER kernels are on (`VLLM_ROCM_USE_AITER=1`). MTP drafts with an FP8 `lm_head` (`draft_lm_head_quantization`). `--monokernel` runs decode steps of up to 16 rows (4 requests with MTP) as persistent kernel launches, -22% per decode step at concurrency 1; larger steps and prefill take the standard path, so it stays on for every workload. - **Zhenwu:** M890 (TP1) serves BF16 and FP8 on the Zhenwu PPU image. 810E (TP2 with expert parallelism) offers BF16 only. ## Client usage - **Thinking:** set `reasoning_effort` to `xhigh`, `high` (default), `low`, or `none` to turn thinking off. - **Sampling:** thinking mode uses `temperature=1.0`, `top_p=0.95`, `top_k=20` (the checkpoint default); with thinking off, use `temperature=0.7`, `top_p=0.8`, `top_k=20`, `presence_penalty=1.5`. ```python from openai import OpenAI client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY") resp = client.chat.completions.create( model=client.models.list().data[0].id, messages=[{ "role": "user", "content": [ {"type": "image_url", "image_url": {"url": "https://example.com/chart.png"}}, {"type": "text", "text": "Summarize this chart."}, ], }], reasoning_effort="high", # xhigh / high / low; "none" (not "off") disables thinking ) print(resp.choices[0].message.content) ``` ## References - [Qwen4-35B-A3B model card](https://huggingface.co/Qwen/Qwen4-35B-A3B) - [Qwen4-35B-A3B-FP8](https://huggingface.co/Qwen/Qwen4-35B-A3B-FP8)