Kimi-K2.5#
1 引言#
Kimi K2.5 是一个开源的原生多模态智能体模型,通过在 Kimi-K2-Base 上持续预训练约 15 万亿混合视觉和文本 token 构建而成。它无缝集成了视觉与语言理解能力,具备高级智能体能力、即时与思考模式,以及对话与智能体范式。
本文档将展示该模型的主要验证步骤,包括支持的特性、特性配置、环境准备、单节点与多节点部署、精度与性能评估。
本文档基于 vLLM-Ascend v0.17.0rc1 验证并编写。当前模型(Kimi-K2.5)在此版本中首次获得支持,v0.17.0rc1 及更高版本 可稳定运行。
2 支持的特性#
请参考支持的特性获取模型支持的特性矩阵。
请参考特性指南获取特性的配置。
3 前提条件#
3.1 模型权重#
Kimi-K2.5-w4a8(w4a8量化版本):需要1个Atlas 800 A3(64G × 16)节点或2个Atlas 800 A2(64G × 8)节点。下载模型权重。kimi-k2.5-eagle3(用于加速 Kimi-K2.5 推理的 Eagle3 MTP 草稿模型):下载模型权重
建议将模型权重下载到多节点的共享目录中,例如 /root/.cache/。
3.2 验证多节点通信(可选)#
如果要部署多节点环境,需要按照验证多节点通信环境验证多节点通信。
4 安装#
4.1 Docker 镜像安装#
根据机器类型选择镜像,并在节点上启动 docker 镜像,请参考使用 docker。
在每个节点上启动docker镜像。
export IMAGE=quay.io/ascend/vllm-ascend:v0.23.0-a3
docker run --rm \
--name vllm-ascend \
--shm-size=1g \
--net=host \
--privileged=true \
--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 \
--privileged=true \
--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
docker 运行成功后,可以通过执行 docker ps 命令验证正在运行的容器服务。
4.2 源码安装#
如果不想使用上述 docker 镜像,也可以从源码构建所有内容:
从源码安装
vllm-ascend,请参考安装。
如果要部署多节点环境,需要在每个节点上设置环境。
5 在线服务部署#
5.1 单节点在线部署#
单节点部署在同一节点内完成 Prefill 和 Decode。量化模型 Kimi-K2.5-w4a8 可部署在 1 个 Atlas 800 A3(64G × 16)上。
运行以下脚本执行在线推理。
启动命令:
#!/bin/sh
# [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
echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
sysctl -w vm.swappiness=0
sysctl -w kernel.numa_balancing=0
sysctl -w kernel.sched_migration_cost_ns=50000
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 HCCL_BUFFSIZE=800
export VLLM_ASCEND_ENABLE_MLAPO=1
export VLLM_ASCEND_ENABLE_FLASHCOMM1=1
export VLLM_ASCEND_BALANCE_SCHEDULING=1
vllm serve Eco-Tech/Kimi-K2.5-w4a8 \
--host 0.0.0.0 \
--port 8088 \
--quantization ascend \
--served-model-name kimi_k25 \
--allowed-local-media-path / \
--trust-remote-code \
--no-enable-prefix-caching \
--seed 1024 \
--tensor-parallel-size 4 \
--data-parallel-size 4 \
--enable-expert-parallel \
--max-num-seqs 64 \
--max-model-len 32768 \
--max-num-batched-tokens 16384 \
--gpu-memory-utilization 0.9 \
--compilation-config '{"cudagraph_mode":"FULL_DECODE_ONLY"}' \
--speculative-config '{"method":"eagle3", "model":"lightseekorg/kimi-k2.5-eagle3", "num_speculative_tokens":3}' \
--mm-encoder-tp-mode data
关键参数说明:
设置环境变量
VLLM_ASCEND_BALANCE_SCHEDULING=1可启用均衡调度。这有助于在 v1 调度器中提高输出吞吐量并降低 TPOT。但在某些场景下,TTFT 可能会下降。此外,在 PD 分离的场景下不建议启用此功能。对于单节点部署,建议使用
dp4 tp4而不是dp2 tp8。--max-model-len指定最大上下文长度,即单个请求的输入和输出 token 之和。对于输入长度 3.5K、输出长度 1.5K 的性能测试,16384的值已足够,但对于精度测试,请至少设置为35000。--no-enable-prefix-caching表示禁用前缀缓存。要启用它,请移除该选项。--mm-encoder-tp-mode指示如何使用张量并行(TP)优化多模态编码器推理。如果要测试多模态输入,建议使用data。如果使用 w4a8 权重,更多内存将分配给 kvcache,可以尝试增加系统吞吐量以获得更大的吞吐量。
常见问题提示:如果遇到问题,请参考公共 FAQ 进行故障排除。
服务验证:
curl http://<node_ip>:8088/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "kimi_k25",
"messages": [{
"role": "user",
"content": [
{
"type": "text",
"text": "The future of AI is"
}]
}],
"max_tokens": 1024,
"temperature": 1.0,
"top_p": 0.95
}'
预期结果:
服务返回 HTTP 200 OK,并包含 choices 字段的 JSON 响应。示例输出:
{
"id": "chatcmpl-xxxxxxxxxxxxx",
"object": "chat.completion",
"model": "kimi_k25",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The future of AI is not a destination we are passively approaching...",
"finish_reason": "length"
}
}
],
"usage": {
"prompt_tokens": 13,
"total_tokens": 1037,
"completion_tokens": 1024
}
}
5.2 多节点数据并行部署#
Kimi-K2.5-w4a8 可以使用数据并行跨多个节点部署。此部署模式至少需要 2 个 Atlas 800 A2(64G × 8)节点。
分别在两个节点上运行以下脚本。
启动命令:
#!/bin/sh
# this obtained through ifconfig
# nic_name is the network interface name corresponding to local_ip of the current node
nic_name="xxxx"
local_ip="141.xx.xx.1"
# The value of node0_ip must be consistent with the value of local_ip set in node0 (master node)
node0_ip="xxxx"
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_INTRA_PCIE_ENABLE=1
export HCCL_INTRA_ROCE_ENABLE=0
# [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
echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
sysctl -w vm.swappiness=0
sysctl -w kernel.numa_balancing=0
sysctl -w kernel.sched_migration_cost_ns=50000
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 HCCL_BUFFSIZE=1024
export VLLM_ASCEND_ENABLE_MLAPO=1
export VLLM_ASCEND_ENABLE_FLASHCOMM1=1
export VLLM_ASCEND_BALANCE_SCHEDULING=1
vllm serve Eco-Tech/Kimi-K2.5-w4a8 \
--host 0.0.0.0 \
--port 8088 \
--quantization ascend \
--served-model-name kimi_k25 \
--allowed-local-media-path / \
--trust-remote-code \
--no-enable-prefix-caching \
--seed 1024 \
--data-parallel-size 4 \
--data-parallel-size-local 2 \
--data-parallel-address $node0_ip \
--data-parallel-rpc-port 13389 \
--tensor-parallel-size 4 \
--enable-expert-parallel \
--max-num-seqs 16 \
--max-model-len 32768 \
--max-num-batched-tokens 16384 \
--gpu-memory-utilization 0.9 \
--compilation-config '{"cudagraph_mode":"FULL_DECODE_ONLY"}' \
--speculative-config '{"method":"eagle3", "model":"lightseekorg/kimi-k2.5-eagle3", "num_speculative_tokens":3}' \
--mm-encoder-tp-mode data
启动命令:
#!/bin/sh
# this obtained through ifconfig
# nic_name is the network interface name corresponding to local_ip of the current node
nic_name="xxx"
local_ip="141.xx.xx.2"
# The value of node0_ip must be consistent with the value of local_ip set in node0 (master node)
node0_ip="xxxx"
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_INTRA_PCIE_ENABLE=1
export HCCL_INTRA_ROCE_ENABLE=0
# [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
echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
sysctl -w vm.swappiness=0
sysctl -w kernel.numa_balancing=0
sysctl -w kernel.sched_migration_cost_ns=50000
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 HCCL_BUFFSIZE=1024
export VLLM_ASCEND_ENABLE_MLAPO=1
export VLLM_ASCEND_ENABLE_FLASHCOMM1=1
export VLLM_ASCEND_BALANCE_SCHEDULING=1
vllm serve Eco-Tech/Kimi-K2.5-w4a8 \
--host 0.0.0.0 \
--port 8088 \
--quantization ascend \
--served-model-name kimi_k25 \
--allowed-local-media-path / \
--trust-remote-code \
--no-enable-prefix-caching \
--seed 1024 \
--headless \
--data-parallel-size 4 \
--data-parallel-size-local 2 \
--data-parallel-start-rank 2 \
--data-parallel-address $node0_ip \
--data-parallel-rpc-port 13389 \
--tensor-parallel-size 4 \
--enable-expert-parallel \
--max-num-seqs 16 \
--max-model-len 32768 \
--max-num-batched-tokens 16384 \
--gpu-memory-utilization 0.9 \
--compilation-config '{"cudagraph_mode":"FULL_DECODE_ONLY"}' \
--speculative-config '{"method":"eagle3", "model":"lightseekorg/kimi-k2.5-eagle3", "num_speculative_tokens":3}' \
--mm-encoder-tp-mode data
关键参数说明:
--data-parallel-size:所有节点上的数据并行 rank 总数。在此示例中,4表示模型总共分布在 4 个 DP rank 上(每个节点 2 个)。--data-parallel-size-local:当前节点上运行的数据并行 rank 数量。在此示例中,每个节点运行 2 个 DP rank。--data-parallel-start-rank:当前节点上数据并行等级的起始偏移量。节点0从等级0开始(默认),节点1从等级2开始。这确保了每个节点的DP等级在全局等级空间中占据不同的位置。--data-parallel-address:数据并行主节点(节点0)的IP地址。该值必须与节点0上设置的local_ip一致。--data-parallel-rpc-port:数据并行主节点通信的RPC端口。所有节点上的该值必须相同。--headless:表示此vLLM实例不是主服务节点。仅在非主节点(节点1)上设置。主节点(节点0)不应设置此标志。对于单节点部署,建议使用
dp4 tp4而不是dp2 tp8。
常见问题提示:如果遇到问题,请参考公共 FAQ 进行故障排除。
服务验证:
curl http://<node0_ip>:8088/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "kimi_k25",
"messages": [{
"role": "user",
"content": [
{
"type": "text",
"text": "The future of AI is"
}]
}],
"max_tokens": 1024,
"temperature": 1.0,
"top_p": 0.95
}'
预期结果:
服务返回HTTP 200 OK。JSON响应中包含带有生成文本的choices字段。
5.3 多节点PD分离部署#
我们推荐使用Mooncake进行部署:Mooncake。
在标准单节点部署模式下,Prefill(提示处理)和Decode(令牌生成)任务在同一组NPU上运行。PD(Prefill-Decode)分离通过将Prefill和Decode运行在专用的节点组上来解决此问题,每个节点组独立配置:
Prefill节点专注于高吞吐量的提示处理,针对计算和通信进行了优化(例如,启用FlashComm以加速Allreduce)。
Decode节点专注于低延迟的令牌生成,针对内存带宽进行了优化(例如,启用MLAPO融合算子)。
此架构推荐用于具有并发多用户工作负载的生产部署,这些场景同时要求稳定的延迟和高吞吐量。
以Atlas 800 A3(64G × 16)为例,我们推荐部署2P1D(4节点)而非1P1D(2节点),因为在1P1D情况下没有足够的NPU内存来服务高并发。
Kimi-K2.5-w4a8 2P1D:需要4个Atlas 800 A3(64G × 16)节点。
要运行vllm-ascend的Prefill-Decode分离服务,您需要在每个节点上部署launch_online_dp.py脚本和run_dp_template.sh脚本,并在prefill主节点上部署proxy.sh脚本来转发请求。
参数说明:
参数 |
类型 |
必填 |
默认值 |
描述 |
|---|---|---|---|---|
|
int |
是 |
- |
数据并行大小(所有节点上的DP等级总数)。 |
|
int |
否 |
1 |
每个DP等级内的张量并行大小。 |
|
int |
否 |
(与 |
当前节点上的DP等级数量。如果未设置,则默认为 |
|
int |
否 |
0 |
当前节点上数据并行等级的起始偏移量。 |
|
str |
是 |
- |
数据并行主节点(节点0)的IP地址。 |
|
str |
否 |
12345 |
数据并行主节点通信的RPC端口。 |
|
int |
否 |
9000 |
当前节点上每个vLLM引擎实例的起始端口。每个DP等级的引擎端口 = |
run_dp_template.sh脚本# this obtained through ifconfig # nic_name is the network interface name corresponding to local_ip of the current node nic_name="xxx" local_ip="141.xx.xx.1" # The value of node0_ip must be consistent with the value of local_ip set in node0 (master node) node0_ip="xxxx" 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 echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor sysctl -w vm.swappiness=0 sysctl -w kernel.numa_balancing=0 sysctl kernel.sched_migration_cost_ns=50000 export VLLM_RPC_TIMEOUT=3600000 export VLLM_EXECUTE_MODEL_TIMEOUT_SECONDS=30000 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=256 export VLLM_ASCEND_ENABLE_FLASHCOMM1=1 export ASCEND_RT_VISIBLE_DEVICES=$1 vllm serve Eco-Tech/Kimi-K2.5-w4a8 \ --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 \ --enable-expert-parallel \ --seed 1024 \ --quantization ascend \ --served-model-name kimi_k25 \ --trust-remote-code \ --max-num-seqs 8 \ --max-model-len 32768 \ --max-num-batched-tokens 16384 \ --no-enable-prefix-caching \ --gpu-memory-utilization 0.8 \ --enforce-eager \ --speculative-config '{"method": "eagle3", "model":"lightseekorg/kimi-k2.5-eagle3", "num_speculative_tokens": 1}' \ --mm-encoder-tp-mode data \ --kv-transfer-config \ '{"kv_connector": "MooncakeConnectorV1", "kv_role": "kv_producer", "kv_port": "30000", "engine_id": "0", "kv_connector_extra_config": { "prefill": { "dp_size": 2, "tp_size": 8 }, "decode": { "dp_size": 32, "tp_size": 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="141.xx.xx.2" # The value of node0_ip must be consistent with the value of local_ip set in node0 (master node) node0_ip="xxxx" 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 echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor sysctl -w vm.swappiness=0 sysctl -w kernel.numa_balancing=0 sysctl kernel.sched_migration_cost_ns=50000 export VLLM_RPC_TIMEOUT=3600000 export VLLM_EXECUTE_MODEL_TIMEOUT_SECONDS=30000 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=256 export VLLM_ASCEND_ENABLE_FLASHCOMM1=1 export ASCEND_RT_VISIBLE_DEVICES=$1 vllm serve Eco-Tech/Kimi-K2.5-w4a8 \ --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 \ --enable-expert-parallel \ --seed 1024 \ --quantization ascend \ --served-model-name kimi_k25 \ --trust-remote-code \ --max-num-seqs 8 \ --max-model-len 32768 \ --max-num-batched-tokens 16384 \ --no-enable-prefix-caching \ --gpu-memory-utilization 0.8 \ --enforce-eager \ --speculative-config '{"method": "eagle3", "model":"lightseekorg/kimi-k2.5-eagle3", "num_speculative_tokens": 1}' \ --mm-encoder-tp-mode data \ --kv-transfer-config \ '{"kv_connector": "MooncakeConnectorV1", "kv_role": "kv_producer", "kv_port": "30100", "engine_id": "1", "kv_connector_extra_config": { "prefill": { "dp_size": 2, "tp_size": 8 }, "decode": { "dp_size": 32, "tp_size": 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="141.xx.xx.3" # The value of node0_ip must be consistent with the value of local_ip set in node0 (master node) node0_ip="xxxx" 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 echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor sysctl -w vm.swappiness=0 sysctl -w kernel.numa_balancing=0 sysctl kernel.sched_migration_cost_ns=50000 export VLLM_RPC_TIMEOUT=3600000 export VLLM_EXECUTE_MODEL_TIMEOUT_SECONDS=30000 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=1100 export VLLM_ASCEND_ENABLE_MLAPO=1 export ASCEND_RT_VISIBLE_DEVICES=$1 vllm serve Eco-Tech/Kimi-K2.5-w4a8 \ --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 \ --enable-expert-parallel \ --seed 1024 \ --quantization ascend \ --served-model-name kimi_k25 \ --trust-remote-code \ --max-num-seqs 48 \ --max-model-len 32768 \ --max-num-batched-tokens 256 \ --no-enable-prefix-caching \ --gpu-memory-utilization 0.95 \ --compilation-config '{"cudagraph_mode": "FULL_DECODE_ONLY"}' \ --additional-config '{"recompute_scheduler_enable":true,"multistream_overlap_shared_expert": false}' \ --speculative-config '{"method": "eagle3", "model":"lightseekorg/kimi-k2.5-eagle3", "num_speculative_tokens": 3}' \ --kv-transfer-config \ '{"kv_connector": "MooncakeConnectorV1", "kv_role": "kv_consumer", "kv_port": "30200", "engine_id": "2", "kv_connector_extra_config": { "prefill": { "dp_size": 2, "tp_size": 8 }, "decode": { "dp_size": 32, "tp_size": 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="141.xx.xx.4" # The value of node0_ip must be consistent with the value of local_ip set in node0 (master node) node0_ip="xxxx" 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 echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor sysctl -w vm.swappiness=0 sysctl -w kernel.numa_balancing=0 sysctl kernel.sched_migration_cost_ns=50000 export VLLM_RPC_TIMEOUT=3600000 export VLLM_EXECUTE_MODEL_TIMEOUT_SECONDS=30000 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=1100 export VLLM_ASCEND_ENABLE_MLAPO=1 export ASCEND_RT_VISIBLE_DEVICES=$1 vllm serve Eco-Tech/Kimi-K2.5-w4a8 \ --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 \ --enable-expert-parallel \ --seed 1024 \ --quantization ascend \ --served-model-name kimi_k25 \ --trust-remote-code \ --max-num-seqs 48 \ --max-model-len 32768 \ --max-num-batched-tokens 256 \ --no-enable-prefix-caching \ --gpu-memory-utilization 0.95 \ --compilation-config '{"cudagraph_mode": "FULL_DECODE_ONLY"}' \ --additional-config '{"recompute_scheduler_enable":true,"multistream_overlap_shared_expert": false}' \ --speculative-config '{"method": "eagle3", "model":"lightseekorg/kimi-k2.5-eagle3", "num_speculative_tokens": 3}' \ --kv-transfer-config \ '{"kv_connector": "MooncakeConnectorV1", "kv_role": "kv_consumer", "kv_port": "30200", "engine_id": "2", "kv_connector_extra_config": { "prefill": { "dp_size": 2, "tp_size": 8 }, "decode": { "dp_size": 32, "tp_size": 1 } } }'
关键参数说明:
VLLM_ASCEND_ENABLE_FLASHCOMM1=1:在prefill节点上启用通信优化功能。VLLM_ASCEND_ENABLE_MLAPO=1:启用融合算子,可以显著提升性能但会消耗更多NPU内存。在Prefill-Decode(PD)分离场景中,仅在decode节点上启用MLAPO。recompute_scheduler_enable: true:启用重计算调度器。当decode节点的键值缓存(KV Cache)不足时,请求将被发送到prefill节点以重新计算KV Cache。在PD分离场景中,仅在decode节点上启用此配置。multistream_overlap_shared_expert: true:当张量并行(TP)大小为1或enable_shared_expert_dp: true时,启用额外的流来重叠共享专家的计算过程以提高效率。
run_dp_template.sh脚本使用位置参数($1-$7)从launch_online_dp.py接收配置值:$1(ASCEND_RT_VISIBLE_DEVICES):分配给此DP实例的NPU设备,例如0,1,2,3或4,5,6,7。$2(--port):此DP实例的vLLM服务器端口,从--vllm-start-port开始自动分配(例如7100、7101)。$3(--data-parallel-size):DP等级的总数。$4(--data-parallel-rank):此DP实例的等级索引。$5(--data-parallel-address):DP主节点的IP地址。$6(--data-parallel-rpc-port):DP主节点通信的RPC端口。$7(--tensor-parallel-size):每个DP等级内的TP大小。
为每个节点运行服务器:
# p0 python launch_online_dp.py --dp-size 2 --tp-size 8 --dp-size-local 2 --dp-rank-start 0 --dp-address 141.xx.xx.1 --dp-rpc-port 12321 --vllm-start-port 7100 # p1 python launch_online_dp.py --dp-size 2 --tp-size 8 --dp-size-local 2 --dp-rank-start 0 --dp-address 141.xx.xx.2 --dp-rpc-port 12321 --vllm-start-port 7100 # d0 python launch_online_dp.py --dp-size 32 --tp-size 1 --dp-size-local 16 --dp-rank-start 0 --dp-address 141.xx.xx.3 --dp-rpc-port 12321 --vllm-start-port 7100 # d1 python launch_online_dp.py --dp-size 32 --tp-size 1 --dp-size-local 16 --dp-rank-start 16 --dp-address 141.xx.xx.3 --dp-rpc-port 12321 --vllm-start-port 7100
在预填充主节点上运行
proxy.sh脚本在与预填充服务实例相同的节点上运行代理服务器。您可以在仓库示例中获取代理程序:load_balance_proxy_server_example.py
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.2 \ 141.xx.xx.2 \ --prefiller-ports \ 7100 7101 7100 7101 \ --decoder-hosts \ 141.xx.xx.3 \ 141.xx.xx.3 \ 141.xx.xx.3 \ 141.xx.xx.3 \ 141.xx.xx.3 \ 141.xx.xx.3 \ 141.xx.xx.3 \ 141.xx.xx.3 \ 141.xx.xx.3 \ 141.xx.xx.3 \ 141.xx.xx.3 \ 141.xx.xx.3 \ 141.xx.xx.3 \ 141.xx.xx.3 \ 141.xx.xx.3 \ 141.xx.xx.3 \ 141.xx.xx.4 \ 141.xx.xx.4 \ 141.xx.xx.4 \ 141.xx.xx.4 \ 141.xx.xx.4 \ 141.xx.xx.4 \ 141.xx.xx.4 \ 141.xx.xx.4 \ 141.xx.xx.4 \ 141.xx.xx.4 \ 141.xx.xx.4 \ 141.xx.xx.4 \ 141.xx.xx.4 \ 141.xx.xx.4 \ 141.xx.xx.4 \ 141.xx.xx.4 \ --decoder-ports \ 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 \ 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 \
cd vllm-ascend/examples/disaggregated_prefill_v1/ bash proxy.sh
部署验证:
在PD分离服务完全启动后,通过预填充主节点上的代理端口发送请求,验证预填充节点和解码节点是否协同正常工作:
curl http://141.xx.xx.1:1999/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "kimi_k25",
"messages": [{
"role": "user",
"content": [
{
"type": "text",
"text": "The future of AI is"
}]
}],
"max_tokens": 1024,
"temperature": 1.0,
"top_p": 0.95
}'
预期结果:
代理返回HTTP 200 OK。JSON响应包含带有生成文本的choices字段,确认预填充节点已成功处理提示词,解码节点已生成响应:
{
"id": "chatcmpl-xxxxxxxxxxxxx",
"object": "chat.completion",
"model": "kimi_k25",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The future of AI is not a destination we are passively approaching...",
"finish_reason": "length"
}
}
],
"usage": {
"prompt_tokens": 13,
"total_tokens": 1037,
"completion_tokens": 1024
}
}
常见问题提示:如果在PD分离部署中遇到问题,请参考公共FAQ进行故障排查。
6 功能验证#
服务器启动后,您可以使用输入提示词查询模型:
curl http://<node0_ip>:8088/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "kimi_k25",
"messages": [{
"role": "user",
"content": [
{
"type": "text",
"text": "The future of AI is"
}]
}],
"max_tokens": 1024,
"temperature": 1.0,
"top_p": 0.95
}'
预期结果:
服务返回HTTP 200 OK。JSON响应包含带有生成文本的choices字段,以及使用统计信息:
{
"id": "chatcmpl-xxxxxxxxxxxxx",
"object": "chat.completion",
"model": "kimi_k25",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The future of AI is not a destination we are passively approaching...",
"finish_reason": "length"
}
}
],
"usage": {
"prompt_tokens": 13,
"total_tokens": 1037,
"completion_tokens": 1024
}
}
7 精度评估#
以下是一种精度评估方法。
使用AISBench#
详情请参考使用AISBench。
执行后即可获得结果。以下为
vllm-ascend:v0.17.0rc1中Kimi-K2.5-w4a8的结果,仅供参考。
数据集 |
版本 |
指标 |
模式 |
vllm-api-general-chat |
备注 |
|---|---|---|---|---|---|
GSM8K |
- |
准确率 |
生成 |
96.07 |
1台Atlas 800 A3 (64G × 16) |
AIME2025 |
- |
准确率 |
生成 |
90.00 |
1台Atlas 800 A3 (64G × 16) |
GPQA |
- |
准确率 |
生成 |
84.85 |
1台Atlas 800 A3 (64G × 16) |
TextVQA |
- |
准确率 |
生成 |
80.29 |
1台Atlas 800 A3 (64G × 16) |
8 性能评估#
使用AISBench#
详情请参考使用AISBench进行性能评估。
使用vLLM基准测试#
以Kimi-K2.5-w4a8为例运行性能评估。
更多详情请参考vllm基准测试。
有三个vllm bench子命令:
latency:对单批请求的延迟进行基准测试。serve:对在线服务吞吐量进行基准测试。throughput:对离线推理吞吐量进行基准测试。
以serve为例。运行如下代码。
vllm bench serve --model Eco-Tech/Kimi-K2.5-w4a8 --dataset-name random --random-input 1024 --num-prompts 200 --request-rate 1 --save-result --result-dir ./
大约几分钟后,即可获得性能评估结果。
9 性能调优#
9.1 推荐配置#
注意:以下配置在特定测试环境中验证,仅供参考。最佳配置取决于最大输入/输出长度、前缀缓存命中率、精度要求和部署机器比例等因素。建议根据实际情况参考第9.2节进行调优。
表1:场景概览#
*总NPU数表示所有节点使用的NPU总数。1节点 = 1台Atlas 800 A3服务器 (64G × 16 NPU)。
场景 |
部署模式 |
*总NPU数 |
权重版本 |
关键考量 |
|---|---|---|---|---|
高吞吐量/低延迟 |
单节点混合 |
16 (A3) |
kimi-k2.5-w4a8 |
使用dp4 tp4以获得最佳吞吐量和低延迟 |
高吞吐量/低延迟 |
2节点数据并行 |
16 (A2) |
kimi-k2.5-w4a8 |
跨2节点的dp4 tp4;平衡延迟和吞吐量 |
高吞吐量/低延迟 |
2P1D部署 |
64 (A3) |
kimi-k2.5-w4a8 |
预填充:dp2 tp8;解码:dp32 tp1以实现高并发 |
长上下文 |
单节点混合 |
16 (A3) |
kimi-k2.5-w4a8 |
dp1 tp16以最大化TP,适应极端上下文长度 |
长上下文 |
单节点混合 |
16 (A3) |
kimi-k2.5-w4a8 |
dp2 tp8以优化内存带宽并支持更高并发 |
表2:详细节点配置#
场景 |
配置 |
NPU数 |
TP |
DP |
最大模型长度 |
MTP推测数量 |
|---|---|---|---|---|---|---|
高吞吐量/低延迟 (16K) |
服务器/单机 |
16 |
4 |
4 |
~16K |
3 |
高吞吐量/低延迟 (16K) |
服务器/2节点DP |
8 |
4 |
2 |
~16K |
3 |
高吞吐量/低延迟 (16K) |
服务器-P节点 |
16 |
8 |
2 |
~16K |
3 |
高吞吐量/低延迟 (16K) |
服务器-D节点 |
16 |
1 |
32 |
~16K |
3 |
长上下文 (128K,低并发 ≤4) |
服务器/单机 |
16 |
16 |
1 |
128K |
3 |
长上下文 (128K,高并发 >4) |
服务器/单机 |
16 |
8 |
2 |
128K |
3 |
完整的启动命令和参数描述,请参考第5章中的部署示例。
注意: max-model-len 和 max-num-seqs 需要根据实际使用场景进行设置。其他配置请参考 部署 章节。
9.2 调优指南#
调优方法请参考公共性能调优文档。
详细功能说明请参考功能矩阵。
10 常见问题#
常见环境、安装及通用参数问题请参考公共FAQ;本章仅涉及模型相关问题。
问:单节点部署时推荐的TP/DP配置是什么?
答:单节点部署时,建议使用
dp4 tp4而非dp2 tp8。