Serve Qwen3 dense or Qwen3 30B-A3B
Use these recipes to serve unquantized Qwen3-0.6B on one Ascend NPU or Qwen3 30B-A3B with mixture-of-experts (MoE) and expert parallelism.
Model and hardware prerequisites
Qwen2, dense Qwen3, and Qwen3 MoE checkpoints use different architecture names. Choose the recipe that matches your checkpoint and hardware:
- Qwen3-0.6B on Ascend NPU: Use one Ascend NPU and the prepared ARM64/Python 3.12 stack described in the NPU kernel setup. Load the CANN environment, allocate one NPU to the process, and pre-stage the checkpoint before starting. The task does not download the model.
- Qwen3 30B-A3B: Use the
Qwen/Qwen3-30B-A3Bcheckpoint and hardware supported by theflashinfer_cutlassMoE backend. The example uses tensor parallel size 2 and expert parallelism. The checkpoint's Hugging Face configuration advertises the model typeqwen3_moeand the architectureQwen3MoeForCausalLM, so launch it as an MoE model.
Serve Qwen3-0.6B on Ascend NPU
The NPU model CI task runs unquantized Qwen3-0.6B on one NPU with BF16 weights, paged MHA, eager prefill and decode, and greedy sampling. To reproduce this serving configuration, follow these steps:
From the repository root, install the runtime and its pinned dependencies:
bashbash test/ci_system/install_deps_npu.shThe source installer builds the native engine and installs the runtime's pinned dependencies, including SMG, while preserving the image's accelerator packages.
Set the runtime environment for the NPU process:
bashexport PYTHONPATH="$PWD/python:$PWD/tokenspeed-kernel/python:$PWD/tokenspeed-kernel-npu/python:$PWD/tokenspeed-scheduler/python${PYTHONPATH:+:$PYTHONPATH}" export TORCH_DEVICE_BACKEND_AUTOLOAD=1 export PYTORCH_NPU_ALLOC_CONF=expandable_segments:False export TORCH_HCCL_ZERO_COPY=0 export TASK_QUEUE_ENABLE=1 export ASCEND_LAUNCH_BLOCKING=0Set
MODEL_PATHto the pre-staged Qwen3-0.6B checkpoint and verify that its configuration is readable. CI mounts/data/weights/Qwen3-0.6Bread-only; replace this path with your local checkpoint path outside CI:bash# CI mounts this checkpoint read-only; use your local checkpoint path otherwise. MODEL_PATH=/data/weights/Qwen3-0.6B test -r "$MODEL_PATH/config.json"Start the server with paged MHA, eager execution, and greedy sampling:
bashpython3 -m tokenspeed.cli serve \ --model "$MODEL_PATH" \ --served-model-name Qwen3-0.6B \ --device npu --tensor-parallel-size 1 --dtype bfloat16 \ --attention-backend mha --sampling-backend greedy \ --disable-prefill-graph --enforce-eager --disable-pdl \ --max-model-len 4096 --max-num-seqs 4 --max-total-tokens 16384 \ --host 127.0.0.1 --port 8000The standard
mhabackend selects registered Ascend kernels.--enforce-eagerdisables decode ACL Graphs in this CI configuration; it is intentional. ACL Graph capture is a separate mode with its own capture-size and capacity validation, and this task does not exercise it.After
/readinesssucceeds, verify the chat endpoint with the served model name. Because--sampling-backend greedyperforms argmax, usetemperature=0; request-leveltop_pandtop_kdo not turn it into stochastic sampling:bashcurl http://127.0.0.1:8000/v1/chat/completions \ -H 'Content-Type: application/json' \ -d '{ "model": "Qwen3-0.6B", "messages": [{"role": "user", "content": "What is 2 + 2?"}], "temperature": 0, "max_tokens": 64, "chat_template_kwargs": {"enable_thinking": false} }'A successful request returns a chat completion for
Qwen3-0.6B, confirming that the server is ready and the served model name matches the request.
CI evaluation scope
The separate GSM8K task uses the same server configuration and evaluates the first 100 examples with four concurrent requests, thinking disabled, and a 1,024-token generation limit. Its 0.60 accuracy floor is a bounded regression check, not a full benchmark claim. For triggers, installation behavior, and reports, see NPU CI.
Multi-NPU and ACL Graph configurations need their own validation; the single-NPU eager task does not establish their coverage.
Serve Qwen3 30B-A3B with expert parallelism
Start Qwen3 30B-A3B as an MoE model with tensor parallel size 2, expert parallelism, the
flashinfer_cutlassMoE backend, and theqwen3reasoning parser. The command serves the model asqwen3-30b-a3bon port8000; no placeholder values need replacement:bashtokenspeed serve Qwen/Qwen3-30B-A3B \ --served-model-name qwen3-30b-a3b \ --tensor-parallel-size 2 \ --enable-expert-parallel \ --moe-backend flashinfer_cutlass \ --max-model-len 40960 \ --reasoning-parser qwen3 \ --host 0.0.0.0 \ --port 8000After
/readinesssucceeds, verify the chat endpoint with the served model name:bashcurl --fail http://127.0.0.1:8000/v1/chat/completions \ -H 'Content-Type: application/json' \ -d '{ "model": "qwen3-30b-a3b", "messages": [{"role": "user", "content": "What is 2 + 2?"}], "max_tokens": 64, "chat_template_kwargs": {"enable_thinking": false} }'A successful request returns a chat completion for
qwen3-30b-a3b, confirming that the server is ready and the served model name matches the request.