跳转至

GLM-5.3(实验版)

1 简介

GLM-5.3 使用与 GLM-5.2 相同的基础模型——所有提升均来自后训练。与 GLM-5.2 相比,它在复杂编码和长时程任务方面表现更好。

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

Warning

当前状态与限制

  • GLM-5.3 仅在官方 Docker 镜像 quay.io/ascend/vllm-ascend:v0.23.0-a3 和 quay.io/ascend/vllm-ascend:v0.23.0 上,且仅在多节点共置场景中进行了测试。
  • 支持的功能 中列出的功能仅是本文档中已验证部署命令所启用的功能,并不意味着 GLM-5.3 支持所有功能。这是一个早期访问版本;性能优化和可靠性验证仍在进行中(参见 声明)。
  • 以下所有脚本均基于 v0.23.0,因此某些参数在主代码中不受支持。如果您使用的是 vllm-Ascend 的主分支,请务必确认。

2 支持的功能

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

请参考 功能指南 获取功能配置。

3 前提条件

3.1 模型权重

权重版本 硬件要求 下载链接
GLM-5.3-w8a8c8 2 个 Atlas 800 A3(128GB × 8)节点或 4 个 Atlas 800 A2(64GB × 32) ModelScope
  • 您可以使用 msmodelslim 直接对模型进行量化。

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

路径说明:将模型权重下载到您选择的目录并记录该路径。确保后续部署命令中的模型路径与该目录一致。

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

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

4 安装

4.1 Docker 镜像安装

  • 您可以使用我们的官方 Docker 镜像直接运行 GLM-5.3。

在每个节点上启动 Docker 镜像。

export IMAGE=quay.io/ascend/vllm-ascend:v0.23.0-a3
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/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

在您的每个节点上启动 Docker 镜像。

export IMAGE=quay.io/ascend/vllm-ascend:v0.23.0
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

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

4.2 源代码安装

如果您不想使用上述 Docker 镜像,也可以从源代码构建所有内容:

  • 从源代码安装 vllm-ascend,请参考 安装。

5 在线服务部署

本版本已验证的部署场景按上下文窗口大小(低于 1M)、硬件(Atlas 800 A3 / A2)和部署模式(多节点共置)进行组织。以下所有启动脚本均为已验证的参考命令;每个场景后会对关键参数进行说明。

Note

请勿为 GLM-5.3 设置 enable_thinking: false / thinking: false,否则输出质量可能会下降。

Warning

  • 以下脚本已在 v0.23.0 上测试,部分参数可能在 main 分支中有所变更。

5.1 多节点部署

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

常见问题提示:如果您遇到问题,请参阅 公共常见问题解答。

5.1.1 上下文低于 1M

  • GLM-5.3-w8a8c8:可部署在 2 台 Atlas 800 A3(64GB × 16)上。

分别在两个节点上运行以下脚本。

节点 0

# this obtained through ifconfig
# nic_name is the network interface name corresponding to local_ip of the current node
nic_name="xxx"
local_ip="xxx"

# The value of node0_ip must be consistent with the value of local_ip set in node0 (master node)
node0_ip="xxxx"

export HCCL_OP_EXPANSION_MODE="AIV"
export HCCL_IF_IP=$local_ip
export GLOO_SOCKET_IFNAME=$nic_name
export TP_SOCKET_IFNAME=$nic_name
export HCCL_SOCKET_IFNAME=$nic_name
export HCCL_TRANSFER_TIMEOUT=600
export HCCL_EXEC_TIMEOUT=3600
export HCCL_CONNECT_TIMEOUT=3600
export OMP_PROC_BIND=false
export OMP_NUM_THREADS=1
export HCCL_BUFFSIZE=400
export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True
export VLLM_ASCEND_ENABLE_MLAPO=1

# Ensure the model path matches the directory recorded during download
vllm serve /root/.cache/modelscope/hub/models/vllm-ascend/GLM-5.3-w8a8c8 \
    --host 0.0.0.0 \
    --port 8077 \
    --safetensors-load-strategy prefetch \
    --api-server-count 1 \
    --data-parallel-size 8 \
    --data-parallel-start-rank 0 \
    --data-parallel-size-local 4 \
    --data-parallel-address $node0_ip \
    --data-parallel-rpc-port 12980 \
    --tensor-parallel-size 4 \
    --enable-expert-parallel \
    --seed 1024 \
    --served-model-name glm-5 \
    --tool-call-parser glm47 \
    --reasoning-parser glm45 \
    --enable-auto-tool-choice \
    --max-num-seqs 6 \
    --max-model-len 202752 \
    --max-num-batched-tokens 4096 \
    --trust-remote-code \
    --gpu-memory-utilization 0.90 \
    --quantization ascend \
    --compilation-config '{"cudagraph_mode": "FULL_DECODE_ONLY"}' \
    --kv-cache-dtype int8 \
    --attention_config.indexer_kv_dtype int8 \
    --additional-config '{"enable_dsa_cp": true, "enable_balance_scheduling": true, "enable_fused_mc2": 1, "enable_flashcomm1": true}'  \
    --speculative-config '{"num_speculative_tokens": 3, "method": "deepseek_mtp", "enforce_eager": true}'

