Qwen3.5-27B/Qwen3.6-27B¶
1 简介¶
Qwen3.5-27B和Qwen3.6-27B是Qwen3.5/Qwen3.6系列中的密集混合Mamba-Transformer语言模型,集成了架构效率、强化学习规模和全球可访问性方面的突破。它们共享相同的混合注意力设计(GDN + 全注意力),因此在Ascend NPU上的部署对两个模型遵循相同的模式。它们适用于在Ascend NPU上运行的通用文本生成任务,如对话、内容创作和代码生成。
本文档将演示模型的主要验证步骤,包括支持的功能、功能配置、环境准备、单节点和多节点部署,以及准确性和性能评估。
强烈建议使用vllm-ascend的最新候选发布(rc)版本或最新正式版本。作为最低版本要求,Qwen3.5-27B首次支持于vllm-ascend:v0.17.0rc1,Qwen3.6-27B首次支持于vllm-ascend:v0.18.0rc1。
2 支持的功能¶
请参考支持功能列表了解模型支持矩阵。
请参考功能指南了解功能配置信息。
3 前提条件¶
3.1 模型权重¶
Qwen3.5-27B
Qwen3.5-27B(BF16版本):需要1个Atlas 800 A3(64G × 16)节点或1个Atlas 800 A2(64G × 8)节点。下载模型权重Qwen3.5-27B-w8a8(量化版本):需要1个Atlas 800 A3(64G × 16)节点或1个Atlas 800 A2(64G × 8)节点。下载模型权重
Qwen3.6-27B
Qwen3.6-27B(BF16版本):需要1个Atlas 800 A3(64G × 16)节点或1个Atlas 800 A2(64G × 8)节点。下载模型权重Qwen3.6-27B-w8a8(量化版本):需要1个Atlas 800 A3(64G × 16)节点或1个Atlas 800 A2(64G × 8)节点。下载模型权重
建议将模型权重下载到多个节点的共享目录中,例如/root/.cache/。
3.2 验证多节点通信¶
如果要部署多节点环境,需要按照验证多节点通信环境验证多节点通信。
4 安装¶
4.1 Docker镜像安装¶
根据机器类型选择镜像并在节点上启动docker镜像,参考使用docker。
建议使用vllm-ascend镜像的最新候选发布(rc)版本或最新正式版本,以确保最佳兼容性并访问最新功能。作为最低版本要求,vllm-ascend:v0.17.0rc1使用Qwen3.5-27B(或更高版本),vllm-ascend:v0.18.0rc1使用Qwen3.6-27B(或更高版本)。对于Atlas 800 A3上的Qwen3.6-27B,请使用匹配的v0.18.0rc1-a3(或更高版本的-a3)镜像。
在每个节点上启动docker镜像。
export IMAGE=m.daocloud.io/quay.io/ascend/vllm-ascend:v0.22.1rc1-a3
docker run --rm \
--name vllm-ascend \
--shm-size=1g \
--net=host \
--device /dev/davinci0 \
--device /dev/davinci1 \
--device /dev/davinci2 \
--device /dev/davinci3 \
--device /dev/davinci4 \
--device /dev/davinci5 \
--device /dev/davinci6 \
--device /dev/davinci7 \
--device /dev/davinci8 \
--device /dev/davinci9 \
--device /dev/davinci10 \
--device /dev/davinci11 \
--device /dev/davinci12 \
--device /dev/davinci13 \
--device /dev/davinci14 \
--device /dev/davinci15 \
--device /dev/davinci_manager \
--device /dev/devmm_svm \
--device /dev/hisi_hdc \
-v /usr/local/dcmi:/usr/local/dcmi \
-v /usr/local/Ascend/driver/tools/hccn_tool:/usr/local/Ascend/driver/tools/hccn_tool \
-v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
-v /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ \
-v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info \
-v /etc/ascend_install.info:/etc/ascend_install.info \
-v /root/.cache:/root/.cache \
-it $IMAGE bash
Start the docker image on your each node.
export IMAGE=m.daocloud.io/quay.io/ascend/vllm-ascend:v0.22.1rc1
docker run --rm \
--name vllm-ascend \
--shm-size=1g \
--net=host \
--device /dev/davinci0 \
--device /dev/davinci1 \
--device /dev/davinci2 \
--device /dev/davinci3 \
--device /dev/davinci4 \
--device /dev/davinci5 \
--device /dev/davinci6 \
--device /dev/davinci7 \
--device /dev/davinci_manager \
--device /dev/devmm_svm \
--device /dev/hisi_hdc \
-v /usr/local/dcmi:/usr/local/dcmi \
-v /usr/local/Ascend/driver/tools/hccn_tool:/usr/local/Ascend/driver/tools/hccn_tool \
-v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
-v /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ \
-v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info \
-v /etc/ascend_install.info:/etc/ascend_install.info \
-v /root/.cache:/root/.cache \
-it $IMAGE bash
After a successful docker run, you can verify the running container service by executing the docker ps command. The expected result is that the container vllm-ascend is listed with status Up, confirming the docker installation is successful.
4.2 Source Code Installation¶
If you don't want to use the docker image as above, you can also build all from source:
-
Clone the repository and install
vllm-ascendfrom source:完整的安装步骤请参考安装。
-
如果要部署多节点环境,需要在每个节点上设置环境。
要验证源码安装,运行以下命令并确认显示的版本与安装的版本匹配:
预期结果:显示vllm-ascend的版本信息,确认安装成功。
5 在线服务部署¶
5.1 单节点在线部署¶
单节点部署在同一节点内完成Prefill和Decode,适用于开发、测试和中规模推理场景。Qwen3.5-27B、Qwen3.5-27B-w8a8、Qwen3.6-27B和Qwen3.6-27B-w8a8模型都可以部署在1个Atlas 800 A3(64G × 16)或1个Atlas 800 A2(64G × 8)上。量化版本需要使用--quantization ascend参数启动。
Qwen3.5-27B和Qwen3.6-27B共享相同的MTP头部设计,因此qwen3_5_mtp推测解码方法可用于两者。
:::::{tab-set} :sync-group: qwen-startup
::::{tab-item} Qwen3.5-27B-w8a8 :sync: qwen35-w8a8
启动命令:
#!/bin/sh
# Load model from ModelScope to speed up download
export VLLM_USE_MODELSCOPE=True
# To reduce memory fragmentation and avoid out of memory
export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True
# Size of the shared buffer (in MB) used by HCCL for NPU-to-NPU collective communication
export HCCL_BUFFSIZE=512
# Whether OpenMP threads are bound to specific CPU cores
export OMP_PROC_BIND=false
# Number of OpenMP threads available for parallel regions
export OMP_NUM_THREADS=1
# Enables the Ascend task queue for asynchronous operator dispatch
export TASK_QUEUE_ENABLE=1
# Model weight path; can be a ModelScope model id (e.g., Eco-Tech/Qwen3.5-27B-w8a8-mtp) or a local directory path
export MODEL_PATH=Eco-Tech/Qwen3.5-27B-w8a8-mtp
vllm serve $MODEL_PATH \
--host 0.0.0.0 \
--port 8000 \
--data-parallel-size 1 \
--tensor-parallel-size 2 \
--seed 1024 \
--quantization ascend \
--served-model-name qwen3.5 \
--max-num-seqs 32 \
--max-model-len 133000 \
--max-num-batched-tokens 8096 \
--trust-remote-code \
--gpu-memory-utilization 0.90 \
--no-enable-prefix-caching \
--speculative-config '{"method": "qwen3_5_mtp", "num_speculative_tokens": 3, "enforce_eager": true}' \
--compilation-config '{"cudagraph_mode":"FULL_DECODE_ONLY"}' \
--additional-config '{"enable_cpu_binding":true}' \
--async-scheduling
::::
::::{tab-item} Qwen3.6-27B-w8a8 :sync: qwen36-w8a8
启动命令(支持最高262144上下文长度):
#!/bin/sh
# Load model from ModelScope to speed up download
export VLLM_USE_MODELSCOPE=True
# To reduce memory fragmentation and avoid out of memory
export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True
# Size of the shared buffer (in MB) used by HCCL for NPU-to-NPU collective communication
export HCCL_BUFFSIZE=512
# Whether OpenMP threads are bound to specific CPU cores
export OMP_PROC_BIND=false
# Number of OpenMP threads available for parallel regions
export OMP_NUM_THREADS=1
# Enables the Ascend task queue for asynchronous operator dispatch
export TASK_QUEUE_ENABLE=1
# Model weight path; can be a ModelScope model id (e.g., Eco-Tech/Qwen3.6-27B-w8a8) or a local directory path
export MODEL_PATH=Eco-Tech/Qwen3.6-27B-w8a8
vllm serve $MODEL_PATH \
--host 0.0.0.0 \
--port 8000 \
--data-parallel-size 1 \
--tensor-parallel-size 2 \
--seed 1024 \
--quantization ascend \
--served-model-name qwen3.6 \
--max-num-seqs 32 \
--max-model-len 262144 \
--max-num-batched-tokens 8096 \
--trust-remote-code \
--gpu-memory-utilization 0.90 \
--no-enable-prefix-caching \
--speculative-config '{"method": "qwen3_5_mtp", "num_speculative_tokens": 3, "enforce_eager": true}' \
--compilation-config '{"cudagraph_mode":"FULL_DECODE_ONLY"}' \
--additional-config '{"enable_cpu_binding":true}' \
--async-scheduling
:::: :::::
关键参数说明:
--data-parallel-size 1和--tensor-parallel-size 2是数据并行(DP)和张量并行(TP)大小的常见设置。--max-model-len表示上下文长度,即单个请求的输入加输出的最大值。Qwen3.6-27B模型支持最高262144。--max-num-seqs表示每个DP组允许处理的最大请求数。如果发送到服务的请求数超过此限制,多余的请求将保持在等待状态,不会被调度。注意,等待状态的时间也会计入TTFT和TPOT等指标。因此,在测试性能时,通常建议--max-num-seqs*--data-parallel-size>= 实际总并发数。--max-num-batched-tokens表示模型单步可处理的最大token数。目前vLLM v1调度默认启用ChunkPrefill/SplitFuse,这意味着:- (1)如果请求的输入长度大于
--max-num-batched-tokens,将根据--max-num-batched-tokens分成多轮计算; - (2)Decode请求优先调度,仅在有可用容量时才调度prefill请求。
- 通常,如果
--max-num-batched-tokens设置较大,整体延迟会更低,但对HBM内存(激活值使用)的压力会更大。
- (1)如果请求的输入长度大于
--gpu-memory-utilization表示vLLM将用于实际推理的HBM比例。其基本功能是计算可用的kv_cache大小。在预热阶段(vLLM中称为profile run),vLLM记录输入大小为--max-num-batched-tokens的推理过程中的峰值HBM内存使用量。然后可用kv_cache大小计算为:--gpu-memory-utilization* HBM大小 - 峰值HBM内存使用量。因此,--gpu-memory-utilization值越大,可使用的kv_cache越多。但由于预热阶段的内存使用可能与实际推理不同(例如由于EP负载不均),设置--gpu-memory-utilization过高可能导致实际推理中出现OOM(内存不足)问题。默认值为0.9。--no-enable-prefix-cachingindicates that prefix caching is disabled. The current implementation of hybrid kv cache for Qwen3.5-27B / Qwen3.6-27B may result in a very large effectiveblock_sizewhen prefix caching is enabled (e.g., 2048), which means any prefix shorter thanblock_sizewill never be cached. If your workload has many short repeated prefixes, consider keeping prefix caching disabled. For related issues, see the Public FAQ.--quantization ascend表示使用量化。要禁用量化,请移除该选项。--speculative-config对qwen3_5_mtp和Qwen3.5-27B均使用Qwen3.6-27B,因为它们共享相同的 MTP 头部设计。--compilation-config包含与 aclgraph 图模式相关的配置。最重要的配置是"cudagraph_mode"和"cudagraph_capture_sizes",其含义如下:"cudagraph_mode":表示具体的图模式。目前支持"PIECEWISE"和"FULL_DECODE_ONLY"。图模式主要用于降低算子调度开销。目前推荐使用"FULL_DECODE_ONLY"。"cudagraph_capture_sizes":表示不同级别的图模式。默认值为[1, 2, 4, 8, 16, 24, 32, 40,..., --max-num-seqs]。在图模式下,不同级别图的输入是固定的,级别之间的输入会自动填充到下一级别。目前推荐使用默认设置。仅在部分场景下需要单独设置以达到最佳性能。
Common Issues Tip: If you encounter issues, please refer to the Public FAQ for troubleshooting.
服务验证:
如果服务启动成功,将显示以下启动日志:
(APIServer pid=<pid>) INFO: Started server process [<pid>]
(APIServer pid=<pid>) INFO: Waiting for application startup.
(APIServer pid=<pid>) INFO: Application startup complete.
对于功能测试(例如,带有预期响应的 completions 和 chat.completions curl 示例),请参考第6节。
5.2 多节点 PD 分离部署¶
对于高并发生产场景,可以使用多节点 PD(Prefill-Decode)分离来扩展服务。推荐使用 Mooncake 进行部署:Mooncake 多节点 PD 分离指南。
在标准单节点部署模式下,Prefill(提示处理)和 Decode(令牌生成)任务运行在同一组 NPU 上。这可能导致两个问题:
- Prefill 抢占中断 Decode:Prefill 是计算密集型任务,一次性处理整个输入上下文,而 Decode 逐个生成令牌。当新用户请求到达时,其 Prefill 阶段可能抢占并中断正在进行的 Decode 任务,导致抖动和更高的每个输出令牌时间(TPOT)延迟。
- 不灵活的资源分配:Prefill 和 Decode 具有根本不同的计算特性——Prefill 是计算受限且内存带宽密集型的,而 Decode 是内存带宽受限的。在相同硬件上运行它们会迫使做出折中,无法最优地满足任何一方。
PD(Prefill-Decode)分离通过在专用节点组上运行 Prefill 和 Decode 来解决这些问题,每个节点组独立配置:
- **Prefill 节点**专注于高吞吐量提示处理,针对计算和通信进行了优化(例如,启用 FlashComm 进行 Allreduce 加速)。
- **Decode 节点**专注于低延迟令牌生成,针对内存带宽进行了优化(例如,启用异步调度和全解码 aclgraph)。
对于 Qwen3.5-27B-w8a8 和 Qwen3.6-27B-w8a8,典型的 1P1D 配置需要 2 个 Atlas 800 A3 (64G × 16) 节点(1 个 Prefill 节点 + 1 个 Decode 节点),每个节点上 TP=2 和 DP=8,这充分利用了 Atlas A3 的所有 16 个 NPU。以下示例使用 Qwen3.5-27B-w8a8;对于 Qwen3.6-27B-w8a8,将模型路径替换为 Eco-Tech/Qwen3.6-27B-w8a8,并将 --served-model-name 调整为 qwen3.6(如果需要,将 --max-model-len 调整为 262144)。
为什么是 TP=2 + DP=8(DP 优先策略)?
Qwen3.5-27B-w8a8(和Qwen3.6-27B-w8a8)模型仅约 30 GB,轻松适配单个 NPU(每个 NPU 有 64 GB HBM)。TP > 1 主要适用于无法放入单个 NPU 的模型。 对于 27B 模型,TP=2足以平衡 NPU 间的算子调度开销,而 最大化 DP 使 Atlas A3 的所有 16 个 NPU 都忙于处理独立的请求批次,充分利用硬件。这种 DP 优先的并行策略 是小型密集模型(例如 Qwen3.5-27B、Qwen3.6-27B、Llama-3-8B)的标准做法,并已通过 Qwen3.5-27B B200 基准测试 验证,其中从 TP=8 切换到 DP=8 将每节点吞吐量从 9.5k 提升到 95k tokens/s。注意:由于
Qwen3.5-27B和Qwen3.6-27B可放入单个节点,多节点 PD 分离仅推荐用于高并发生产部署。有关 Mooncake 部署的详细信息,请参考 Mooncake 多节点 PD 分离指南。
要运行 vllm-ascend Prefill-Decode 分离服务,您需要:
- 在每个节点上部署
launch_online_dp.py脚本和run_dp_template.sh脚本; -
在 prefill 主节点上部署
load_balance_proxy_server_example.py脚本以转发请求。 -
launch_online_dp.pyis used to launch external dp vllm servers. launch_online_dp.py参数说明:
参数 类型 必需 默认值 描述 --dp-sizeint 是 - 数据并行大小(所有节点上 DP rank 的总数)。 --tp-sizeint 否 1 每个 DP rank 内的张量并行大小。 --dp-size-localint 否 (与 --dp-size相同)当前节点上的 DP rank 数量。如果未设置,默认为 --dp-size。--dp-rank-startint 否 0 此节点上数据并行 rank 的起始偏移量。 --dp-addressstr 是 - 数据并行主节点(节点 0)的 IP 地址。 --dp-rpc-portstr 否 12345 数据并行主节点通信的 RPC 端口。 --vllm-start-portint 否 9000 此节点上每个 vLLM 引擎实例的起始端口。每个 DP rank 的引擎端口 = vllm_start_port+ 本地 rank 索引。 -
Prefill 节点 0 的
run_dp_template.sh脚本。您可以在仓库的示例中获取模板:run_dp_template.sh。# nic_name is the network interface name corresponding to local_ip of the current node nic_name="xxx" local_ip="141.xx.xx.1" export HCCL_IF_IP=$local_ip export GLOO_SOCKET_IFNAME=$nic_name export TP_SOCKET_IFNAME=$nic_name export HCCL_SOCKET_IFNAME=$nic_name # [Optional] jemalloc # jemalloc is for better performance, if `libjemalloc.so` is installed on your machine, you can turn it on. # export LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libjemalloc.so.2:$LD_PRELOAD export HCCL_OP_EXPANSION_MODE="AIV" export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True export OMP_PROC_BIND=false export OMP_NUM_THREADS=1 export TASK_QUEUE_ENABLE=1 export LD_LIBRARY_PATH=/usr/local/Ascend/ascend-toolkit/latest/python/site-packages/mooncake:$LD_LIBRARY_PATH export HCCL_BUFFSIZE=1024 export VLLM_ASCEND_ENABLE_FLASHCOMM1=1 export ASCEND_RT_VISIBLE_DEVICES=$1 vllm serve Eco-Tech/Qwen3.5-27B-w8a8-mtp \ --host 0.0.0.0 \ --port $2 \ --data-parallel-size $3 \ --data-parallel-rank $4 \ --data-parallel-address $5 \ --data-parallel-rpc-port $6 \ --tensor-parallel-size $7 \ --seed 1024 \ --quantization ascend \ --served-model-name qwen3.5 \ --trust-remote-code \ --max-num-seqs 4 \ --max-model-len 32768 \ --max-num-batched-tokens 16384 \ --no-enable-prefix-caching \ --gpu-memory-utilization 0.95 \ --enforce-eager \ --speculative-config '{"method": "qwen3_5_mtp", "num_speculative_tokens": 3, "enforce_eager": true}' \ --additional-config '{"enable_cpu_binding":true}' \ --kv-transfer-config \ '{"kv_connector": "MooncakeConnectorV1", "kv_role": "kv_producer", "kv_port": "30000", "engine_id": "0", "kv_connector_extra_config": { "prefill": { "dp_size": 8, "tp_size": 2 }, "decode": { "dp_size": 8, "tp_size": 2 } } }' -
Decode Node 0
run_dp_template.shscript. You can get the template in the repository's examples: run_dp_template.sh.# nic_name is the network interface name corresponding to local_ip of the current node nic_name="xxx" local_ip="141.xx.xx.2" export HCCL_IF_IP=$local_ip export GLOO_SOCKET_IFNAME=$nic_name export TP_SOCKET_IFNAME=$nic_name export HCCL_SOCKET_IFNAME=$nic_name # [Optional] jemalloc # jemalloc is for better performance, if `libjemalloc.so` is installed on your machine, you can turn it on. # export LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libjemalloc.so.2:$LD_PRELOAD export HCCL_OP_EXPANSION_MODE="AIV" export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True export OMP_PROC_BIND=false export OMP_NUM_THREADS=1 export TASK_QUEUE_ENABLE=1 export LD_LIBRARY_PATH=/usr/local/Ascend/ascend-toolkit/latest/python/site-packages/mooncake:$LD_LIBRARY_PATH export HCCL_BUFFSIZE=1024 export ASCEND_RT_VISIBLE_DEVICES=$1 vllm serve Eco-Tech/Qwen3.5-27B-w8a8-mtp \ --host 0.0.0.0 \ --port $2 \ --data-parallel-size $3 \ --data-parallel-rank $4 \ --data-parallel-address $5 \ --data-parallel-rpc-port $6 \ --tensor-parallel-size $7 \ --seed 1024 \ --quantization ascend \ --served-model-name qwen3.5 \ --trust-remote-code \ --max-num-seqs 16 \ --max-model-len 32768 \ --max-num-batched-tokens 2048 \ --no-enable-prefix-caching \ --gpu-memory-utilization 0.91 \ --compilation-config '{"cudagraph_mode":"FULL_DECODE_ONLY"}' \ --additional-config '{"recompute_scheduler_enable":true,"enable_cpu_binding":true}' \ --async-scheduling \ --speculative-config '{"method": "qwen3_5_mtp", "num_speculative_tokens": 3, "enforce_eager": true}' \ --kv-transfer-config \ '{"kv_connector": "MooncakeConnectorV1", "kv_role": "kv_consumer", "kv_port": "30200", "engine_id": "1", "kv_connector_extra_config": { "prefill": { "dp_size": 8, "tp_size": 2 }, "decode": { "dp_size": 8, "tp_size": 2 } } }'
Key Parameter Descriptions:
VLLM_ASCEND_ENABLE_FLASHCOMM1=1: enables the Allreduce communication optimization on prefill nodes, which reduces the communication overhead of long-context prefill.recompute_scheduler_enable: true: enables the recomputation scheduler. When the KV Cache of the decode node is insufficient, requests will be sent to the prefill node to recompute the KV Cache. In the PD separation scenario, enable this configuration only on decode nodes.--async-scheduling(on decode nodes): enables asynchronous scheduling, which can reduce TPOT for high-concurrency decode workloads.-
--compilation-config '{"cudagraph_模式":"FULL_DECODE_ONLY"}'(on decode nodes): enables the full-decode aclgraph mode, which significantly reduces scheduling latency on the decode side. -
Run server for each node:
# p0 (Prefill node 0) python launch_online_dp.py --dp-size 8 --tp-size 2 --dp-size-local 8 --dp-rank-start 0 --dp-address 141.xx.xx.1 --dp-rpc-port 12321 --vllm-start-port 7100 # d0 (Decode node 0) python launch_online_dp.py --dp-size 8 --tp-size 2 --dp-size-local 8 --dp-rank-start 0 --dp-address 141.xx.xx.2 --dp-rpc-port 12321 --vllm-start-port 7100 -
Run the proxy server on the prefill master node.
You can get the proxy program in the repository's examples: load_balance_proxy_server_example.py.
Note: Since each node has 8 DP ranks (with
--vllm-start-port 7100+ local rank index, occupying ports 7100-7107), you need to list all 8 ports for each node in the proxy command:python load_balance_proxy_server_example.py \ --port 1999 \ --host 141.xx.xx.1 \ --prefiller-hosts \ 141.xx.xx.1 \ 141.xx.xx.1 \ 141.xx.xx.1 \ 141.xx.xx.1 \ 141.xx.xx.1 \ 141.xx.xx.1 \ 141.xx.xx.1 \ 141.xx.xx.1 \ --prefiller-ports \ 7100 7101 7102 7103 7104 7105 7106 7107 \ --decoder-hosts \ 141.xx.xx.2 \ 141.xx.xx.2 \ 141.xx.xx.2 \ 141.xx.xx.2 \ 141.xx.xx.2 \ 141.xx.xx.2 \ 141.xx.xx.2 \ 141.xx.xx.2 \ --decoder-ports \ 7100 7101 7102 7103 7104 7105 7106 7107 \
部署验证:
PD分离服务完全启动后,通过prefill主节点的代理端口发送请求,验证Prefill和Decode节点是否协同正常工作:
curl http://<proxy_node0_ip>:1999/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3.5",
"messages": [
{"role": "user", "content": "The future of AI is"}
],
"max_tokens": 1024,
"temperature": 1.0,
"top_p": 0.95
}'
注意:对于
Qwen3.6-27B-w8a8,将上述model字段改为"qwen3.6",并将Prefill/Decode节点的--served-model-name改为qwen3.6。
预期结果:代理返回HTTP 200 OK。JSON响应包含choices字段及生成的文本,确认Prefill节点已成功处理提示词,Decode节点已生成响应。
Common Issues Tip: If you encounter issues with PD separation deployment, please refer to the Public FAQ for troubleshooting.
6 功能验证¶
服务启动后,可通过发送提示词调用模型。支持两种API接口:completions和chat.completions。使用配置的--served-model-name(qwen3.5对应Qwen3.5-27B,qwen3.6对应Qwen3.6-27B)。
Completions API:
curl http://localhost:8000/v1/completions \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3.5",
"prompt": "The future of AI is",
"max_completion_tokens": 50,
"temperature": 0
}'
注意:对于
Qwen3.6-27B,在请求体中设置"model": "qwen3.6"。
Chat Completions API:
curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3.5",
"messages": [
{"role": "user", "content": "The future of AI is"}
],
"max_completion_tokens": 1024,
"temperature": 0.7,
"top_p": 0.95
}'
注意:对于
Qwen3.6-27B,在请求体中设置"model": "qwen3.6"。
预期结果:服务返回HTTP 200 OK。JSON响应包含choices字段及生成的文本。Completions API示例输出(内容已截断):
{
"id": "cmpl-xxxxxxxxxxxxx",
"object": "text_completion",
"created": 1780971952,
"model": "qwen3.5",
"choices": [
{
"index": 0,
"text": "The future of AI is a rapidly evolving landscape with breakthroughs in natural language understanding, multimodal reasoning, and autonomous agents. As models grow more capable and efficient...",
"logprobs": null,
"finish_reason": "length"
}
],
"usage": {
"prompt_tokens": 4,
"total_tokens": 54,
"completion_tokens": 50
}
}
7 精度评估¶
以下是两种精度评估方法。
使用AISBench¶
-
详情请参考使用AISBench。
-
执行后可获取结果。以下为
Qwen3.5-27B-w8a8中vllm-ascend:v0.17.0rc1的结果,仅供参考。Qwen3.6-27B-w8a8的精度结果可通过相同方式获取,此处不再列出。
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.model_postprocessors import extract_non_reasoning_content
models = [
dict(
attr="service",
type=VLLMCustomAPIChat,
abbr="vllm-api-general-chat",
path="your_model_path",
model="qwen3.5",
request_rate=0,
retry=2,
host_ip="127.0.0.1",
host_port=8000,
max_out_len=32768,
batch_size=32,
trust_remote_code=False,
generation_kwargs=dict(
temperature=1.0,
top_p=0.95,
top_k=20,
min_p=0.0,
presence_penalty=1.5,
repetition_penalty=1.0,
ignore_eos=False,
),
pred_postprocessor=dict(type=extract_non_reasoning_content)
)
]
For
Qwen3.6-27B-w8a8, changemodeltoqwen3.6andpathto the corresponding 模式l weight path.
| 数据集 | 版本 | 指标 | 模式 | vllm-api-生成eral-chat |
|---|---|---|---|---|
| gsm8k | - | 准确率 | 生成 | 96.74 |
使用Language Model Evaluation Harness¶
以gsm8k数据集为例,在在线模式下对Qwen3.5-27B-w8a8进行精度评估。
lm_eval安装请参考使用lm_eval。- 运行
lm_eval执行精度评估。
# For Qwen3.5-27B-w8a8
export VLLM_USE_MODELSCOPE=True
vllm serve Eco-Tech/Qwen3.5-27B-w8a8-mtp \
--served-model-name qwen3.5 \
--trust-remote-code \
--quantization ascend \
--tensor-parallel-size 2 \
--max-model-len 133000 \
--max-num-seqs 32 \
--gpu-memory-utilization 0.90 \
--no-enable-prefix-caching
# Run lm_eval in another terminal
lm_eval \
--model local-completions \
--model_args model=qwen3.5,base_url=http://127.0.0.1:8000/v1/completions,tokenized_requests=False,trust_remote_code=True \
--tasks gsm8k \
--output_path ./
8 性能评估¶
使用AISBench¶
详情请参考使用AISBench进行性能评估。
使用vLLM Benchmark¶
以Qwen3.5-27B-w8a8或Qwen3.6-27B-w8a8为例进行性能评估。
更多详情请参考vllm benchmark。
vllm bench包含三个子命令:
latency:基准测试单批请求的延迟。serve:基准测试在线服务吞吐量。throughput:基准测试离线推理吞吐量。
以serve为例,运行如下代码。
export VLLM_USE_MODELSCOPE=True
# For Qwen3.5-27B-w8a8:
vllm bench serve --model Eco-Tech/Qwen3.5-27B-w8a8-mtp --dataset-name random --random-input 200 --num-prompts 200 --request-rate 1 --save-result --result-dir ./
# For Qwen3.6-27B-w8a8:
vllm bench serve --model Eco-Tech/Qwen3.6-27B-w8a8 --dataset-name random --random-input 200 --num-prompts 200 --request-rate 1 --save-result --result-dir ./
大约几分钟后,即可获取性能评估结果。
9 性能调优¶
9.1 推荐配置¶
注意:以下配置在特定测试环境中验证,仅供参考。最佳配置取决于最大输入/输出长度、前缀缓存命中率、精度要求和部署机器比例等因素。建议参考第9.2节根据实际情况进行调优。
并行策略:
Qwen3.5-27B-w8a8和Qwen3.6-27B-w8a8仅约30 GB,可轻松放入单个NPU(每NPU 64 GB HBM)。遵循**DP优先**原则,TP=2是大多数场景的推荐默认值,其余NPU应分配给DP以并行处理请求批次。TP=8仅推荐用于超长上下文(256K+)场景,此时将KV缓存分片到8个NPU上,以最大化每个rank的可用上下文窗口。对于Qwen3.6-27B-w8a8,在相同的TP/DP布局下,还可以将--max-model-len提升至262144。
表1:场景概览¶
| 场景 | 部署模式 | *总NPU数 | 权重版本 | 关键考量 |
|---|---|---|---|---|
| 高吞吐 (128K上下文) |
单节点(A2) | 8 (A2) | Qwen3.5-27B-w8a8 / Qwen3.6-27B-w8a8 | TP=2 + DP=4充分利用全部8个NPU并行处理请求批次 |
| 高吞吐 (128K上下文) |
单节点(A3) | 16 (A3) | Qwen3.5-27B-w8a8 / Qwen3.6-27B-w8a8 | TP=2 + DP=8充分利用全部16个NPU并行处理请求批次 |
| 低延迟 (128K上下文) |
单节点(A3) | 16 (A3) | Qwen3.5-27B-w8a8 / Qwen3.6-27B-w8a8 | TP=2 + DP=8减少小交互批次的逐层Allreduce开销 |
| 长上下文 (256K+上下文) |
单节点(A3) | 16 (A3) | Qwen3.5-27B-w8a8 / Qwen3.6-27B-w8a8 | TP=8 + DP=2将KV缓存分片到8个NPU上,最大化可用上下文窗口 |
*Total NPUs表示所有节点使用的NPU总数。1个Atlas 800 A3节点=16个NPU,1个Atlas 800 A2节点=8个NPU。
表2:详细节点配置¶
| 场景 | 配置 | NPU数 | TP | DP | 最大序列数 | 最大批处理Token数 | 最大模型长度 | MTP推测数 | 异步调度 |
|---|---|---|---|---|---|---|---|---|---|
| 高吞吐(128K) | 单节点(A2) | 8 | 2 | 4 | 32 | 16384 | 133000 | 3 | 开启 |
| 高吞吐(128K) | 单节点(A3) | 16 | 2 | 8 | 32 | 16384 | 133000 | 3 | 开启 |
| 低延迟(128K) | 单节点(A3) | 16 | 2 | 8 | 4 | 4096 | 133000 | 3 | 开启 |
| 长上下文(256K+) | 单节点(A3) | 16 | 8 | 2 | 8 | 8192 | 266000 | 3 | 开启 |
完整的启动命令和参数说明请参考第5章中的部署示例。
9.2 调优指南¶
9.2.1 通用调优参考¶
Please refer to the Public Performance Tuning Documentation for tuning methods. Please refer to the Feature Guide for detailed feature descriptions.
10 常见问题¶
For common environment, installation, and 生成eral parameter issues, please refer to the vLLM-Ascend Public FAQ.