|
| 1 | +# Qwen3-235B-A22B |
| 2 | + |
| 3 | +## Introduction |
| 4 | + |
| 5 | +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. |
| 6 | + |
| 7 | +This document will show the main verification steps of the model, including supported features, feature configuration, environment preparation, single-node and multi-node deployment, accuracy and performance evaluation. |
| 8 | + |
| 9 | +The `Qwen3-235B-A22B` model is first supported in `vllm-ascend:v0.8.4rc2`. |
| 10 | + |
| 11 | +## Supported Features |
| 12 | + |
| 13 | +Refer to [supported features](../user_guide/support_matrix/supported_models.md) to get the model's supported feature matrix. |
| 14 | + |
| 15 | +Refer to [feature guide](../user_guide/feature_guide/index.md) to get the feature's configuration. |
| 16 | + |
| 17 | +## Environment Preparation |
| 18 | + |
| 19 | +### Model Weight |
| 20 | + |
| 21 | +- `Qwen3-235B-A22B`(BF16 version): require 1 Atlas 800 A3 (64G × 16) nodes or 1 Atlas 800 A2 (64G × 8) nodes. [Download model weight](https://modelers.cn/models/Modelers_Park/Qwen3-235B-A22B) |
| 22 | +- `Qwen3-235B-A22B-w8a8`(Quantized version): require 1 Atlas 800 A3 (64G × 16) node or 1 Atlas 800 A2 (64G × 8) nodes. [Download model weight](https://modelers.cn/models/Modelers_Park/Qwen3-235B-A22B-w8a8) |
| 23 | + |
| 24 | +It is recommended to download the model weight to the shared directory of multiple nodes, such as `/root/.cache/` |
| 25 | + |
| 26 | +### Verify Multi-node Communication(Optional) |
| 27 | + |
| 28 | +If you want to deploy multi-node environment, you need to verify multi-node communication according to [verify multi-node communication environment](../installation.md#verify-multi-node-communication). |
| 29 | + |
| 30 | +### Installation |
| 31 | + |
| 32 | +:::::{tab-set} |
| 33 | +::::{tab-item} Use vllm-ascend:v0.11.0rc1 docker image |
| 34 | + |
| 35 | +Currently, we provide the all-in-one images `quay.io/ascend/vllm-ascend:v0.11.0rc1`(for Atlas 800 A2) and `quay.io/ascend/vllm-ascend:v0.11.0rc1-a3`(for Atlas 800 A3). |
| 36 | + |
| 37 | +Refer to [using docker](../installation.md#set-up-using-docker) to set up environment using Docker. |
| 38 | + |
| 39 | +:::: |
| 40 | +::::{tab-item} Build from source |
| 41 | + |
| 42 | +You can build all from source. |
| 43 | + |
| 44 | +- Install `vllm-ascend`, refer to [set up using python](../installation.md#set-up-using-python). |
| 45 | + |
| 46 | +:::: |
| 47 | +::::: |
| 48 | + |
| 49 | +If you want to deploy multi-node environment, you need to set up environment on each node. |
| 50 | + |
| 51 | +## Deployment |
| 52 | + |
| 53 | +### Single-node Deployment |
| 54 | + |
| 55 | +`Qwen3-235B-A22B` and `Qwen3-235B-A22B-w8a8` can both be deployed on 1 Atlas 800 A3 or 1 Atlas 800 A2. |
| 56 | +Quantized version need to start with parameter `--quantization ascend`. |
| 57 | + |
| 58 | +Run the following script to execute online inference. |
| 59 | + |
| 60 | +```shell |
| 61 | +#!/bin/sh |
| 62 | +export VLLM_USE_MODELSCOPE=true |
| 63 | +export HCCL_BUFFSIZE=512 |
| 64 | +export HCCL_OP_EXPANSION_MODE="AIV" |
| 65 | +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True |
| 66 | +export OMP_PROC_BIND=false |
| 67 | +export OMP_NUM_THREADS=10 |
| 68 | +export VLLM_ASCEND_ENABLE_FLASHCOMM1=1 |
| 69 | + |
| 70 | +vllm serve vllm-ascend/Qwen3-235B-A22B-w8a8 \ |
| 71 | +--host 0.0.0.0 \ |
| 72 | +--port 8000 \ |
| 73 | +--tensor-parallel-size 8 \ |
| 74 | +--data-parallel-size 1 \ |
| 75 | +--seed 1024 \ |
| 76 | +--quantization ascend \ |
| 77 | +--served-model-name qwen3 \ |
| 78 | +--max-num-seqs 4 \ |
| 79 | +--max-model-len 133000 \ |
| 80 | +--max-num-batched-tokens 8096 \ |
| 81 | +--enable-expert-parallel \ |
| 82 | +--trust-remote-code \ |
| 83 | +--gpu-memory-utilization 0.95 \ |
| 84 | +--rope-scaling '{"rope_type":"yarn","factor":4,"original_max_position_embeddings":32768}' \ |
| 85 | +--additional-config '{"ascend_scheduler_config":{"enabled":false}}' \ |
| 86 | +--compilation-config '{"cudagraph_capture_sizes":[1,4,8],"cudagraph_mode":"FULL_DECODE_ONLY"}' \ |
| 87 | +--async-scheduling |
| 88 | +``` |
| 89 | + |
| 90 | +The parameters are explained as follows: |
| 91 | +- `--data-parallel-size` 1 and `--tensor-parallel-size` 8 are common settings for data parallelism (DP) and tensor parallelism (TP) sizes. |
| 92 | +- `--max-model-len` represents the context length, which is the maximum value of the input plus output for a single request. |
| 93 | +- `--max-num-seqs` indicates the maximum number of requests that each DP group is allowed to process. If the number of requests sent to the service exceeds this limit, the excess requests will remain in a waiting state and will not be scheduled. Note that the time spent in the waiting state is also counted in metrics such as TTFT and TPOT. Therefore, when testing performance, it is generally recommended that `--max-num-seqs` * `--data-parallel-size` >= the actual total concurrency. |
| 94 | +- `--max-num-batched-tokens` represents the maximum number of tokens that the model can process in a single step. Currently, vLLM v1 scheduling enables ChunkPrefill/SplitFuse by default, which means: |
| 95 | + - (1) If the input length of a request is greater than `--max-num-batched-tokens`, it will be divided into multiple rounds of computation according to `--max-num-batched-tokens`; |
| 96 | + - (2) Decode requests are prioritized for scheduling, and prefill requests are scheduled only if there is available capacity. |
| 97 | + - Generally, if `--max-num-batched-tokens` is set to a larger value, the overall latency will be lower, but the pressure on GPU memory (activation value usage) will be greater. |
| 98 | +- `--gpu-memory-utilization` represents the proportion of HBM that vLLM will use for actual inference. Its essential function is to calculate the available kv_cache size. During the warm-up phase (referred to as profile run in vLLM), vLLM records the peak GPU memory usage during an inference process with an input size of `--max-num-batched-tokens`. The available kv_cache size is then calculated as: `--gpu-memory-utilization` * HBM size - peak GPU memory usage. Therefore, the larger the value of `--gpu-memory-utilization`, the more kv_cache can be used. However, since the GPU memory usage during the warm-up phase may differ from that during actual inference (e.g., due to uneven EP load), setting `--gpu-memory-utilization` too high may lead to OOM (Out of Memory) issues during actual inference. The default value is `0.9`. |
| 99 | +- `--enable-expert-parallel` indicates that EP is enabled. Note that vLLM does not support a mixed approach of ETP and EP; that is, MoE can either use pure EP or pure TP. |
| 100 | +- `--no-enable-prefix-caching` indicates that prefix caching is disabled. To enable it, remove this option. |
| 101 | +- `--quantization` "ascend" indicates that quantization is used. To disable quantization, remove this option. |
| 102 | +- `--compilation-config` contains configurations related to the aclgraph graph mode. The most significant configurations are "cudagraph_mode" and "cudagraph_capture_sizes", which have the following meanings: |
| 103 | +"cudagraph_mode": represents the specific graph mode. Currently, "PIECEWISE" and "FULL_DECODE_ONLY" are supported. The graph mode is mainly used to reduce the cost of operator dispatch. Currently, "FULL_DECODE_ONLY" is recommended. |
| 104 | +- "cudagraph_capture_sizes": represents different levels of graph modes. The default value is [1, 2, 4, 8, 16, 24, 32, 40,..., `--max-num-seqs`]. In the graph mode, the input for graphs at different levels is fixed, and inputs between levels are automatically padded to the next level. Currently, the default setting is recommended. Only in some scenarios is it necessary to set this separately to achieve optimal performance. |
| 105 | +- `export VLLM_ASCEND_ENABLE_FLASHCOMM1=1` indicates that Flashcomm1 optimization is enabled. Currently, this optimization is only supported for MoE in scenarios where tp_size > 1. |
| 106 | + |
| 107 | +### Multi-node Deployment with Ray |
| 108 | + |
| 109 | +- refer to [Multi-Node-Ray (Qwen/Qwen3-235B-A22B)](./multi_node_ray.md). |
| 110 | + |
| 111 | +### Prefill-Decode Disaggregation |
| 112 | + |
| 113 | +- refer to [Prefill-Decode Disaggregation Llmdatadist Verification (Qwen)](./multi_node_pd_disaggregation_llmdatadist.md) or [Prefill-Decode Disaggregation Mooncake Verification (Qwen)](./multi_node_pd_disaggregation_mooncake.md) |
| 114 | + |
| 115 | +## Functional Verification |
| 116 | + |
| 117 | +Once your server is started, you can query the model with input prompts: |
| 118 | + |
| 119 | +```shell |
| 120 | +curl http://<node0_ip>:<port>/v1/completions \ |
| 121 | + -H "Content-Type: application/json" \ |
| 122 | + -d '{ |
| 123 | + "model": "qwen3", |
| 124 | + "prompt": "The future of AI is", |
| 125 | + "max_tokens": 50, |
| 126 | + "temperature": 0 |
| 127 | + }' |
| 128 | +``` |
| 129 | + |
| 130 | +## Accuracy Evaluation |
| 131 | + |
| 132 | +Here are two accuracy evaluation methods. |
| 133 | + |
| 134 | +### Using AISBench |
| 135 | + |
| 136 | +1. Refer to [Using AISBench](../developer_guide/evaluation/using_ais_bench.md) for details. |
| 137 | + |
| 138 | +2. After execution, you can get the result, here is the result of `Qwen3-235B-A22B-w8a8` in `vllm-ascend:0.11.0rc0` for reference only. |
| 139 | + |
| 140 | +| dataset | version | metric | mode | vllm-api-general-chat | |
| 141 | +|----- | ----- | ----- | ----- | -----| |
| 142 | +| cevaldataset | - | accuracy | gen | 91.16 | |
| 143 | + |
| 144 | +## Performance |
| 145 | + |
| 146 | +### Using AISBench |
| 147 | + |
| 148 | +Refer to [Using AISBench for performance evaluation](../developer_guide/evaluation/using_ais_bench.md#execute-performance-evaluation) for details. |
| 149 | + |
| 150 | +### Using vLLM Benchmark |
| 151 | + |
| 152 | +Run performance evaluation of `wen3-235B-A22B-w8a8` as an example. |
| 153 | + |
| 154 | +Refer to [vllm benchmark](https://docs.vllm.ai/en/latest/contributing/benchmarks.html) for more details. |
| 155 | + |
| 156 | +There are three `vllm bench` subcommand: |
| 157 | +- `latency`: Benchmark the latency of a single batch of requests. |
| 158 | +- `serve`: Benchmark the online serving throughput. |
| 159 | +- `throughput`: Benchmark offline inference throughput. |
| 160 | + |
| 161 | +Take the `serve` as an example. Run the code as follows. |
| 162 | + |
| 163 | +```shell |
| 164 | +export VLLM_USE_MODELSCOPE=true |
| 165 | +vllm bench serve --model vllm-ascend/wen3-235B-A22B-w8a8 --dataset-name random --random-input 200 --num-prompt 200 --request-rate 1 --save-result --result-dir ./ |
| 166 | +``` |
| 167 | + |
| 168 | +After about several minutes, you can get the performance evaluation result. |
0 commit comments