节点 1

# this obtained through ifconfig
# nic_name is the network interface name corresponding to local_ip of the current node
nic_name="xxx"
local_ip="xxx"

# The value of node0_ip must be consistent with the value of local_ip set in node0 (master node)
node0_ip="xxxx"

export HCCL_OP_EXPANSION_MODE="AIV"
export HCCL_IF_IP=$local_ip
export GLOO_SOCKET_IFNAME=$nic_name
export TP_SOCKET_IFNAME=$nic_name
export HCCL_SOCKET_IFNAME=$nic_name
export HCCL_TRANSFER_TIMEOUT=600
export HCCL_EXEC_TIMEOUT=3600
export HCCL_CONNECT_TIMEOUT=3600
export OMP_PROC_BIND=false
export OMP_NUM_THREADS=1
export HCCL_BUFFSIZE=400
export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True
export VLLM_ASCEND_ENABLE_MLAPO=1

# Ensure the model path matches the directory recorded during download
vllm serve /root/.cache/modelscope/hub/models/vllm-ascend/GLM-5.3-w8a8c8 \
    --host 0.0.0.0 \
    --port 8077 \
    --headless \
    --data-parallel-size 8 \
    --data-parallel-start-rank 4 \
    --data-parallel-size-local 4 \
    --data-parallel-address $node0_ip \
    --data-parallel-rpc-port 12980 \
    --tensor-parallel-size 4 \
    --enable-expert-parallel \
    --seed 1024 \
    --served-model-name glm-5 \
    --tool-call-parser glm47 \
    --reasoning-parser glm45 \
    --enable-auto-tool-choice \
    --max-num-seqs 6 \
    --max-model-len 202752 \
    --max-num-batched-tokens 4096 \
    --trust-remote-code \
    --gpu-memory-utilization 0.92 \
    --quantization ascend \
    --enable-chunked-prefill \
    --enable-prefix-caching \
    --async-scheduling \
    --compilation-config '{"cudagraph_mode": "FULL_DECODE_ONLY"}' \
    --kv-cache-dtype int8 \
    --attention_config.indexer_kv_dtype int8 \
    --additional-config '{"enable_dsa_cp": true, "enable_balance_scheduling": true, "enable_fused_mc2": 1, "enable_flashcomm1": true}' \
    --speculative-config '{"num_speculative_tokens": 3, "method": "deepseek_mtp", "enforce_eager": true}'
  • GLM-5.3-w8a8c8:可部署在 4 台 Atlas 800 A2(64GB × 32)上。

分别在四个节点上运行以下脚本。

节点 0

# this obtained through ifconfig
# nic_name is the network interface name corresponding to local_ip of the current node
nic_name="xxx"
local_ip="xxx"

# The value of node0_ip must be consistent with the value of local_ip set in node0 (master node)
node0_ip="xxx"

export HCCL_OP_EXPANSION_MODE="AIV"
export HCCL_IF_IP=$local_ip
export GLOO_SOCKET_IFNAME=$nic_name
export TP_SOCKET_IFNAME=$nic_name
export HCCL_SOCKET_IFNAME=$nic_name
export VLLM_RPC_TIMEOUT=360000
export VLLM_EXECUTE_MODEL_TIMEOUT_SECONDS=30000
export HCCL_EXEC_TIMEOUT=200
export HCCL_CONNECT_TIMEOUT=120
export OMP_PROC_BIND=false
export OMP_NUM_THREADS=10
export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True
export ACL_OP_INIT_MODE=1
export CPU_AFFINITY_CONF=1
export VLLM_ASCEND_ENABLE_MLAPO=1
export VLLM_ENGINE_READY_TIMEOUT_S=1200

