Qwen3-Coder-30B-A3B#

简介#

最新发布的 Qwen3-Coder-30B-A3B 采用了稀疏混合专家(Sparse MoE)架构,以实现高效的训练与推理。该模型在智能体编程(agentic coding)、高达 1M token 的长上下文支持以及多功能函数调用(function calling)方面进行了重大优化。

本文档将展示该模型的主要验证步骤,包括支持的功能、功能配置、环境准备、单节点部署、精度和性能评估。

支持的功能#

请参考 支持功能列表 以获取该模型支持的功能矩阵。

请参考 功能指南 以获取功能的配置方式。

环境准备#

模型权重#

Qwen3-Coder-30B-A3B-Instruct(BF16 版本):需要 1 个 Atlas 800 A3 节点(配备 16x 64G NPU)或 1 个 Atlas 800 A2 节点(配备 8x 64G/32G NPU)。下载模型权重

建议将模型权重下载到多节点的共享目录中,例如 /root/.cache/

安装#

Qwen3-Coder 最早在 vllm-ascend:v0.10.0rc1 版本中得到支持,请使用该版本或更高版本运行此模型。

您可以直接使用我们的官方 Docker 镜像来运行 Qwen3-Coder-30B-A3B-Instruct

# Update the vllm-ascend image
export IMAGE=quay.io/ascend/vllm-ascend:v0.11.0rc1
docker run --rm \
--name vllm-ascend \
--shm-size=1g \
--device /dev/davinci0 \
--device /dev/davinci1 \
--device /dev/davinci2 \
--device /dev/davinci3 \
--device /dev/davinci_manager \
--device /dev/devmm_svm \
--device /dev/hisi_hdc \
-v /usr/local/dcmi:/usr/local/dcmi \
-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 \
-p 8000:8000 \
-it $IMAGE bash

此外,如果您不想使用上述 Docker 镜像,也可以从源码构建:

部署#

单节点部署#

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

对于配备 64 GB 显存的 Atlas A2,张量并行大小(tensor-parallel-size)应至少为 2;对于 32 GB 显存,该值应至少为 4。

#!/bin/sh
export VLLM_USE_MODELSCOPE=true

vllm serve Qwen/Qwen3-Coder-30B-A3B-Instruct --served-model-name qwen3-coder --tensor-parallel-size 4 --enable_expert_parallel

功能验证#

服务器启动后,您可以使用输入提示词查询模型:

curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d '{
  "model": "qwen3-coder",
  "messages": [
    {"role": "user", "content": "Give me a short introduction to large language models."}
  ],
  "temperature": 0.6,
  "top_p": 0.95,
  "top_k": 20,
  "max_tokens": 4096
}'

精度评估#

使用 AISBench#

  1. 详见 使用 AISBench

  2. 执行后可获取结果,以下为 vllm-ascend:0.11.0rc0Qwen3-Coder-30B-A3B-Instruct 的测试结果,仅供参考。

数据集

版本

指标

模式

vllm-api-general-chat

openai_humaneval

f4a973

humaneval_pass@1

生成

94.51

性能指标#

使用 AISBench#

详见 使用 AISBench 进行性能评估