Qwen3.5-27B / Qwen3.6-27B#

简介#

Qwen3.5 和 Qwen3.6-27B 是密集模型(非 MoE),共享相同的混合注意力设计(GDN + 全注意力)。在 vLLM Ascend 上的部署对两者遵循相同的模式;仅模型权重、上下文长度默认值和首次支持的版本有所不同。

Qwen3.5 在多模态学习、架构效率和全球可访问性方面代表了重大飞跃。Qwen3.6-27B 在此基础上构建,具有更强的智能体编码能力、原生多模态支持以及高达 262144 的上下文长度。

本文档涵盖支持的特性、环境设置、单节点部署以及精度/性能评估。

  • Qwen3.5-27B 首次在 vllm-ascend:v0.17.0rc1 版本中得到支持。

  • Qwen3.6-27B 首次在 vllm-ascend:v0.18.0rc1 版本中得到支持。

支持的特性#

请参考支持的特性以获取模型支持的特性矩阵。

请参考特性指南以获取特性的配置信息。

环境准备#

模型权重#

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/

验证多节点通信(可选)#

如果您想部署多节点环境,需要根据验证多节点通信环境来验证多节点通信。

安装#

例如,使用镜像 quay.io/ascend/vllm-ascend:v0.17.0rc1 / v0.18.0rc1(适用于 Atlas 800 A2)和 quay.io/ascend/vllm-ascend:v0.17.0rc1-a3 / v0.18.0rc1-a3(适用于 Atlas 800 A3)。

根据您的机器类型和模型版本选择镜像,并在您的节点上启动 Docker 镜像,请参考使用 Docker

  # Update --device according to your device (Atlas A2: /dev/davinci[0-7] Atlas A3:/dev/davinci[0-15]).
  # Update the vllm-ascend image according to your environment.
  # Note you should download the weight to /root/.cache in advance.
  # Update the vllm-ascend image
  export IMAGE=m.daocloud.io/quay.io/ascend/vllm-ascend:v0.18.0
  export NAME=vllm-ascend

  # Run the container using the defined variables
  # Note: If you are running bridge network with docker, please expose available ports for multiple nodes communication in advance.
  docker run --rm \
  --name $NAME \
  --net=host \
  --shm-size=1g \
  --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 \
  -it $IMAGE bash

您可以从源码构建所有组件。

如果您想部署多节点环境,需要在每个节点上设置环境。

部署#

单节点部署#

Qwen3.5-27BQwen3.5-27B-w8a8Qwen3.6-27BQwen3.6-27B-w8a8 都可以部署在 1 个 Atlas 800 A3 (64G × 16) 或 1 个 Atlas 800 A2 (64G × 8) 节点上。量化版本需要使用参数 --quantization ascend 启动。

Qwen3.5-27B-w8a8#

运行以下脚本来执行在线 128k 推理。

#!/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
export HCCL_BUFFSIZE=512
export OMP_PROC_BIND=false
export OMP_NUM_THREADS=1
export TASK_QUEUE_ENABLE=1

vllm serve Eco-Tech/Qwen3.5-27B-w8a8-mtp \
--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

Qwen3.6-27B-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
export HCCL_BUFFSIZE=512
export OMP_PROC_BIND=false
export OMP_NUM_THREADS=1
export TASK_QUEUE_ENABLE=1

vllm serve Eco-Tech/Qwen3.6-27B-w8a8 \
--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 表示上下文长度,即单个请求的输入加输出的最大值。

  • --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) 解码请求优先调度,只有在有可用容量时才会调度预填充请求。

    • 通常,如果将 --max-num-batched-tokens 设置为较大的值,整体延迟会更低,但 GPU 内存(激活值使用)的压力会更大。

  • --gpu-memory-utilization 表示 vLLM 将用于实际推理的 HBM 比例。其核心功能是计算可用的 kv_cache 大小。在预热阶段(在 vLLM 中称为 profile run),vLLM 会记录输入大小为 --max-num-batched-tokens 的推理过程中的峰值 GPU 内存使用量。然后,可用的 kv_cache 大小计算为:--gpu-memory-utilization * HBM 大小 - 峰值 GPU 内存使用量。因此,--gpu-memory-utilization 的值越大,可以使用的 kv_cache 就越多。然而,由于预热阶段的 GPU 内存使用量可能与实际推理期间不同(例如,由于 EP 负载不均衡),将 --gpu-memory-utilization 设置得过高可能会导致实际推理期间出现 OOM(内存不足)问题。默认值为 0.9

  • --no-enable-prefix-caching 表示前缀缓存被禁用。要启用它,对于类似 Mamba 的模型 Qwen3.5,请设置 --enable-prefix-caching--mamba-cache-mode align。请注意,当前混合 kv cache 的实现可能在调度时导致非常大的 block_size。例如,block_size 可能被调整为 2048,这意味着任何短于 2048 的前缀将永远不会被缓存。

  • --quantization "ascend" indicates that quantization is used. To disable quantization, remove this option.

  • --speculative_config 对 Qwen3.5 和 Qwen3.6 均使用 qwen3_5_mtp,因为它们共享相同的 MTP 头设计。

  • --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: "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.

  • "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.

Functional Verification#

一旦您的服务器启动,您就可以使用输入提示词查询模型。请使用您配置的 --served-model-nameqwen3.5qwen3.6):

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
    }'

Accuracy Evaluation#

Here are two accuracy evaluation methods.

Using AISBench#

  1. Refer to Using AISBench for details.

  2. 执行后,您可以获得结果。以下是 Qwen3.5-27B-w8a8vllm-ascend:v0.17.0rc1 中的结果,仅供参考。

dataset

version

metric

mode

vllm-api-general-chat

gsm8k

-

accuracy

gen

96.74

Performance#

Using AISBench#

Refer to Using AISBench for performance evaluation for details.

Using vLLM Benchmark#

以运行 Qwen3.5-27B-w8a8Qwen3.6-27B-w8a8 的性能评估为例。

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 the serve as an example. Run the code as follows.

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 ./

After about several minutes, you can get the performance evaluation result.