# Ensure the model path matches the directory recorded during download
vllm serve /root/.cache/modelscope/hub/models/vllm-ascend/GLM-5.3-w8a8c8 \
    --host 0.0.0.0 \
    --port 8077 \
    --max-model-len 135000 \
    --data-parallel-size 4 \
    --data-parallel-size-local 1 \
    --data-parallel-start-rank 0 \
    --data-parallel-address "${node0_ip}" \
    --data-parallel-rpc-port 12980 \
    --tensor-parallel-size 8 \
    --enable-expert-parallel \
    --seed 1024 \
    --served-model-name glm-5 \
    --safetensors-load-strategy prefetch \
    --max-num-seqs 128 \
    --max-num-batched-tokens 8192 \
    --trust-remote-code \
    --quantization ascend \
    --gpu-memory-utilization 0.92 \
    --speculative-config '{"num_speculative_tokens": 3, "method": "deepseek_mtp", "enforce_eager": true}' \
    --compilation-config '{"cudagraph_mode": "FULL_DECODE_ONLY"}' \
    --kv-cache-dtype int8 \
    --attention_config.indexer_kv_dtype int8 \
    --additional-config '{"enable_dsa_cp": true, "enable_balance_scheduling": true, "fuse_muls_add": true, "multistream_overlap_shared_expert": true, "enable_flashcomm1": true}' \
    --enable-prefix-caching \
    --async-scheduling \
    --api-server-count 1

节点 1-3

```shell
# this obtained through ifconfig
# nic_name is the network interface name corresponding to local_ip of the current node
nic_name="xxx"
local_ip="xxx"

# The value of node0_ip must be consistent with the value of local_ip set in node0 (master node)
node0_ip="xxx"

# node1: dp_start_rank=1, node2: dp_start_rank=2, node3: dp_start_rank=3
dp_start_rank=1

export HCCL_OP_EXPANSION_MODE="AIV"
export HCCL_IF_IP=$local_ip
export GLOO_SOCKET_IFNAME=$nic_name
export TP_SOCKET_IFNAME=$nic_name
export HCCL_SOCKET_IFNAME=$nic_name
export VLLM_RPC_TIMEOUT=360000
export VLLM_EXECUTE_MODEL_TIMEOUT_SECONDS=30000
export HCCL_EXEC_TIMEOUT=200
export HCCL_CONNECT_TIMEOUT=120
export OMP_PROC_BIND=false
export OMP_NUM_THREADS=10
export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True
export ACL_OP_INIT_MODE=1
export CPU_AFFINITY_CONF=1
export VLLM_ASCEND_ENABLE_MLAPO=1
export VLLM_ENGINE_READY_TIMEOUT_S=1200

# Ensure the model path matches the directory recorded during download
vllm serve /root/.cache/modelscope/hub/models/vllm-ascend/GLM-5.3-w8a8c8 \
    --host 0.0.0.0 \
    --port 8077 \
    --headless \
    --max-model-len 135000 \
    --data-parallel-size 4 \
    --data-parallel-size-local 1 \
    --data-parallel-start-rank ${dp_start_rank} \
    --data-parallel-address "${node0_ip}" \
    --data-parallel-rpc-port 12980 \
    --tensor-parallel-size 8 \
    --enable-expert-parallel \
    --seed 1024 \
    --served-model-name glm-5 \
    --safetensors-load-strategy prefetch \
    --max-num-seqs 128 \
    --max-num-batched-tokens 8192 \
    --trust-remote-code \
    --quantization ascend \
    --gpu-memory-utilization 0.92 \
    --speculative-config '{"num_speculative_tokens": 3, "method": "deepseek_mtp", "enforce_eager": true}' \
    --compilation-config '{"cudagraph_mode": "FULL_DECODE_ONLY"}' \
    --kv-cache-dtype int8 \
    --attention_config.indexer_kv_dtype int8 \
    --additional-config '{"enable_dsa_cp": true, "enable_balance_scheduling": true,"fuse_muls_add": true, "multistream_overlap_shared_expert": true, "enable_flashcomm1": true}' \
    --enable-prefix-caching \
    --async-scheduling
```

关键参数说明:

以下仅描述本模型/场景特有的关键参数。max-model-len 和 max-num-seqs 需要根据实际使用场景进行设置。

多节点网络与数据并行配置:

  • HCCL_IF_IP、GLOO_SOCKET_IFNAME、TP_SOCKET_IFNAME、HCCL_SOCKET_IFNAME:多节点通信的网络接口配置。将 nic_name 设置为网络接口名称(通过 ifconfig 获取),将 local_ip 设置为当前节点的 IP 地址。必须在每个节点上正确配置这些参数,才能实现多节点通信。
  • --data-parallel-size 8:所有节点上数据并行 rank 的总数(本场景中每个节点 4 个 rank)。
  • --data-parallel-size-local 4:当前节点上的数据并行 rank 数量。
  • --data-parallel-start-rank:本节点上数据并行 rank 的起始偏移量。节点 0 使用 0,节点 1 使用 4。
  • --data-parallel-address:数据并行主节点(节点 0)的 IP 地址。必须与主节点的 local_ip 一致。
  • --data-parallel-rpc-port 12980:数据并行主节点通信的 RPC 端口。所有节点必须相同。
  • --headless:表示非主节点(用于节点 1-3)。不要在节点 0 上使用。

