Qwen3-Dense (Qwen3-0.6B/1.7B/4B/8B/14B/32B)¶
1 Introduction¶
Qwen3 is the latest generation of large language models in Qwen series, offering a comprehensive suite of dense and mixture-of-experts (MoE) models. Built upon extensive training, Qwen3 delivers groundbreaking advancements in reasoning, instruction-following, agent capabilities, and multilingual support. The Dense variants covered in this document include Qwen3-0.6B, 1.7B, 4B, 8B, 14B, and 32B, along with their quantized versions (W8A8, W4A4, and W8A8SC-310) optimized for Ascend NPU deployment.
This document will demonstrate the main validation steps for Qwen3 Dense models in the vLLM-Ascend environment, including supported features, environment preparation, model quantization, single-node and multi-node deployment, as well as accuracy and performance evaluation. By tailoring service-level configurations to fit different use cases, you can ensure optimal performance across various scenarios.
The Qwen3 Dense models are first supported in v0.8.4rc2. W8A8 quantization was first supported in v0.8.4rc2, and W4A4 is supported since v0.11.0rc1. Atlas 300I Duo uses the W8A8SC-310 quantized weights listed in this tutorial. This document is validated and written based on vLLM-Ascend v0.21.0. All v0.21.0 and later versions can run stably. To use the latest features, it is recommended to use the latest release candidate or official version.
2 Supported Features¶
Please refer to the Supported Features List for the model support matrix.
Please refer to the Feature Guide for feature configuration information.
3 Prerequisites¶
3.1 Model Weight¶
The following model variants are available. It is recommended to download the model weight to a shared directory accessible to all nodes.
BF16 Versions:
| Model | Hardware Requirement | Download |
|---|---|---|
| Qwen3-0.6B | 1 Atlas A3 inference products (64GB × 16), 1 Atlas A2 inference products (64GB × 8) | Hugging Face | ModelScope | Modelers |
| Qwen3-1.7B | 1 Atlas A3 inference products (64GB × 16), 1 Atlas A2 inference products (64GB × 8) | Hugging Face | ModelScope | Modelers |
| Qwen3-4B | 1 Atlas A3 inference products (64GB × 16), 1 Atlas A2 inference products (64GB × 8) | Hugging Face | ModelScope | Modelers |
| Qwen3-8B | 1 Atlas A3 inference products (64GB × 16), 1 Atlas A2 inference products (64GB × 8) | Hugging Face | ModelScope | Modelers |
| Qwen3-14B | 1 Atlas A3 inference products (64GB × 16), 1 Atlas A2 inference products (64GB × 8) | Hugging Face | ModelScope | Modelers |
| Qwen3-32B | 1 Atlas A3 inference products (64GB × 16), 1 Atlas A2 inference products (64GB × 8) | Hugging Face | ModelScope | Modelers |
Quantized Versions for Atlas A2/A3 inference products:
| Model | Quantization | Hardware Requirement | Download |
|---|---|---|---|
| Qwen3-32B-W4A4 | W4A4 | 1 Atlas A3 inference products (64GB × 16) or 1 Atlas A2 inference products (64GB × 8) | ModelScope |
| Qwen3-32B-W8A8 | W8A8 | 1 Atlas A3 inference products (64GB × 16) or 1 Atlas A2 inference products (64GB × 8) | ModelScope |
Quantized Versions for Atlas 300I Duo:
| Model | Quantization | Hardware Requirement | Download |
|---|---|---|---|
| Qwen3-8B-W8A8SC | W8A8SC | Atlas 300I Duo (TP1) | ModelScope |
| Qwen3-14B-W8A8SC | W8A8SC | Atlas 300I Duo (TP1) | ModelScope |
| Qwen3-32B-W8A8SC | W8A8SC | Atlas 300I Duo (TP4) | ModelScope |
These are the recommended numbers of cards, which can be adjusted according to the actual situation.
Note
The W4A4, W8A8, and W8A8SC-310 quantized weights listed above are currently published on ModelScope only, so no Hugging Face link is provided for them.
Path description: Download the model weights to a directory of your choice and record it, for example
/mnt/weight/Qwen3-32B-W8A8. In the deployment commands below,your_model_pathis a placeholder: replace it with the directory recorded here.
4 Installation¶
4.1 Docker Image Installation¶
The container commands below need Ascend Docker Runtime on the host: it is the container engine's runtime, it reads ASCEND_VISIBLE_DEVICES and binds the selected devices into the container. Without it the container starts with no NPU inside, so npu-smi reports no device. Install and verify it once per host, as described in that section. If you cannot install it on the host, use the device and driver flags in Manual device mapping without Ascend Docker Runtime.
You can use the official all-in-one Docker image for Qwen3 Dense models.
Docker Pull:
Docker Run:
Start the docker image on each node.
export IMAGE=quay.io/ascend/vllm-ascend:v0.32.0rc1-a3
docker run --rm \
-e ASCEND_VISIBLE_DEVICES=0-15 \
--name vllm-ascend-env \
--shm-size=1g \
--net=host \
-v /usr/local/Ascend/driver/tools/hccn_tool:/usr/local/Ascend/driver/tools/hccn_tool \
-v /root/.cache:/root/.cache \
-it $IMAGE bash
Note
Atlas A3 inference products have 8 NPUs with a dual-die design, so ASCEND_VISIBLE_DEVICES=0-15 selects all 16 DIE devices.
If you are on a shared machine, select only the devices you need, for example ASCEND_VISIBLE_DEVICES=0-7 for NPU 0-3.
The default workdir is /workspace. vLLM and vLLM-Ascend are installed as Python packages in site-packages.
Installation Verification: After starting the container, run the following command to verify the installation:
# The A2/A3 and Atlas 300I Duo tabs name the container vllm-ascend-env.
docker ps | grep vllm-ascend-env
Expected result: The container is listed with status Up. You can also verify the vllm-ascend version inside the container:
Expected result: The version information is displayed, matching the pulled image version.
4.2 Source Code Installation¶
If you prefer to build from source instead of using the Docker image, install vLLM-Ascend following the Installation Guide.
Note
For Atlas 300I Duo, source installation may pull in triton and triton-ascend. Uninstall them before running vLLM-Ascend on Atlas 300I Duo:
To verify the source installation:
Expected result: The version information is displayed, confirming a successful installation.
Note
If deploying a multi-node environment, set up the environment on each node.
5 Online Service Deployment¶
5.1 Single-Node Online Deployment¶
Single-node deployment completes both Prefill and Decode within the same node, suitable for development, testing, and small-to-medium scale inference scenarios.
Start the server:
The following command is an example configuration. Adjust the parameters based on your actual scenario.
Qwen3-32B-W8A8:
export HCCL_OP_EXPANSION_MODE="AIV"
export ASCEND_RT_VISIBLE_DEVICES=0,1,2,3
export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True
# Replace your_model_path with the directory recorded in Section 3.1 Model Weight
vllm serve your_model_path \
--served-model-name qwen3 \
--trust-remote-code \
--quantization ascend \
--distributed-executor-backend "mp" \
--tensor-parallel-size 4 \
--max-model-len 5500 \
--max-num-batched-tokens 40960 \
--compilation-config '{"cudagraph_mode": "FULL_DECODE_ONLY"}' \
--port <port> \
--gpu-memory-utilization 0.9
Qwen3-32B-W4A4:
export HCCL_BUFFSIZE=1024
export ASCEND_RT_VISIBLE_DEVICES=0,1
# Replace your_model_path with the directory recorded in Section 3.1 Model Weight
vllm serve your_model_path \
--port 8004 \
--data-parallel-size 1 \
--tensor-parallel-size 2 \
--served-model-name qwen3 \
--distributed-executor-backend "mp" \
--max-model-len 40960 \
--max-num-batched-tokens 16384 \
--max-num-seqs 64 \
--trust-remote-code \
--gpu-memory-utilization 0.9 \
--quantization ascend \
--compilation-config '{"cudagraph_capture_sizes": [64]}' \
--additional-config '{"ascend_compilation_config": {"fuse_norm_quant": false}}'
Note
With VLLM_USE_MODELSCOPE=True, the vllm serve path below is a ModelScope repository plus the
TP-specific sub-directory, so it does not need to be replaced. If you downloaded the weights locally,
replace it with your own absolute path (the directory recorded in Section 3.1 Model Weight).
Qwen3-8B-W8A8SC:
export VLLM_USE_MODELSCOPE=True
export ASCEND_RT_VISIBLE_DEVICES=0
vllm serve Eco-Tech/Qwen3-8B-w8a8sc-310-vllm/TP1/Qwen3-8B-w8a8sc-310-vllm-tp1 \
--host 127.0.0.1 \
--port 8080 \
--tensor-parallel-size 1 \
--gpu-memory-utilization 0.90 \
--max-num-seqs 32 \
--served-model-name qwen3 \
--dtype float16 \
--additional-config '{"ascend_compilation_config": {"enable_npugraph_ex":false}}' \
--compilation-config '{"cudagraph_mode": "FULL_DECODE_ONLY", "cudagraph_capture_sizes": [1,2,4,8,16,32]}' \
--quantization ascend \
--max-model-len 20480 \
--no-enable-prefix-caching \
--load-format sharded_state
Qwen3-14B-W8A8SC:
export VLLM_USE_MODELSCOPE=True
export ASCEND_RT_VISIBLE_DEVICES=0
vllm serve Eco-Tech/Qwen3-14B-w8a8sc-310-vllm/TP1/Qwen3-14B-w8a8sc-310-vllm-tp1 \
--host 127.0.0.1 \
--port 8080 \
--tensor-parallel-size 1 \
--gpu-memory-utilization 0.90 \
--max-num-seqs 16 \
--served-model-name qwen3 \
--dtype float16 \
--additional-config '{"ascend_compilation_config": {"enable_npugraph_ex":false}}' \
--compilation-config '{"cudagraph_mode": "FULL_DECODE_ONLY", "cudagraph_capture_sizes": [1,2,4,8,16]}' \
--quantization ascend \
--max-model-len 20480 \
--no-enable-prefix-caching \
--load-format sharded_state
Qwen3-32B-W8A8SC:
export VLLM_USE_MODELSCOPE=True
export ASCEND_RT_VISIBLE_DEVICES=0,1,2,3
vllm serve Eco-Tech/Qwen3-32B-w8a8sc-310-vllm/TP4/Qwen3-32B-w8a8sc-310-vllm-tp4 \
--host 127.0.0.1 \
--port 8080 \
--tensor-parallel-size 4 \
--gpu-memory-utilization 0.90 \
--max-num-seqs 32 \
--served-model-name qwen3 \
--dtype float16 \
--additional-config '{"ascend_compilation_config": {"enable_npugraph_ex":false}}' \
--compilation-config '{"cudagraph_mode": "FULL_DECODE_ONLY", "cudagraph_capture_sizes": [16,32]}' \
--quantization ascend \
--max-model-len 20480 \
--no-enable-prefix-caching \
--load-format sharded_state
Key parameters:
--tensor-parallel-size: number of NPU chips the model is sharded across. Choose a value that divides the attention head count of the chosen model size.--max-model-len: maximum sequence length (prompt plus generated tokens). Larger values allocate more KV cache memory and attention workspace; lower it if the service reports OOM at startup.--max-num-batched-tokens: maximum number of tokens processed in one scheduler step. Larger values improve prefill throughput at the cost of first-token latency.--max-num-seqs: maximum number of concurrently running sequences; it bounds KV cache and graph capture pressure.--compilation-config: ACLGraph settings.FULL_DECODE_ONLYenables graph replay for the decode phase, andcudagraph_capture_sizeslists the batch sizes captured at startup, so it should cover your expected concurrency.--gpu-memory-utilization: fraction of NPU memory reserved for the KV cache; reduce it when startup or runtime requests report OOM.--quantization ascend: required for the W8A8/W4A4/W8A8SC weights listed in Section 3.1; remove it when serving BF16 weights.--distributed-executor-backend "mp": uses multi-process execution for multi-card tensor parallelism.
Note
- vLLM Serving Arguments documentation — Additional parameter details for vLLM serve commands.
- Environment Variables — Ascend-specific environment variables (
HCCL_*, etc.).
Service Verification:
If the service starts successfully, the following startup log will be displayed:
(APIServer pid=<pid>) INFO: Started server process [<pid>]
(APIServer pid=<pid>) INFO: Waiting for application startup.
(APIServer pid=<pid>) INFO: Application startup complete.
You can also verify the service from another terminal:
Expected result: HTTP 200 with an empty body. A request to /v1/models should return the served model name qwen3.
For troubleshooting, refer to Section 10 FAQ and the Public FAQs.
6 Functional Verification¶
After the service is started, the model can be invoked by sending a prompt.
Chat Completions API:
curl http://localhost:<port>/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3",
"messages": [
{"role": "user", "content": "Give me a short introduction to large language models."}
],
"temperature": 0.6,
"top_p": 0.95,
"top_k": 20,
"max_completion_tokens": 4096
}'
Expected result: HTTP 200 with a JSON response containing the choices field with generated text.
7 Accuracy Evaluation¶
7.1 Using AISBench¶
For setup details, including installation, dataset download, and configuration, please refer to Using AISBench.
The following is an example configuration for the accuracy evaluation config file:
Accuracy Evaluation Config File:
# Example configuration: benchmarks/ais_bench/benchmark/configs/models/vllm_api/vllm_api_general_chat.py
from ais_bench.benchmark.models import VLLMCustomAPIChat
from ais_bench.benchmark.utils.postprocess.model_postprocessors import extract_non_reasoning_content
models = [
dict(
attr="service",
type=VLLMCustomAPIChat,
abbr='vllm-api-general-chat',
path="your_model_path",
model="qwen3",
request_rate=0,
retry=2,
host_ip="127.0.0.1",
host_port=2001,
max_out_len=32768,
batch_size=32,
trust_remote_code=False,
generation_kwargs=dict(
temperature=0.6,
top_k=20,
top_p=0.95,
),
pred_postprocessor=dict(type=extract_non_reasoning_content)
)
]
Run the accuracy evaluation using the aime2025 dataset as an example:
The
--modelsparameter value corresponds to the config file name (for example,vllm_api_general_chatforvllm_api_general_chat.py). Adjustmax_out_len,batch_size, and dataset tasks based on your scenario.
8 Performance Evaluation¶
8.1 Using AISBench¶
For setup details, including installation, dataset download, and configuration, please refer to Using AISBench for details.
The following is an example configuration for the performance evaluation config file:
# Example configuration: benchmarks/ais_bench/benchmark/configs/models/vllm_api/vllm_api_stream_chat.py
from ais_bench.benchmark.models import VLLMCustomAPIChat
from ais_bench.benchmark.utils.postprocess.model_postprocessors import extract_non_reasoning_content
models = [
dict(
attr="service",
type=VLLMCustomAPIChat,
abbr="vllm-api-stream-chat",
path="your_model_path",
model="qwen3",
stream=True,
request_rate=0,
use_timestamp=False,
retry=2,
host_ip="127.0.0.1",
host_port=8004,
max_out_len=1500,
batch_size=90,
trust_remote_code=False,
generation_kwargs=dict(
temperature=0,
ignore_eos=True
),
)
]
Run the performance evaluation using the GSM8K dataset as an example:
ais_bench --models vllm_api_stream_chat --datasets gsm8k_gen_0_shot_cot_str_perf --debug --summarizer default_perf --mode perf --num-prompts 360
Expected result:
AISBench prints one line per finished request and then a summary table. Check the following fields in the summary; the exact values depend on hardware, model size, and input/output lengths:
Request throughput (req/s): completed requests per second.Output token throughput (tok/s): generated tokens per second.Mean TTFT (ms)/P99 TTFT (ms): time to first token, average and 99th percentile.Mean TPOT (ms)/P99 TPOT (ms): time per output token, average and 99th percentile.
The detailed results are written under outputs/ (or the directory given by --work-dir), including the per-request CSV and the summary JSON.
8.2 Using vLLM Benchmark¶
Refer to vLLM benchmark for more details.
There are three vllm bench subcommands:
latency: Benchmark the latency of a single batch of requests.serve: Benchmark the online serving throughput.throughput: Benchmark offline inference throughput.
Take serve as an example:
vllm bench serve \
--model your_model_path \
--served-model-name qwen3 \
--port <port> \
--dataset-name random \
--random-input-len 200 \
--num-prompts 200 \
--request-rate 1 \
--save-result \
--result-dir ./
After the benchmark finishes (usually after several minutes for 200 requests), vLLM prints a summary that includes Request throughput (req/s), Output token throughput (tok/s), Mean TTFT (ms), Mean TPOT (ms), and their P99 values. With --save-result, the same metrics are written to a JSON file in --result-dir, which makes it easy to compare runs.
9 Performance Tuning¶
Please refer to the vLLM Features, vLLM Ascend Additional Configuration, vLLM Ascend Feature Matrix and vLLM Ascend Feature Guide for detailed key parameter descriptions.
9.1 Recommended Configurations¶
Note: The following configurations are validated in specific test environments and are for reference only. The optimal configuration depends on factors such as maximum input/output length, prefix cache hit rate, precision requirements, and deployment machine ratios. It is recommended to refer to Section 9.2 for tuning based on actual conditions.
Table 1: Scenario Overview¶
| Scenario | Deployment Mode | *Total NPUs | Weight Version | Key Considerations |
|---|---|---|---|---|
| High Throughput | Single-Node (TP4) | 4 (Atlas A3 inference products) | W8A8 | 4-card TP maximizes concurrent request processing |
| Long Context | Single-Node (TP4) | 4 (Atlas A3 inference products) | W8A8 | 4-card TP extends context window for long sequences |
| Low Latency | Single-Node (TP8) | 8 (Atlas A3 inference products) | W8A8 | 8-card TP reduces per-token latency for interactive responses |
*Total NPUsindicates the total number of NPUs used across all nodes.
Table 2: Detailed Node Configuration¶
| Scenario | Configuration | NPUs | TP | DP | FUSED_MC2 | EP Switch | Async Scheduling |
|---|---|---|---|---|---|---|---|
| High Throughput | Single-Node | 4 | 4 | 1 | Off | Off | On |
| Long Context | Single-Node | 4 | 4 | 1 | Off | Off | On |
| Low Latency | Single-Node | 8 | 8 | 1 | Off | Off | On |
For detailed parameter descriptions, please refer to the deployment examples in Section 5.1.
High Throughput Configuration:
export HCCL_OP_EXPANSION_MODE="AIV"
export ASCEND_RT_VISIBLE_DEVICES=0,1,2,3
export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True
vllm serve your_model_path \
--served-model-name qwen3 \
--trust-remote-code \
--distributed-executor-backend "mp" \
--tensor-parallel-size 4 \
--max-model-len 5500 \
--max-num-batched-tokens 40960 \
--no-enable-prefix-caching \
--quantization ascend \
--compilation-config '{"cudagraph_mode":"FULL_DECODE_ONLY","cudagraph_capture_sizes":[4,8,64,72,76,80,96,100,120,140,144,160,192,216,240,252,288,320,336,360,384,400,408,416,420,432,480,540,576,600]}' \
--additional-config '{"weight_prefetch_config":{"enabled":true}, "pa_shape_list":[32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256]}' \
--host <host_ip> \
--port <port> \
--block-size 128 \
--gpu-memory-utilization 0.9
Long Context Configuration:
export HCCL_OP_EXPANSION_MODE="AIV"
export ASCEND_RT_VISIBLE_DEVICES=0,1,2,3
export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True
vllm serve your_model_path \
--host <host_ip> \
--port <port> \
--served-model-name qwen3 \
--trust-remote-code \
--seed 1024 \
--max-model-len 135000 \
--max-num-batched-tokens 40960 \
--tensor-parallel-size 4 \
--distributed-executor-backend "mp" \
--no-enable-prefix-caching \
--speculative-config '{"method": "eagle3", "model":"your_eagle3_model_path", "num_speculative_tokens": 3}' \
--compilation-config '{"cudagraph_mode": "FULL_DECODE_ONLY"}' \
--hf-overrides '{"rope_parameters": {"rope_type":"yarn","rope_theta":1000000,"factor":4,"original_max_position_embeddings":131072}}' \
--gpu-memory-utilization 0.9 \
--quantization ascend
Low Latency Configuration:
export HCCL_OP_EXPANSION_MODE="AIV"
export ASCEND_RT_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True
vllm serve your_model_path \
--served-model-name qwen3 \
--trust-remote-code \
--distributed-executor-backend "mp" \
--tensor-parallel-size 8 \
--max-model-len 5500 \
--max-num-batched-tokens 40960 \
--no-enable-prefix-caching \
--quantization ascend \
--compilation-config '{"cudagraph_mode": "FULL_DECODE_ONLY","cudagraph_capture_sizes":[1,2,4,8,16,32,64,72,76,80,96,100,120,140,144,160,192,216,240,252,288,320,336,360,384,400,408,416,420,432,480,540,576,600]}' \
--speculative-config '{"method": "eagle3", "model":"your_eagle3_model_path", "enforce_eager": true, "num_speculative_tokens": 3}' \
--port <port> \
--block-size 128 \
--gpu-memory-utilization 0.9
9.2 Tuning Guidelines¶
9.2.1 General Tuning Reference¶
Please refer to the Public Performance Tuning Documentation for tuning methods. Please refer to the Feature Matrix for detailed feature descriptions.
10 FAQ¶
For common environment, installation, and general parameter issues, please refer to the Public FAQs. This section only covers issues specific to Qwen3 Dense models.