DeepSeek-R1在昇腾NPU上的低延迟与高吞吐部署配置

资料给出DeepSeek-R1在A3系列昇腾NPU上的最优配置表,按低延迟与高吞吐两类场景区分卡数、PD分离或混合部署、量化方式与TPOT指标,并说明A3每卡双die使tp-size为卡数两倍,配置以指定镜像版本验证。

本页面主要介绍DeepSeek-R1在Ascend NPU上的最佳配置和基准结果. 关于环境设置,模型重量下载,功能配置,以及部署指令等,参见: [DeepSeek - R1 模式教程](<https://docs.sglang.io/docs/hardware-platforms/ascend-npus/model-deployment/tutorials/deepseek_r1>). 在A3系列上,每张卡片都有2死亡,所以 `--tp-size` 是牌数的两倍;见 [调试 NPU 参考](<https://docs.sglang.io/docs/hardware-platforms/ascend-npus/reference/glossary#hardware>) 详细情况。 本页面上的最佳配置用图像验证 `quay.io/ascend/sglang:v0.5.18-cann9.0.0-a3`。准确使用此版本;本页面不覆盖后期版本,可能会引入断开的更改。 ### 低纬度 | 型号 | 硬件 | 纸牌 | 部署模式 | 数据集 | TPOT | 量化 | 配置 | | --- | --- | --- | --- | --- | --- | --- | --- | | 深层搜索- R1 | A3系列产品 | 32 | PD 分类 | 3.5k+1.5k | 20分钟 | W8A8 INT8 | [优化配置](<https://docs.sglang.io/docs/hardware-platforms/ascend-npus/model-deployment/best-practices/deepseek_r1#deepseek-r1-w8a8-2p1d-32p-in3k5-out1k5-20ms>) | | 深层搜索- R1 | A3系列产品 | 32 | PD 分类 | 3.5k+1k | 19.0ms (英语). | W8A8 INT8 | [优化配置](<https://docs.sglang.io/docs/hardware-platforms/ascend-npus/model-deployment/best-practices/deepseek_r1#deepseek-r1-w8a8-2p1d-32p-in3k5-out1k-19-0ms>) | | 深层搜索- R1 | A3系列产品 | 32 | PD 分类 | 3.9k+1k | 19.0ms (英语). | W8A8 INT8 | [优化配置](<https://docs.sglang.io/docs/hardware-platforms/ascend-npus/model-deployment/best-practices/deepseek_r1#deepseek-r1-w8a8-2p1d-32p-in3k9-out1k-19-0ms>) | | 深层搜索- R1 | A3系列产品 | 32 | PD 分类 | 6k+1.6k | 20.5毫米口径 | W8A8 INT8 | [优化配置](<https://docs.sglang.io/docs/hardware-platforms/ascend-npus/model-deployment/best-practices/deepseek_r1#deepseek-r1-w8a8-2p1d-32p-in6k-out1k6-20-5ms>) | ### 高吞吐量 | 型号 | 硬件 | 纸牌 | 部署模式 | 数据集 | TPOT | 量化 | 配置 | | --- | --- | --- | --- | --- | --- | --- | --- | | 深层搜索- R1 | A3系列产品 | 16 | PD 分类 | 3.5k+1.5k | 50分钟 | W4A8 INT8 | [优化配置](<https://docs.sglang.io/docs/hardware-platforms/ascend-npus/model-deployment/best-practices/deepseek_r1#deepseek-r1-w4a8-1p1d-16p-in3k5-out1k5-50ms>) | | 深层搜索- R1 | A3系列产品 | 8 | PD 混合状态 | 3.5k+1.5k | 50分钟 | W4A8 INT8 | [优化配置](<https://docs.sglang.io/docs/hardware-platforms/ascend-npus/model-deployment/best-practices/deepseek_r1#deepseek-r1-w4a8-8p-in3k5-out1k5-50ms>) | | 深层搜索- R1 | A3系列产品 | 32 | PD 分类 | 3.5k+1.5k | 50分钟 | W8A8 INT8 | [优化配置](<https://docs.sglang.io/docs/hardware-platforms/ascend-npus/model-deployment/best-practices/deepseek_r1#deepseek-r1-w8a8-2p1d-32p-in3k5-out1k5-50ms>) | ## 优化配置 ### 深搜索 - R1 W4A8 1P1D 16P IN3K5 OUT1K5 50米 **型号**: DeepSeek - R1 (英语). **硬件**: A3系列产品. **纸牌**: 16 **部署模式**: PD 分类 **量化**: W4A8 INT8 **数据集**: 3.5k+1.5k **TPOT**: 50 ms (英语). #### 示范部署 命令 ``` # ============================================================ # Before running, update the following variables: # P_IP: prefill node IP address # D_IP: decode node IP address # ASCEND_MF_STORE_URL: prefill node IP with port # MODEL_PATH: path to the model weights directory # HCCL_SOCKET_IFNAME: network interface name for HCCL # GLOO_SOCKET_IFNAME: network interface name for Gloo # ============================================================ 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 unset https_proxy unset http_proxy unset HTTPS_PROXY unset HTTP_PROXY unset ASCEND_LAUNCH_BLOCKING source /usr/local/Ascend/ascend-toolkit/set_env.sh source /usr/local/Ascend/nnal/atb/set_env.sh export ENABLE_MOE_NZ=1 export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True export SGLANG_NPU_USE_MLAPO=1 export SGLANG_SET_CPU_AFFINITY=1 export SGLANG_USE_FIA_NZ=1 export STREAMS_PER_DEVICE=32 P_IP=('<your prefill ip>') D_IP=('<your decode ip>') export ASCEND_MF_STORE_URL="tcp://<your prefill ip>:24670" MODEL_PATH=/path/to/model-weights LOCAL_HOST1=`hostname -I|awk -F " " '{print$1}'` LOCAL_HOST2=`hostname -I|awk -F " " '{print$2}'` echo "${LOCAL_HOST1}" echo "${LOCAL_HOST2}" # prefill for i in "${!P_IP[@]}"; do if [[ "$LOCAL_HOST1" == "${P_IP[$i]}" || "$LOCAL_HOST2" == "${P_IP[$i]}" ]]; then echo "${P_IP[$i]}" export DEEPEP_HCCL_BUFFSIZE=4000 export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 export GLOO_SOCKET_IFNAME=<network-interface> export HCCL_SOCKET_IFNAME=<network-interface> export TASK_QUEUE_ENABLE=2 python3 -m sglang.launch_server \ --model-path ${MODEL_PATH} \ --disaggregation-mode prefill \ --host ${P_IP[$i]} \ --port 8000 \ --disaggregation-bootstrap-port 8998 \ --node-rank 0 \ --nnodes 1 \ --tp-size 16 \ --mem-fraction-static 0.8 \ --quantization modelslim \ --max-running-requests 32 \ --context-length 8192 \ --disable-radix-cache \ --chunked-prefill-size 20480 \ --max-prefill-tokens 20480 \ --moe-a2a-backend deepep \ --deepep-mode normal \ --speculative-algorithm NEXTN \ --speculative-num-steps 1 \ --speculative-eagle-topk 1 \ --speculative-num-draft-tokens 2 \ --enable-dp-attention --dp-size 8 \ --disable-shared-experts-fusion \ --dtype bfloat16 \ --reasoning-parser deepseek-r1 \ --tool-call-parser deepseekv3 \ --max-total-tokens 80000 \ --disaggregation-transfer-backend ascend \ --trust-remote-code \ --attention-backend ascend \ --device npu break fi done # decode for i in "${!D_IP[@]}"; do if [[ "$LOCAL_HOST1" == "${D_IP[$i]}" || "$LOCAL_HOST2" == "${D_IP[$i]}" ]]; then echo "${D_IP[$i]}" export DEEPEP_HCCL_BUFFSIZE=800 export GLOO_SOCKET_IFNAME=<network-interface> export HCCL_SOCKET_IFNAME=<network-interface> export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=78 export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 export TASK_QUEUE_ENABLE=1 python3 -m sglang.launch_server \ --model-path ${MODEL_PATH} \ --disaggregation-mode decode \ --host ${D_IP[$i]} \ --port 8001 \ --nnodes 1 \ --tp-size 16 \ --enable-dp-attention --dp-size 16 \ --mem-fraction-static 0.9 \ --max-running-requests 416 \ --quantization modelslim \ --moe-a2a-backend deepep \ --deepep-mode low_latency \ --enable-dp-lm-head \ --cuda-graph-bs-decode 2 4 6 8 10 12 14 16 18 20 22 24 26 \ --watchdog-timeout 9000 \ --context-length 8192 \ --speculative-algorithm NEXTN \ --speculative-num-steps 2 \ --speculative-eagle-topk 1 \ --speculative-num-draft-tokens 3 \ --disable-shared-experts-fusion \ --dtype bfloat16 \ --tokenizer-worker-num 4 \ --load-balance-method round_robin \ --reasoning-parser deepseek-r1 \ --tool-call-parser deepseekv3 \ --max-total-tokens 145792 \ --disaggregation-transfer-backend ascend \ --trust-remote-code \ --attention-backend ascend \ --device npu break fi done ``` 命令 ``` # ============================================================ # Before running, replace the following placeholders: # <your prefill ip>: prefill node IP address # <your decode ip>: decode node IP address # /path/to/model-weights: the MODEL_PATH the workers were launched with # ============================================================ sgl-router \ --model-id /path/to/model-weights \ --no-tokenizer \ --worker-urls http://<your prefill ip>:8000 http://<your decode ip>:8001 \ --host 127.0.0.1 \ --port 6688 ``` #### 基准 我们测试它基于 `RANDOM` 数据集。 命令 ``` python -m sglang.benchmark.serving \ --dataset-name random \ --backend sglang \ --host 127.0.0.1 \ --port 6688 \ --request-rate 24 \ --max-concurrency 416 \ --num-prompts 1664 \ --random-input-len 3584 \ --random-output-len 1536 \ --random-range-ratio 1 \ --seed 1 ``` ### 深搜索 - R1 W4A8 8P IN3K5 OUT1K5 50米 **型号**: DeepSeek - R1 (英语). **硬件**: A3系列产品. **纸牌**: 8 **部署模式**: PD 混合型 **量化**: W4A8 INT8 **数据集**: 3.5k+1.5k **TPOT**: 50 ms (英语). #### 示范部署 命令 ``` # ============================================================ # Before running, update the following variables: # MODEL_PATH: path to the model weights directory # HCCL_SOCKET_IFNAME: network interface name for HCCL # GLOO_SOCKET_IFNAME: network interface name for Gloo # ============================================================ MODEL_PATH=/path/to/model-weights 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 unset https_proxy unset http_proxy unset HTTPS_PROXY unset HTTP_PROXY unset ASCEND_LAUNCH_BLOCKING source /usr/local/Ascend/ascend-toolkit/set_env.sh source /usr/local/Ascend/nnal/atb/set_env.sh export DEEPEP_HCCL_BUFFSIZE=2000 export DEEPEP_NORMAL_LONG_SEQ_PER_ROUND_TOKENS=1024 export DEEPEP_NORMAL_LONG_SEQ_ROUND=10 export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 export GLOO_SOCKET_IFNAME=<network-interface> export HCCL_SOCKET_IFNAME=<network-interface> export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=72 export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 export SGLANG_NPU_USE_MLAPO=1 export SGLANG_USE_FIA_NZ=1 export STREAMS_PER_DEVICE=32 python3 -m sglang.launch_server \ --enable-prefill-delayer \ --prefill-delayer-max-delay-passes 200 \ --model-path $MODEL_PATH \ --host 127.0.0.1 --port 6688 \ --tp-size 16 \ --trust-remote-code \ --attention-backend ascend \ --device npu \ --quantization modelslim \ --watchdog-timeout 9000 \ --cuda-graph-bs-decode 4 8 12 14 \ --mem-fraction-static 0.9 \ --max-running-requests 224 \ --context-length 8188 \ --disable-radix-cache \ --chunked-prefill-size 65536 \ --max-prefill-tokens 3000 \ --moe-a2a-backend deepep \ --deepep-mode auto \ --enable-dp-attention --dp-size 16 \ --enable-dp-lm-head \ --speculative-algorithm NEXTN \ --speculative-num-steps 3 \ --speculative-eagle-topk 1 \ --speculative-num-draft-tokens 4 \ --dtype bfloat16 \ --reasoning-parser deepseek-r1 \ --tool-call-parser deepseekv3 \ --max-total-tokens 100000 ``` #### 基准 我们测试它基于 `RANDOM` 数据集。 命令 ``` python -m sglang.benchmark.serving \ --dataset-name random \ --backend sglang \ --host 127.0.0.1 \ --port 6688 \ --max-concurrency 224 \ --num-prompts 896 \ --random-input-len 3500 \ --random-output-len 1500 \ --random-range-ratio 1 \ --seed 1 ``` ### 深搜索- R1 W8A8 2P1D 32P IN3K5 OUT1K5 20米 **型号**: DeepSeek - R1 (英语). **硬件**: A3系列产品. **纸牌**: 32 **部署模式**: PD 分类 **量化**: W8A8 INT8 **数据集**: 3.5k+1.5k **TPOT**: 20米口径 #### 示范部署 命令 ``` # ============================================================ # Before running, update the following variables: # P_IP: prefill node IP address # D_IP: decode node IP address # ASCEND_MF_STORE_URL: prefill node IP with port # MODEL_PATH: path to the model weights directory # HCCL_SOCKET_IFNAME: network interface name for HCCL # GLOO_SOCKET_IFNAME: network interface name for Gloo # ============================================================ 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 unset https_proxy unset http_proxy unset HTTPS_PROXY unset HTTP_PROXY unset ASCEND_LAUNCH_BLOCKING source /usr/local/Ascend/ascend-toolkit/set_env.sh source /usr/local/Ascend/nnal/atb/set_env.sh export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True export SGLANG_NPU_USE_MLAPO=1 export SGLANG_SET_CPU_AFFINITY=1 export SGLANG_USE_FIA_NZ=1 export STREAMS_PER_DEVICE=32 P_IP=('<your prefill ip1>' '<your prefill ip2>') D_IP=('<your decode ip1>' '<your decode ip2>') export ASCEND_MF_STORE_URL="tcp://<your prefill ip1>:24670" MODEL_PATH=/path/to/model-weights LOCAL_HOST1=`hostname -I|awk -F " " '{print$1}'` LOCAL_HOST2=`hostname -I|awk -F " " '{print$2}'` echo "${LOCAL_HOST1}" echo "${LOCAL_HOST2}" # prefill for i in "${!P_IP[@]}"; do if [[ "$LOCAL_HOST1" == "${P_IP[$i]}" || "$LOCAL_HOST2" == "${P_IP[$i]}" ]]; then echo "${P_IP[$i]}" export DEEPEP_HCCL_BUFFSIZE=1536 export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 export GLOO_SOCKET_IFNAME=<network-interface> export HCCL_SOCKET_IFNAME=<network-interface> export TASK_QUEUE_ENABLE=2 python3 -m sglang.launch_server \ --model-path ${MODEL_PATH} \ --disaggregation-mode prefill \ --host ${P_IP[$i]} \ --port 8000 \ --disaggregation-bootstrap-port $((8998 + $i)) \ --node-rank 0 \ --nnodes 1 \ --tp-size 16 \ --mem-fraction-static 0.81 \ --quantization modelslim \ --max-running-requests 4 \ --context-length 8192 \ --disable-radix-cache \ --chunked-prefill-size -1 \ --max-prefill-tokens 28680 \ --moe-a2a-backend deepep \ --deepep-mode normal \ --speculative-algorithm NEXTN \ --speculative-num-steps 1 \ --speculative-eagle-topk 1 \ --speculative-num-draft-tokens 2 \ --enable-dp-attention --dp-size 2 \ --disable-shared-experts-fusion \ --dtype bfloat16 \ --enable-attn-tp-input-scattered \ --reasoning-parser deepseek-r1 \ --tool-call-parser deepseekv3 \ --disaggregation-transfer-backend ascend \ --trust-remote-code \ --attention-backend ascend \ --device npu break fi done # decode for i in "${!D_IP[@]}"; do if [[ "$LOCAL_HOST1" == "${D_IP[$i]}" || "$LOCAL_HOST2" == "${D_IP[$i]}" ]]; then echo "${D_IP[$i]}" export DEEPEP_HCCL_BUFFSIZE=650 export GLOO_SOCKET_IFNAME=<network-interface> export HCCL_SOCKET_IFNAME=<network-interface> export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=12 export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 export SGLANG_SCHEDULER_SKIP_ALL_GATHER=1 export TASK_QUEUE_ENABLE=1 python3 -m sglang.launch_server \ --model-path ${MODEL_PATH} \ --disaggregation-mode decode \ --host ${D_IP[$i]} \ --port 8001 \ --dist-init-addr ${D_IP[0]}:5000 \ --node-rank $i \ --nnodes 2 \ --tp-size 32 \ --enable-dp-attention --dp-size 16 \ --mem-fraction-static 0.75 \ --max-running-requests 32 \ --quantization modelslim \ --moe-a2a-backend deepep \ --deepep-mode low_latency \ --enable-dp-lm-head \ --moe-dense-tp 1 \ --cuda-graph-bs-decode 2 4 6 \ --watchdog-timeout 9000 \ --context-length 8192 \ --speculative-algorithm NEXTN \ --speculative-num-steps 3 \ --speculative-eagle-topk 1 \ --speculative-num-draft-tokens 4 \ --tokenizer-worker-num 4 \ --disable-shared-experts-fusion \ --dtype bfloat16 \ --load-balance-method round_robin \ --reasoning-parser deepseek-r1 \ --tool-call-parser deepseekv3 \ --disaggregation-transfer-backend ascend \ --trust-remote-code \ --attention-backend ascend \ --device npu break fi done ``` 命令 ``` # ============================================================ # Before running, replace the following placeholders: # <your prefill ip1>, <your prefill ip2>: prefill node IP addresses # <your decode ip1>: first decode node IP address (decode may have distributed nodes) # /path/to/model-weights: the MODEL_PATH the workers were launched with # ============================================================ sgl-router \ --model-id /path/to/model-weights \ --no-tokenizer \ --worker-urls \ http://<your prefill ip1>:8000 \ http://<your prefill ip2>:8000 \ http://<your decode ip1>:8001 \ --host 127.0.0.1 \ --port 6688 ``` #### 基准 我们测试它基于 `RANDOM` 数据集。 命令 ``` python -m sglang.benchmark.serving \ --dataset-name random \ --backend sglang \ --host 127.0.0.1 \ --port 6688 \ --request-rate 16 \ --max-concurrency 32 \ --num-prompts 32 \ --random-input-len 3500 \ --random-output-len 1500 \ --random-range-ratio 1 \ --seed 42 ``` ### 深搜索 - R1 W8A8 2P1D 32P IN3K5 OUT1K5 50米 **型号**: DeepSeek - R1 (英语). **硬件**: A3系列产品. **纸牌**: 32 **部署模式**: PD 分类 **量化**: W8A8 INT8 **数据集**: 3.5k+1.5k **TPOT**: 50 ms (英语). #### 示范部署 命令 ``` # ============================================================ # Before running, update the following variables: # P_IP: prefill node IP address # D_IP: decode node IP address # ASCEND_MF_STORE_URL: prefill node IP with port # MODEL_PATH: path to the model weights directory # HCCL_SOCKET_IFNAME: network interface name for HCCL # GLOO_SOCKET_IFNAME: network interface name for Gloo # ============================================================ 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 unset https_proxy unset http_proxy unset HTTPS_PROXY unset HTTP_PROXY unset ASCEND_LAUNCH_BLOCKING source /usr/local/Ascend/ascend-toolkit/set_env.sh source /usr/local/Ascend/nnal/atb/set_env.sh export HCCL_OP_EXPANSION_MODE=AIV export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True export SGLANG_NPU_USE_MLAPO=1 export SGLANG_NPU_USE_MULTI_STREAM=1 export SGLANG_SET_CPU_AFFINITY=1 export SGLANG_USE_FIA_NZ=1 export STREAMS_PER_DEVICE=32 P_IP=('<your prefill ip1>' '<your prefill ip2>') D_IP=('<your decode ip1>' '<your decode ip2>') export ASCEND_MF_STORE_URL="tcp://<your prefill ip1>:24670" MODEL_PATH=/path/to/model-weights LOCAL_HOST1=`hostname -I|awk -F " " '{print$1}'` LOCAL_HOST2=`hostname -I|awk -F " " '{print$2}'` echo "${LOCAL_HOST1}" echo "${LOCAL_HOST2}" # prefill for i in "${!P_IP[@]}"; do if [[ "$LOCAL_HOST1" == "${P_IP[$i]}" || "$LOCAL_HOST2" == "${P_IP[$i]}" ]]; then echo "${P_IP[$i]}" export DEEPEP_HCCL_BUFFSIZE=800 export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 export GLOO_SOCKET_IFNAME=<network-interface> export HCCL_SOCKET_IFNAME=<network-interface> export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=131072 export SGLANG_NPU_FUSED_MOE_MODE=2 export SGLANG_USE_AG_AFTER_QLORA=1 export TASK_QUEUE_ENABLE=2 python3 -m sglang.launch_server \ --model-path ${MODEL_PATH} \ --disaggregation-mode prefill \ --host ${P_IP[$i]} \ --port 8000 \ --disaggregation-bootstrap-port $((8998 + $i)) \ --node-rank 0 \ --nnodes 1 \ --tp-size 16 \ --mem-fraction-static 0.778 \ --quantization modelslim \ --max-running-requests 16 \ --disable-radix-cache \ --chunked-prefill-size -1 \ --max-prefill-tokens 60000 \ --moe-a2a-backend ascend_fuseep \ --deepep-mode normal \ --speculative-algorithm NEXTN \ --speculative-num-steps 1 \ --speculative-eagle-topk 1 \ --speculative-num-draft-tokens 2 \ --enable-dp-attention --dp-size 4 \ --disable-shared-experts-fusion \ --dtype bfloat16 \ --enable-attn-tp-input-scattered \ --reasoning-parser deepseek-r1 \ --tool-call-parser deepseekv3 \ --disaggregation-transfer-backend ascend \ --trust-remote-code \ --attention-backend ascend \ --device npu break fi done # decode for i in "${!D_IP[@]}"; do if [[ "$LOCAL_HOST1" == "${D_IP[$i]}" || "$LOCAL_HOST2" == "${D_IP[$i]}" ]]; then echo "${D_IP[$i]}" export DEEPEP_HCCL_BUFFSIZE=600 export GLOO_SOCKET_IFNAME=<network-interface> export HCCL_SOCKET_IFNAME=<network-interface> export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=64 export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 export SGLANG_LM_HEAD_TP=8 export SGLANG_NPU_FUSED_MOE_MODE=1 export TASK_QUEUE_ENABLE=1 python3 -m sglang.launch_server \ --model-path ${MODEL_PATH} \ --disaggregation-mode decode \ --host ${D_IP[$i]} \ --port 8001 \ --dist-init-addr ${D_IP[0]}:5000 \ --node-rank $i \ --nnodes 2 \ --tp-size 32 \ --enable-dp-attention --dp-size 32 \ --mem-fraction-static 0.82 \ --max-running-requests 1024 \ --quantization modelslim \ --moe-a2a-backend ascend_fuseep \ --deepep-mode low_latency \ --moe-dense-tp 1 \ --cuda-graph-bs-decode 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 \ --watchdog-timeout 9000 \ --context-length 8192 \ --speculative-algorithm NEXTN \ --speculative-num-steps 1 \ --speculative-eagle-topk 1 \ --speculative-num-draft-tokens 2 \ --tokenizer-worker-num 4 \ --disable-shared-experts-fusion \ --dtype bfloat16 \ --load-balance-method round_robin \ --reasoning-parser deepseek-r1 \ --tool-call-parser deepseekv3 \ --disaggregation-transfer-backend ascend \ --trust-remote-code \ --attention-backend ascend \ --device npu break fi done ``` 命令 ``` # ============================================================ # Before running, replace the following placeholders: # <your prefill ip1>, <your prefill ip2>: prefill node IP addresses # <your decode ip1>: first decode node IP address (decode may have distributed nodes) # /path/to/model-weights: the MODEL_PATH the workers were launched with # ============================================================ sgl-router \ --model-id /path/to/model-weights \ --no-tokenizer \ --worker-urls \ http://<your prefill ip1>:8000 \ http://<your prefill ip2>:8000 \ http://<your decode ip1>:8001 \ --host 127.0.0.1 \ --port 6688 ``` #### 基准 我们测试它基于 `RANDOM` 数据集。 命令 ``` python -m sglang.benchmark.serving \ --dataset-name random \ --backend sglang \ --host 127.0.0.1 \ --port 6688 \ --request-rate 40 \ --max-concurrency 1024 \ --num-prompts 7168 \ --random-input-len 3584 \ --random-output-len 1536 \ --random-range-ratio 1 \ --seed 1 ``` ### 深层Seek - R1 W8A8 2P1D 32P IN3K5 OUT1K 19.0ms (英语). **型号**: DeepSeek - R1 (英语). **硬件**: A3系列产品. **纸牌**: 32 **部署模式**: PD 分类 **量化**: W8A8 INT8 **数据集**: 3.5k+1k **TPOT**: 19.0ms (英语). #### 示范部署 命令 ``` # ============================================================ # Before running, update the following variables: # P_IP: prefill node IP address # D_IP: decode node IP address # ASCEND_MF_STORE_URL: prefill node IP with port # MODEL_PATH: path to the model weights directory # HCCL_SOCKET_IFNAME: network interface name for HCCL # GLOO_SOCKET_IFNAME: network interface name for Gloo # ============================================================ 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 unset https_proxy unset http_proxy unset HTTPS_PROXY unset HTTP_PROXY unset ASCEND_LAUNCH_BLOCKING source /usr/local/Ascend/ascend-toolkit/set_env.sh source /usr/local/Ascend/nnal/atb/set_env.sh export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True export SGLANG_NPU_USE_MLAPO=1 export SGLANG_SET_CPU_AFFINITY=1 export SGLANG_USE_FIA_NZ=1 export STREAMS_PER_DEVICE=32 P_IP=('<your prefill ip1>' '<your prefill ip2>') D_IP=('<your decode ip1>' '<your decode ip2>') export ASCEND_MF_STORE_URL="tcp://<your prefill ip1>:24670" MODEL_PATH=/path/to/model-weights LOCAL_HOST1=`hostname -I|awk -F " " '{print$1}'` LOCAL_HOST2=`hostname -I|awk -F " " '{print$2}'` echo "${LOCAL_HOST1}" echo "${LOCAL_HOST2}" # prefill for i in "${!P_IP[@]}"; do if [[ "$LOCAL_HOST1" == "${P_IP[$i]}" || "$LOCAL_HOST2" == "${P_IP[$i]}" ]]; then echo "${P_IP[$i]}" export DEEPEP_HCCL_BUFFSIZE=1536 export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 export GLOO_SOCKET_IFNAME=<network-interface> export HCCL_SOCKET_IFNAME=<network-interface> export TASK_QUEUE_ENABLE=2 python3 -m sglang.launch_server \ --model-path ${MODEL_PATH} \ --disaggregation-mode prefill \ --host ${P_IP[$i]} \ --port 8000 \ --disaggregation-bootstrap-port $((8998 + $i)) \ --node-rank 0 \ --nnodes 1 \ --tp-size 16 \ --mem-fraction-static 0.81 \ --quantization modelslim \ --max-running-requests 4 \ --context-length 8192 \ --disable-radix-cache \ --chunked-prefill-size -1 \ --max-prefill-tokens 28680 \ --moe-a2a-backend deepep \ --deepep-mode normal \ --speculative-algorithm NEXTN \ --speculative-num-steps 1 \ --speculative-eagle-topk 1 \ --speculative-num-draft-tokens 2 \ --enable-dp-attention --dp-size 2 \ --disable-shared-experts-fusion \ --dtype bfloat16 \ --enable-attn-tp-input-scattered \ --reasoning-parser deepseek-r1 \ --tool-call-parser deepseekv3 \ --disaggregation-transfer-backend ascend \ --trust-remote-code \ --attention-backend ascend \ --device npu break fi done # decode for i in "${!D_IP[@]}"; do if [[ "$LOCAL_HOST1" == "${D_IP[$i]}" || "$LOCAL_HOST2" == "${D_IP[$i]}" ]]; then echo "${D_IP[$i]}" export DEEPEP_HCCL_BUFFSIZE=650 export GLOO_SOCKET_IFNAME=<network-interface> export HCCL_SOCKET_IFNAME=<network-interface> export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=12 export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 export SGLANG_SCHEDULER_SKIP_ALL_GATHER=1 export TASK_QUEUE_ENABLE=1 python3 -m sglang.launch_server \ --model-path ${MODEL_PATH} \ --disaggregation-mode decode \ --host ${D_IP[$i]} \ --port 8001 \ --dist-init-addr ${D_IP[0]}:5000 \ --node-rank $i \ --nnodes 2 \ --tp-size 32 \ --enable-dp-attention --dp-size 16 \ --mem-fraction-static 0.75 \ --max-running-requests 32 \ --quantization modelslim \ --moe-a2a-backend deepep \ --deepep-mode low_latency \ --enable-dp-lm-head \ --moe-dense-tp 1 \ --cuda-graph-bs-decode 2 4 6 \ --watchdog-timeout 9000 \ --context-length 8192 \ --speculative-algorithm NEXTN \ --speculative-num-steps 3 \ --speculative-eagle-topk 1 \ --speculative-num-draft-tokens 4 \ --tokenizer-worker-num 4 \ --disable-shared-experts-fusion \ --dtype bfloat16 \ --load-balance-method round_robin \ --reasoning-parser deepseek-r1 \ --tool-call-parser deepseekv3 \ --disaggregation-transfer-backend ascend \ --trust-remote-code \ --attention-backend ascend \ --device npu break fi done ``` 命令 ``` # ============================================================ # Before running, replace the following placeholders: # <your prefill ip1>, <your prefill ip2>: prefill node IP addresses # <your decode ip1>: first decode node IP address (decode may have distributed nodes) # /path/to/model-weights: the MODEL_PATH the workers were launched with # ============================================================ sgl-router \ --model-id /path/to/model-weights \ --no-tokenizer \ --worker-urls \ http://<your prefill ip1>:8000 \ http://<your prefill ip2>:8000 \ http://<your decode ip1>:8001 \ --host 127.0.0.1 \ --port 6688 ``` #### 基准 我们测试它基于 `RANDOM` 数据集。 命令 ``` python -m sglang.benchmark.serving \ --dataset-name random \ --backend sglang \ --host 127.0.0.1 \ --port 6688 \ --request-rate 16 \ --max-concurrency 32 \ --num-prompts 32 \ --random-input-len 3500 \ --random-output-len 1024 \ --random-range-ratio 1 \ --seed 1 ``` ### 深层Seek - R1 W8A8 2P1D 32P IN3K9 OUT1K 19.0ms (英语). **型号**: DeepSeek - R1 (英语). **硬件**: A3系列产品. **纸牌**: 32 **部署模式**: PD 分类 **量化**: W8A8 INT8 **数据集**: 3.9k+1k **TPOT**: 19.0ms (英语). #### 示范部署 命令 ``` # ============================================================ # Before running, update the following variables: # P_IP: prefill node IP address # D_IP: decode node IP address # ASCEND_MF_STORE_URL: prefill node IP with port # MODEL_PATH: path to the model weights directory # HCCL_SOCKET_IFNAME: network interface name for HCCL # GLOO_SOCKET_IFNAME: network interface name for Gloo # ============================================================ 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 unset https_proxy unset http_proxy unset HTTPS_PROXY unset HTTP_PROXY unset ASCEND_LAUNCH_BLOCKING source /usr/local/Ascend/ascend-toolkit/set_env.sh source /usr/local/Ascend/nnal/atb/set_env.sh export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True export SGLANG_NPU_USE_MLAPO=1 export SGLANG_SET_CPU_AFFINITY=1 export SGLANG_USE_FIA_NZ=1 export STREAMS_PER_DEVICE=32 P_IP=('<your prefill ip1>' '<your prefill ip2>') D_IP=('<your decode ip1>' '<your decode ip2>') export ASCEND_MF_STORE_URL="tcp://<your prefill ip1>:24670" MODEL_PATH=/path/to/model-weights LOCAL_HOST1=`hostname -I|awk -F " " '{print$1}'` LOCAL_HOST2=`hostname -I|awk -F " " '{print$2}'` echo "${LOCAL_HOST1}" echo "${LOCAL_HOST2}" # prefill for i in "${!P_IP[@]}"; do if [[ "$LOCAL_HOST1" == "${P_IP[$i]}" || "$LOCAL_HOST2" == "${P_IP[$i]}" ]]; then echo "${P_IP[$i]}" export DEEPEP_HCCL_BUFFSIZE=1536 export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 export GLOO_SOCKET_IFNAME=<network-interface> export HCCL_SOCKET_IFNAME=<network-interface> export TASK_QUEUE_ENABLE=2 python3 -m sglang.launch_server \ --model-path ${MODEL_PATH} \ --disaggregation-mode prefill \ --host ${P_IP[$i]} \ --port 8000 \ --disaggregation-bootstrap-port $((8998 + $i)) \ --node-rank 0 \ --nnodes 1 \ --tp-size 16 \ --mem-fraction-static 0.81 \ --quantization modelslim \ --max-running-requests 4 \ --context-length 8192 \ --disable-radix-cache \ --chunked-prefill-size -1 \ --max-prefill-tokens 28680 \ --moe-a2a-backend deepep \ --deepep-mode normal \ --speculative-algorithm NEXTN \ --speculative-num-steps 1 \ --speculative-eagle-topk 1 \ --speculative-num-draft-tokens 2 \ --enable-dp-attention --dp-size 2 \ --disable-shared-experts-fusion \ --dtype bfloat16 \ --enable-attn-tp-input-scattered \ --reasoning-parser deepseek-r1 \ --tool-call-parser deepseekv3 \ --disaggregation-transfer-backend ascend \ --trust-remote-code \ --attention-backend ascend \ --device npu break fi done # decode for i in "${!D_IP[@]}"; do if [[ "$LOCAL_HOST1" == "${D_IP[$i]}" || "$LOCAL_HOST2" == "${D_IP[$i]}" ]]; then echo "${D_IP[$i]}" export DEEPEP_HCCL_BUFFSIZE=650 export GLOO_SOCKET_IFNAME=<network-interface> export HCCL_SOCKET_IFNAME=<network-interface> export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=12 export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 export SGLANG_SCHEDULER_SKIP_ALL_GATHER=1 export TASK_QUEUE_ENABLE=1 python3 -m sglang.launch_server \ --model-path ${MODEL_PATH} \ --disaggregation-mode decode \ --host ${D_IP[$i]} \ --port 8001 \ --dist-init-addr ${D_IP[0]}:5000 \ --node-rank $i \ --nnodes 2 \ --tp-size 32 \ --enable-dp-attention --dp-size 16 \ --mem-fraction-static 0.75 \ --max-running-requests 32 \ --quantization modelslim \ --moe-a2a-backend deepep \ --deepep-mode low_latency \ --enable-dp-lm-head \ --moe-dense-tp 1 \ --cuda-graph-bs-decode 2 4 6 \ --watchdog-timeout 9000 \ --context-length 8192 \ --speculative-algorithm NEXTN \ --speculative-num-steps 3 \ --speculative-eagle-topk 1 \ --speculative-num-draft-tokens 4 \ --tokenizer-worker-num 4 \ --disable-shared-experts-fusion \ --dtype bfloat16 \ --load-balance-method round_robin \ --reasoning-parser deepseek-r1 \ --tool-call-parser deepseekv3 \ --disaggregation-transfer-backend ascend \ --trust-remote-code \ --attention-backend ascend \ --device npu break fi done ``` 命令 ``` # ============================================================ # Before running, replace the following placeholders: # <your prefill ip1>, <your prefill ip2>: prefill node IP addresses # <your decode ip1>: first decode node IP address (decode may have distributed nodes) # /path/to/model-weights: the MODEL_PATH the workers were launched with # ============================================================ sgl-router \ --model-id /path/to/model-weights \ --no-tokenizer \ --worker-urls \ http://<your prefill ip1>:8000 \ http://<your prefill ip2>:8000 \ http://<your decode ip1>:8001 \ --host 127.0.0.1 \ --port 6688 ``` #### 基准 我们测试它基于 `RANDOM` 数据集。 命令 ``` python -m sglang.benchmark.serving \ --dataset-name random \ --backend sglang \ --host 127.0.0.1 \ --port 6688 \ --request-rate 16 \ --max-concurrency 32 \ --num-prompts 32 \ --random-input-len 3900 \ --random-output-len 1024 \ --random-range-ratio 1 \ --seed 1 ``` ### 深层Seek - R1 W8A8 2P1D 32P IN6K OUT1K6 20.5ms **型号**: DeepSeek - R1 (英语). **硬件**: A3系列产品. **纸牌**: 32 **部署模式**: PD 分类 **量化**: W8A8 INT8 **数据集**: 6k+1.6k **TPOT**: 20.5ms (单位:千米) #### 示范部署 命令 ``` # ============================================================ # Before running, update the following variables: # P_IP: prefill node IP address # D_IP: decode node IP address # ASCEND_MF_STORE_URL: prefill node IP with port # MODEL_PATH: path to the model weights directory # HCCL_SOCKET_IFNAME: network interface name for HCCL # GLOO_SOCKET_IFNAME: network interface name for Gloo # ============================================================ 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 unset https_proxy unset http_proxy unset HTTPS_PROXY unset HTTP_PROXY unset ASCEND_LAUNCH_BLOCKING source /usr/local/Ascend/ascend-toolkit/set_env.sh source /usr/local/Ascend/nnal/atb/set_env.sh export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True export SGLANG_NPU_USE_MLAPO=1 export SGLANG_SET_CPU_AFFINITY=1 export SGLANG_USE_FIA_NZ=1 export STREAMS_PER_DEVICE=32 P_IP=('<your prefill ip1>' '<your prefill ip2>') D_IP=('<your decode ip1>' '<your decode ip2>') export ASCEND_MF_STORE_URL="tcp://<your prefill ip1>:24670" MODEL_PATH=/path/to/model-weights LOCAL_HOST1=`hostname -I|awk -F " " '{print$1}'` LOCAL_HOST2=`hostname -I|awk -F " " '{print$2}'` echo "${LOCAL_HOST1}" echo "${LOCAL_HOST2}" # prefill for i in "${!P_IP[@]}"; do if [[ "$LOCAL_HOST1" == "${P_IP[$i]}" || "$LOCAL_HOST2" == "${P_IP[$i]}" ]]; then echo "${P_IP[$i]}" export DEEPEP_HCCL_BUFFSIZE=1536 export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 export GLOO_SOCKET_IFNAME=<network-interface> export HCCL_SOCKET_IFNAME=<network-interface> export TASK_QUEUE_ENABLE=2 python3 -m sglang.launch_server \ --model-path ${MODEL_PATH} \ --disaggregation-mode prefill \ --host ${P_IP[$i]} \ --port 8000 \ --disaggregation-bootstrap-port $((8998 + $i)) \ --node-rank 0 \ --nnodes 1 \ --tp-size 16 \ --mem-fraction-static 0.81 \ --quantization modelslim \ --max-running-requests 4 \ --disable-radix-cache \ --chunked-prefill-size -1 \ --max-prefill-tokens 28680 \ --moe-a2a-backend deepep \ --deepep-mode normal \ --speculative-algorithm NEXTN \ --speculative-num-steps 1 \ --speculative-eagle-topk 1 \ --speculative-num-draft-tokens 2 \ --enable-dp-attention --dp-size 2 \ --disable-shared-experts-fusion \ --dtype bfloat16 \ --enable-attn-tp-input-scattered \ --reasoning-parser deepseek-r1 \ --tool-call-parser deepseekv3 \ --disaggregation-transfer-backend ascend \ --trust-remote-code \ --attention-backend ascend \ --device npu break fi done # decode for i in "${!D_IP[@]}"; do if [[ "$LOCAL_HOST1" == "${D_IP[$i]}" || "$LOCAL_HOST2" == "${D_IP[$i]}" ]]; then echo "${D_IP[$i]}" export DEEPEP_HCCL_BUFFSIZE=650 export GLOO_SOCKET_IFNAME=<network-interface> export HCCL_SOCKET_IFNAME=<network-interface> export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=16 export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 export SGLANG_SCHEDULER_SKIP_ALL_GATHER=1 export TASK_QUEUE_ENABLE=1 python3 -m sglang.launch_server \ --model-path ${MODEL_PATH} \ --disaggregation-mode decode \ --host ${D_IP[$i]} \ --port 8001 \ --dist-init-addr ${D_IP[0]}:5000 \ --node-rank $i \ --nnodes 2 \ --tp-size 32 \ --enable-dp-attention --dp-size 8 \ --mem-fraction-static 0.75 \ --max-running-requests 32 \ --quantization modelslim \ --moe-a2a-backend deepep \ --deepep-mode low_latency \ --enable-dp-lm-head \ --moe-dense-tp 1 \ --cuda-graph-bs-decode 2 4 6 \ --watchdog-timeout 9000 \ --speculative-algorithm NEXTN \ --speculative-num-steps 3 \ --speculative-eagle-topk 1 \ --speculative-num-draft-tokens 4 \ --tokenizer-worker-num 4 \ --disable-shared-experts-fusion \ --dtype bfloat16 \ --load-balance-method round_robin \ --reasoning-parser deepseek-r1 \ --tool-call-parser deepseekv3 \ --disaggregation-transfer-backend ascend \ --trust-remote-code \ --attention-backend ascend \ --device npu break fi done ``` 命令 ``` # ============================================================ # Before running, replace the following placeholders: # <your prefill ip1>, <your prefill ip2>: prefill node IP addresses # <your decode ip1>: first decode node IP address (decode may have distributed nodes) # /path/to/model-weights: the MODEL_PATH the workers were launched with # ============================================================ sgl-router \ --model-id /path/to/model-weights \ --no-tokenizer \ --worker-urls \ http://<your prefill ip1>:8000 \ http://<your prefill ip2>:8000 \ http://<your decode ip1>:8001 \ --host 127.0.0.1 \ --port 6688 ``` #### 基准 我们测试它基于 `RANDOM` 数据集。 命令 ``` python -m sglang.benchmark.serving \ --dataset-name random \ --backend sglang \ --host 127.0.0.1 \ --port 6688 \ --request-rate 16 \ --max-concurrency 32 \ --num-prompts 32 \ --random-input-len 6000 \ --random-output-len 1600 \ --random-range-ratio 1 \ --seed 1 ``` 这页有用吗?

查看原始来源