A2 专用环境变量:

  • CPU_AFFINITY_CONF=1:为工作进程启用 CPU 核心亲和性绑定。
  • ACL_OP_INIT_MODE=1:ACL 算子初始化模式,用于加速算子编译。
  • VLLM_RPC_TIMEOUT=360000 / VLLM_EXECUTE_MODEL_TIMEOUT_SECONDS=3000 / HCCL_EXEC_TIMEOUT=200 / HCCL_CONNECT_TIMEOUT=120 / VLLM_ENGINE_READY_TIMEOUT_S=1200:针对较慢的 A2 平台,多节点启动和模型执行的超时设置。如果引擎未能及时就绪,请增大这些值。

注意: 本场景启用了 additional_config.enable_fused_mc2=1(融合 dispatch_ffn_combine/mega_moe 算子)。Fused MC2 与 multistream_overlap_shared_expert 冲突——不能同时启用这两个优化(当启用 Fused MC2 时,运行时会强制禁用 multistream_overlap_shared_expert)。

5.1.2 1M 上下文部署

1M 上下文场景尚未针对 GLM-5.3 进行测试。如需部署,请参考 GLM-5.2 1M 上下文部署 中的脚本。

5.2 预填充-解码分离

预填充-解码分离场景尚未针对 GLM-5.3 进行测试。如需部署预填充-解码分离,可参考 GLM-5.2 预填充-解码分离 中的脚本。

6 功能验证

服务器启动后,你可以使用输入 Prompt 查询模型:

curl http://<node0_ip>:<port>/v1/chat/completions \
    -H "Content-Type: application/json" \
    -d '{
        "model": "glm-5",
        "messages":[
            {
                "role": "user",
                "content": "Who are you?"
            }
        ],
        "temperature": 0
    }'

预期结果应包含以下内容:

"message":{"role":"assistant","content":"I'm GLM, a large language model developed by Z.ai. I'm designed to understand and generate human-like text based on the conversations we have together. My role involves processing diverse text data to help answer questions and provide assistance across many topics.\n\nI don't store your personal data, and I'm continually learning to improve my capabilities. Is there something specific I can help you with today?","refusal":null,"annotations":null,"audio":null,"function_call":oning":"Let me analyze this question about my identity. First, I should acknowledge that this is a fundamental question about who and what I am. The key aspects are my identity as GLM, a large language model by Z.ai, and my core capabilities. I should explain my primary function of text processing and be transparent about my nature as an AI system. It's also important to clarify my role in helping users and my ability to engage with various topics. Mention my text processing abilities and learning from diverse datasets, but avoid making claims about consciousness or emotions. The response should be structured logically, starting with my basic identity and moving on to my capabilities and purpose. I'll organize this information in a clear, straightforward manner that addresses the user's query directly."}

7 精度评估

以下是两种精度评估方法。

7.1 使用 AISBench

  1. 有关详细信息,请参阅 使用 AISBench。

  2. 执行后,您可以获取结果。以下是 GLM-5.3-w8a8c8 在 vllm-ascend:v0.23.0 中的结果,仅供参考。

数据集 模型 硬件 指标 模式 vllm-api-general-chat
GPQA Diamond GLM-5.3-w8a8c8 A3 accuracy gen 92.42
GPQA Diamond GLM-5.3-w8a8c8 A2 accuracy gen 90.40

7.2 使用 Language Model Evaluation Harness

尚未测试。

8 性能评估

8.1 使用 AISBench

有关详细信息,请参阅 使用 AISBench 进行性能评估。

8.2 使用 vLLM Benchmark

有关更多详细信息,请参阅 vllm benchmark。

9 常见问题

  • 问:如何为 GLM-5.3 启用函数调用?

答:请在 vLLM 启动命令中添加以下配置

--tool-call-parser glm47 \
--reasoning-parser glm45 \
--enable-auto-tool-choice \
  • 问:GLM-5.3 是否支持 enable_thinking: false?

答:不支持,GLM-5.3 不支持 enable_thinking。

10 声明

  • 当前版本仅用于早期体验,性能优化仍在进行中。
  • 服务可靠性尚未完全验证,不建议直接用于生产环境。

本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 vl/vllm-ascend