{
  "hf_id": "Qwen/Qwen4-35B-A3B",
  "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",
      "mi350x": "verified",
      "mi355x": "verified",
      "m890": "verified",
      "810e": "verified"
    },
    "related_recipes": [
      "Qwen/Qwen3.8-Flash-Next",
      "Qwen/Qwen3.6-35B-A3B"
    ]
  },
  "recommended_command": {
    "hardware": "b300",
    "strategy": "single_node_tp",
    "variant": "default",
    "hub": "huggingface",
    "checkpoint_url": "https://huggingface.co/Qwen/Qwen4-35B-A3B-FP8",
    "node_count": 1,
    "deploy_type": "single_node",
    "env": {
      "VLLM_USE_RUST_FRONTEND": "1"
    },
    "docker_image": "vllm/vllm-openai:qwen4",
    "command": "vllm serve Qwen/Qwen4-35B-A3B-FP8 \\\n  --trust-remote-code \\\n  --enable-prefix-caching \\\n  --tensor-parallel-size 1 \\\n  --max-model-len auto \\\n  --disable-flashinfer-autotune \\\n  --kv-cache-dtype nvfp4 \\\n  --attention-config.indexer_kv_dtype fp8 \\\n  --enable-auto-tool-choice \\\n  --tool-call-parser qwen4 \\\n  --reasoning-parser qwen4 \\\n  --speculative-config '{\"method\":\"mtp\",\"num_speculative_tokens\":3,\"index_share_for_mtp_iteration\":true}'",
    "argv": [
      "vllm",
      "serve",
      "Qwen/Qwen4-35B-A3B-FP8",
      "--trust-remote-code",
      "--enable-prefix-caching",
      "--tensor-parallel-size",
      "1",
      "--max-model-len",
      "auto",
      "--disable-flashinfer-autotune",
      "--kv-cache-dtype",
      "nvfp4",
      "--attention-config.indexer_kv_dtype",
      "fp8",
      "--enable-auto-tool-choice",
      "--tool-call-parser",
      "qwen4",
      "--reasoning-parser",
      "qwen4",
      "--speculative-config",
      "{\"method\":\"mtp\",\"num_speculative_tokens\":3,\"index_share_for_mtp_iteration\":true}"
    ],
    "docker_command": "docker run --gpus all \\\n  --privileged --ipc=host -p 8000:8000 \\\n  -v ~/.cache/huggingface:/root/.cache/huggingface \\\n  -e VLLM_USE_RUST_FRONTEND=1 \\\n  vllm/vllm-openai:qwen4 Qwen/Qwen4-35B-A3B-FP8 \\\n  --trust-remote-code \\\n  --enable-prefix-caching \\\n  --tensor-parallel-size 1 \\\n  --max-model-len auto \\\n  --disable-flashinfer-autotune \\\n  --kv-cache-dtype nvfp4 \\\n  --attention-config.indexer_kv_dtype fp8 \\\n  --enable-auto-tool-choice \\\n  --tool-call-parser qwen4 \\\n  --reasoning-parser qwen4 \\\n  --speculative-config '{\"method\":\"mtp\",\"num_speculative_tokens\":3,\"index_share_for_mtp_iteration\":true}'",
    "docker_argv": [
      "docker",
      "run",
      "--gpus",
      "all",
      "--privileged",
      "--ipc=host",
      "-p",
      "8000:8000",
      "-v",
      "~/.cache/huggingface:/root/.cache/huggingface",
      "-e",
      "VLLM_USE_RUST_FRONTEND=1",
      "vllm/vllm-openai:qwen4",
      "Qwen/Qwen4-35B-A3B-FP8",
      "--trust-remote-code",
      "--enable-prefix-caching",
      "--tensor-parallel-size",
      "1",
      "--max-model-len",
      "auto",
      "--disable-flashinfer-autotune",
      "--kv-cache-dtype",
      "nvfp4",
      "--attention-config.indexer_kv_dtype",
      "fp8",
      "--enable-auto-tool-choice",
      "--tool-call-parser",
      "qwen4",
      "--reasoning-parser",
      "qwen4",
      "--speculative-config",
      "{\"method\":\"mtp\",\"num_speculative_tokens\":3,\"index_share_for_mtp_iteration\":true}"
    ],
    "strategy_spec": {
      "name": "single_node_tp",
      "deploy_type": "single_node",
      "display_name": "Tensor Parallel",
      "short_label": "TP",
      "orientation": "latency",
      "description": "Single-node tensor parallel. Splits the model across all local GPUs. TP size is set to the GPU count at deploy time. The simplest multi-GPU strategy — works for all model architectures.\n",
      "hardware_match": {
        "min_gpus": 1,
        "max_gpus": 8,
        "multi_node": false
      },
      "vllm_args": [],
      "parallel_flag": "--tensor-parallel-size"
    },
    "hardware_profile": {
      "brand": "NVIDIA",
      "generation": "blackwell",
      "compute_arch": "sm103",
      "display_name": "B300",
      "description": "NVIDIA B300 SXM 268 GB HBM3e · 8-GPU HGX B300 node (Blackwell Ultra)",
      "gpu_count": 8,
      "vram_gb": 2144,
      "multi_node": false
    },
    "alternatives": {
      "kv_store_centralized_mooncake": "/Qwen/Qwen4-35B-A3B/strategies/kv_store_centralized_mooncake.json",
      "kv_store_distributed_mooncake": "/Qwen/Qwen4-35B-A3B/strategies/kv_store_distributed_mooncake.json"
    },
    "by_hardware": {
      "b300": "/Qwen/Qwen4-35B-A3B/hw/b300.json",
      "h100": "/Qwen/Qwen4-35B-A3B/hw/h100.json",
      "h200": "/Qwen/Qwen4-35B-A3B/hw/h200.json",
      "b200": "/Qwen/Qwen4-35B-A3B/hw/b200.json",
      "gb200": "/Qwen/Qwen4-35B-A3B/hw/gb200.json",
      "gb300": "/Qwen/Qwen4-35B-A3B/hw/gb300.json",
      "rtx_pro_6000": "/Qwen/Qwen4-35B-A3B/hw/rtx_pro_6000.json",
      "mi350x": "/Qwen/Qwen4-35B-A3B/hw/mi350x.json",
      "mi355x": "/Qwen/Qwen4-35B-A3B/hw/mi355x.json",
      "mi300x": "/Qwen/Qwen4-35B-A3B/hw/mi300x.json",
      "mi325x": "/Qwen/Qwen4-35B-A3B/hw/mi325x.json",
      "810e": "/Qwen/Qwen4-35B-A3B/hw/810e.json",
      "m890": "/Qwen/Qwen4-35B-A3B/hw/m890.json"
    }
  },
  "model": {
    "model_id": "Qwen/Qwen4-35B-A3B",
    "docker_image": {
      "nvidia": "vllm/vllm-openai:qwen4",
      "amd": "vllm/vllm-openai-rocm:qwen4"
    },
    "default_frontend": "rust",
    "architecture": "moe",
    "parameter_count": "35B",
    "active_parameters": "3B",
    "context_length": 1048576,
    "base_args": [
      "--trust-remote-code",
      "--enable-prefix-caching"
    ],
    "base_env": {},
    "install": {
      "docker": {
        "command": "docker pull vllm/vllm-openai:qwen4",
        "note": "Use the dedicated Qwen4 image"
      }
    }
  },
  "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"
  ],
  "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",
        "mi350x",
        "mi355x"
      ],
      "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\"}"
          ]
        }
      },
      "json": "/Qwen/Qwen4-35B-A3B-FP8.json"
    },
    "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"
            }
          }
        }
      }
    }
  },
  "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"
      }
    }
  },
  "guide": "## Overview\n\n[Qwen4-35B-A3B](https://huggingface.co/Qwen/Qwen4-35B-A3B) is a multimodal\nMixture-of-Experts model: 35B parameters with 3B activated, plus 20B N-gram\nembeddings and a 2B MTP module, with a native 1,048,576-token context\nwindow. Highlights from the model card:\n\n- **Efficient architecture:** the Qwen4 architecture, introduced in\n  [Qwen3.8-Flash-Next](../Qwen3.8-Flash-Next), interleaves Gated DeltaNet\n  linear attention with Qwen Sparse Attention (3:1) for fast long-context\n  inference and a small cache. N-gram embeddings add quality without extra\n  compute or GPU memory.\n- **Long-horizon agentic work:** stronger sustained, multi-step task\n  delivery, and stronger coding for visual and creative deliverables.\n- **Token efficiency:** more concise thinking at every effort level and\n  fewer rounds per task.\n\n## Native NVFP4 KV cache\n\nThe model is trained with quantization-aware training for a native NVFP4 KV\ncache (`--kv-cache-dtype nvfp4`), about 3.6x smaller than BF16 K/V; the QSA\nindexer cache uses FP8 (`--attention-config.indexer_kv_dtype fp8`).\n\n## Prerequisites\n\n- **Hardware:** one NVIDIA GPU, such as H200 or datacenter Blackwell (B200,\n  B300, GB200, GB300), one AMD MI350X or MI355X, one Zhenwu M890 PPU, or two Zhenwu\n  810E PPUs (TP2 with expert parallelism); H100 fits the FP8 checkpoint.\n  GPU-resident weights take 39.7 GB (FP8) or 72.7 GB (BF16).\n- **Host memory:** 20.5 GB (FP8) or 41 GB (BF16) for the N-gram table, which\n  is offloaded to host RAM by default, plus runtime headroom.\n- **vLLM:** the `vllm/vllm-openai:qwen4` Docker image on NVIDIA,\n  `vllm/vllm-openai-rocm:qwen4` on AMD MI350X and MI355X, and the Zhenwu PPU image on\n  M890 and 810E.\n\n## Serving notes\n\n- **Context length:** `--max-model-len auto` uses the full window when KV\n  cache allows and otherwise lowers it to fit (logged at startup); pass an\n  explicit `--max-model-len` to pin a limit.\n- **Features:** tool calling and reasoning use the `qwen4` parsers on both\n  the Rust and Python frontends; MTP drafts 3 tokens; enable **Text only**\n  to skip the vision encoder for text-only workloads.\n- **Startup speed:** on NVIDIA, `--disable-flashinfer-autotune` speeds up\n  startup; remove it for the best prefill speed.\n- **MI350X / MI355X:** both checkpoints serve the routed experts as MXFP4. The\n  default command serves the BF16 checkpoint with `--quantization mxfp4`,\n  which quantizes them at load; its `--quantization-config` keeps attention\n  and the other linear layers in BF16. The FP8 command re-quantizes its\n  block-FP8 experts (`--quantization-config '{\"moe\":\"mxfp4\"}'`) and keeps\n  the other layers FP8 as shipped. AITER kernels are on\n  (`VLLM_ROCM_USE_AITER=1`). MTP drafts with an FP8 `lm_head`\n  (`draft_lm_head_quantization`). `--monokernel` runs decode steps of up to\n  16 rows (4 requests with MTP) as persistent kernel launches, -22% per\n  decode step at concurrency 1; larger steps and prefill take the standard\n  path, so it stays on for every workload.\n- **Zhenwu:** M890 (TP1) and 810E (TP2 with expert parallelism) serve the\n  BF16 checkpoint on the Zhenwu PPU image.\n\n## Client usage\n\n- **Thinking:** set `reasoning_effort` to `xhigh`, `high` (default),\n  `low`, or `none` to turn thinking off.\n- **Sampling:** thinking mode uses `temperature=1.0`, `top_p=0.95`,\n  `top_k=20` (the checkpoint default); with thinking off, use\n  `temperature=0.7`, `top_p=0.8`, `top_k=20`, `presence_penalty=1.5`.\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(base_url=\"http://localhost:8000/v1\", api_key=\"EMPTY\")\nresp = client.chat.completions.create(\n    model=client.models.list().data[0].id,\n    messages=[{\n        \"role\": \"user\",\n        \"content\": [\n            {\"type\": \"image_url\", \"image_url\": {\"url\": \"https://example.com/chart.png\"}},\n            {\"type\": \"text\", \"text\": \"Summarize this chart.\"},\n        ],\n    }],\n    reasoning_effort=\"high\",  # xhigh / high / low; \"none\" (not \"off\") disables thinking\n)\nprint(resp.choices[0].message.content)\n```\n\n## References\n\n- [Qwen4-35B-A3B model card](https://huggingface.co/Qwen/Qwen4-35B-A3B)\n- [Qwen4-35B-A3B-FP8](https://huggingface.co/Qwen/Qwen4-35B-A3B-FP8)\n",
  "source": {
    "source": "vllm",
    "repo": "vllm-project/vllm",
    "ref": "main",
    "sha": "eca2dfecd0621212c0fe37ea9954e42143ef2758",
    "path": "recipes/models/Qwen/Qwen4-35B-A3B.yaml",
    "edit_url": "https://github.com/vllm-project/vllm/edit/main/recipes/models/Qwen/Qwen4-35B-A3B.yaml",
    "overlays": []
  }
}