diff --git a/docs_new/docs.json b/docs_new/docs.json index 4c960ea21..a084438d0 100644 --- a/docs_new/docs.json +++ b/docs_new/docs.json @@ -885,6 +885,24 @@ "docs/hardware-platforms/ascend-npus/ascend_contribution_guide", "docs/hardware-platforms/ascend-npus/ascend_npu_support_new_models", "docs/hardware-platforms/ascend-npus/ascend_npu_best_practice", + { + "group": "Best Practice", + "pages": [ + "docs/hardware-platforms/ascend-npus/best_practice/deepseek_r1", + "docs/hardware-platforms/ascend-npus/best_practice/deepseek_v3_2", + "docs/hardware-platforms/ascend-npus/best_practice/glm5_1", + "docs/hardware-platforms/ascend-npus/best_practice/kimi_k2_6", + "docs/hardware-platforms/ascend-npus/best_practice/minimax_m2_5", + "docs/hardware-platforms/ascend-npus/best_practice/qwen3-8b", + "docs/hardware-platforms/ascend-npus/best_practice/qwen3_32b", + "docs/hardware-platforms/ascend-npus/best_practice/qwen3_30b_a3b", + "docs/hardware-platforms/ascend-npus/best_practice/qwen3_235b_a22b", + "docs/hardware-platforms/ascend-npus/best_practice/qwen3_5_397b", + "docs/hardware-platforms/ascend-npus/best_practice/qwen3_6_27b", + "docs/hardware-platforms/ascend-npus/best_practice/qwen3_6_35b_a3b", + "docs/hardware-platforms/ascend-npus/best_practice/qwen3_next_80b_a3b_instruct" + ] + }, "docs/hardware-platforms/ascend-npus/ascend_npu_optimization", "docs/hardware-platforms/ascend-npus/ascend_npu_accuracy_evaluation", "docs/hardware-platforms/ascend-npus/ascend_npu_performance_testing", diff --git a/docs_new/docs/hardware-platforms/ascend-npus/best_practice/deepseek_r1.mdx b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/deepseek_r1.mdx new file mode 100644 index 000000000..ec5aa42d2 --- /dev/null +++ b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/deepseek_r1.mdx @@ -0,0 +1,1282 @@ +--- +title: "DeepSeek-R1" +metatags: + description: "Best Practice for DeepSeek-R1 on Ascend NPU" +--- + +This guide describes the best practice data for DeepSeek-R1 on the Ascend NPU. + +### Low Latency + +| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration | +| --- | --- | --- | --- | --- | --- | --- | --- | +| DeepSeek-R1 | Atlas 800I A3 | 32 | PD Disaggregation | 3.5K+1.5K | 18.9ms | W8A8 INT8 | [Optimal Configuration](#deepseek-r1-w8a8-2p1d-32p-in3k5-out1k5-18-9ms) | +| DeepSeek-R1 | Atlas 800I A3 | 32 | PD Disaggregation | 3.5K+1K | 19.0ms | W8A8 INT8 | [Optimal Configuration](#deepseek-r1-w8a8-2p1d-32p-in3k5-out1k-19-0ms) | +| DeepSeek-R1 | Atlas 800I A3 | 32 | PD Disaggregation | 3.9K+1K | 19.0ms | W8A8 INT8 | [Optimal Configuration](#deepseek-r1-w8a8-2p1d-32p-in3k9-out1k-19-0ms) | +| DeepSeek-R1 | Atlas 800I A3 | 32 | PD Disaggregation | 6K+1.6K | 20.5ms | W8A8 INT8 | [Optimal Configuration](#deepseek-r1-w8a8-2p1d-32p-in6k-out1k6-20-5ms) | + +### High Throughput + +| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration | +| --- | --- | --- | --- | --- | --- | --- | --- | +| DeepSeek-R1 | Atlas 800I A3 | 16 | PD Disaggregation | 3.5K+1.5K | 41ms | W4A8 INT8 | [Optimal Configuration](#deepseek-r1-w4a8-1p1d-16p-in3k5-out1k5-41ms) | +| DeepSeek-R1 | Atlas 800I A3 | 8 | PD Mixed | 3.5K+1.5K | 50.36ms | W4A8 INT8 | [Optimal Configuration](#deepseek-r1-w4a8-8p-in3k5-out1k5-50-36ms) | +| DeepSeek-R1 | Atlas 800I A3 | 32 | PD Disaggregation | 3.5K+1.5K | 50ms | W8A8 INT8 | [Optimal Configuration](#deepseek-r1-w8a8-2p1d-32p-in3k5-out1k5-50ms) | + + +## Optimal Configuration + +### DeepSeek-R1 W4A8 1P1D 16P IN3K5 OUT1K5 41ms + +**Model**: DeepSeek-R1 + +**Hardware**: Atlas 800I A3 + +**Cards**: 16 + +**Deploy Mode**: PD Disaggregation + +**Quantization**: W4A8 INT8 + +**Dataset**: 3.5K+1.5K + +**TPOT**: 41ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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=('') +D_IP=('') + +export ASCEND_MF_STORE_URL="tcp://: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 DEEP_NORMAL_MODE_USE_INT8_QUANT=1 + export GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=3500 + export HCCL_SOCKET_IFNAME= + 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.62 \ + --quantization modelslim \ + --max-running-requests 32 \ + --context-length 8192 \ + --disable-radix-cache \ + --chunked-prefill-size -1 \ + --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 \ + --dp-size 8 \ + --enable-dp-attention \ + --disable-shared-experts-fusion \ + --dtype bfloat16 + NODE_RANK=$i + 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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=800 + export HCCL_SOCKET_IFNAME= + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=78 + export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 + export SGLANG_ENABLE_SPEC_V2=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 \ + --dp-size 16 \ + --mem-fraction-static 0.805 \ + --max-running-requests 416 \ + --quantization modelslim \ + --moe-a2a-backend deepep \ + --enable-dp-attention \ + --deepep-mode low_latency \ + --enable-dp-lm-head \ + --cuda-graph-bs 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 \ + --prefill-round-robin-balance \ + --disable-shared-experts-fusion \ + --dtype bfloat16 \ + --tokenizer-worker-num 4 \ + --load-balance-method round_robin + NODE_RANK=$i + break + fi +done +``` + +```shell Command +# ============================================================ +# Before running, replace the following placeholders: +# : prefill node IP address +# : decode node IP address +# ============================================================ + +python -m sglang_router.launch_router \ + --pd-disaggregation \ + --policy cache_aware \ + --prefill http://:8000 8998 \ + --decode http://:8001 \ + --host 127.0.0.1 \ + --port 6688 \ +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 416 \ + --random-input-len 3584 \ + --random-output-len 1536 \ + --num-prompts 1664 \ + --random-range-ratio 1 \ + --request-rate 24 +``` + +### DeepSeek-R1 W4A8 8P IN3K5 OUT1K5 50.36ms + +**Model**: DeepSeek-R1 + +**Hardware**: Atlas 800I A3 + +**Cards**: 8 + +**Deploy Mode**: PD Mixed + +**Quantization**: W4A8 INT8 + +**Dataset**: 3.5K+1.5K + +**TPOT**: 50.36ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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_NORMAL_LONG_SEQ_PER_ROUND_TOKENS=512 +export DEEPEP_NORMAL_LONG_SEQ_ROUND=10 +export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=1200 +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=56 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_NPU_USE_MLAPO=1 +export SGLANG_PREFILL_DELAYER_MAX_DELAY_PASSES=200 +export SGLANG_SCHEDULER_DECREASE_PREFILL_IDLE=1 +export SGLANG_USE_FIA_NZ=1 +export STREAMS_PER_DEVICE=32 + +python3 -m sglang.launch_server \ + --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 4 8 12 14 \ + --mem-fraction-static 0.77 \ + --max-running-requests 224 \ + --context-length 8188 \ + --disable-radix-cache \ + --chunked-prefill-size -1 \ + --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 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 224 \ + --random-input-len 3500 \ + --random-output-len 1500 \ + --num-prompts 896 \ + --random-range-ratio 1 +``` + +### DeepSeek-R1 W8A8 2P1D 32P IN3K5 OUT1K5 18.9ms + +**Model**: DeepSeek-R1 + +**Hardware**: Atlas 800I A3 + +**Cards**: 32 + +**Deploy Mode**: PD Disaggregation + +**Quantization**: W8A8 INT8 + +**Dataset**: 3.5K+1.5K + +**TPOT**: 18.9ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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=('' '') +D_IP=('' '') + +export ASCEND_MF_STORE_URL="tcp://: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 DEEP_NORMAL_MODE_USE_INT8_QUANT=1 + export GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=1536 + export HCCL_SOCKET_IFNAME= + 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 \ + --dp-size 2 \ + --enable-dp-attention \ + --disable-shared-experts-fusion \ + --dtype bfloat16 \ + --enable-attn-tp-input-scattered + NODE_RANK=$i + 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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=650 + export HCCL_SOCKET_IFNAME= + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=12 + export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 + export SGLANG_ENABLE_SPEC_V2=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 \ + --dp-size 16 \ + --mem-fraction-static 0.75 \ + --max-running-requests 32 \ + --quantization modelslim \ + --moe-a2a-backend deepep \ + --enable-dp-attention \ + --deepep-mode low_latency \ + --enable-dp-lm-head \ + --moe-dense-tp 1 \ + --cuda-graph-bs 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 \ + --prefill-round-robin-balance \ + --disable-shared-experts-fusion \ + --dtype bfloat16 \ + --load-balance-method round_robin + NODE_RANK=$i + break + fi +done +``` + +```shell Command +# ============================================================ +# Before running, replace the following placeholders: +# , : prefill node IP addresses +# : first decode node IP address (decode may have distributed nodes) +# ============================================================ + +export SGLANG_DP_ROUND_ROBIN=1 +python -m sglang_router.launch_router \ + --pd-disaggregation \ + --policy cache_aware \ + --prefill http://:8000 8998 \ + --prefill http://:8000 8999 \ + --decode http://:8001 \ + --host 127.0.0.1 \ + --port 6688 \ + --mini-lb +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 32 \ + --random-input-len 3500 \ + --random-output-len 1500 \ + --num-prompts 32 \ + --random-range-ratio 1 \ + --request-rate 16 +``` + +### DeepSeek-R1 W8A8 2P1D 32P IN3K5 OUT1K5 50ms + +**Model**: DeepSeek-R1 + +**Hardware**: Atlas 800I A3 + +**Cards**: 32 + +**Deploy Mode**: PD Disaggregation + +**Quantization**: W8A8 INT8 + +**Dataset**: 3.5K+1.5K + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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=('' '') +D_IP=('' '') + +export ASCEND_MF_STORE_URL="tcp://: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 DEEP_NORMAL_MODE_USE_INT8_QUANT=1 + export GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=800 + export HCCL_SOCKET_IFNAME= + 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 \ + --dp-size 4 \ + --enable-dp-attention \ + --disable-shared-experts-fusion \ + --dtype bfloat16 \ + --enable-attn-tp-input-scattered + NODE_RANK=$i + 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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=600 + export HCCL_SOCKET_IFNAME= + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=64 + export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 + export SGLANG_ENABLE_SPEC_V2=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 \ + --dp-size 32 \ + --mem-fraction-static 0.82 \ + --max-running-requests 1024 \ + --quantization modelslim \ + --moe-a2a-backend ascend_fuseep \ + --enable-dp-attention \ + --deepep-mode low_latency \ + --moe-dense-tp 1 \ + --cuda-graph-bs 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 \ + --prefill-round-robin-balance \ + --disable-shared-experts-fusion \ + --dtype bfloat16 \ + --load-balance-method round_robin + NODE_RANK=$i + break + fi +done +``` + +```shell Command +# ============================================================ +# Before running, replace the following placeholders: +# , : prefill node IP addresses +# : first decode node IP address (decode may have distributed nodes) +# ============================================================ + +export SGLANG_DP_ROUND_ROBIN=1 +python -m sglang_router.launch_router \ + --pd-disaggregation \ + --policy cache_aware \ + --prefill http://:8000 8998 \ + --prefill http://:8000 8999 \ + --decode http://:8001 \ + --host 127.0.0.1 \ + --port 6688 \ + --mini-lb +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 1024 \ + --random-input-len 3584 \ + --random-output-len 1536 \ + --num-prompts 7168 \ + --random-range-ratio 1 \ + --request-rate 40 +``` + +### DeepSeek-R1 W8A8 2P1D 32P IN3K5 OUT1K 19.0ms + +**Model**: DeepSeek-R1 + +**Hardware**: Atlas 800I A3 + +**Cards**: 32 + +**Deploy Mode**: PD Disaggregation + +**Quantization**: W8A8 INT8 + +**Dataset**: 3.5K+1K + +**TPOT**: 19.0ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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=('' '') +D_IP=('' '') + +export ASCEND_MF_STORE_URL="tcp://: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 DEEP_NORMAL_MODE_USE_INT8_QUANT=1 + export GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=1536 + export HCCL_SOCKET_IFNAME= + 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 \ + --dp-size 2 \ + --enable-dp-attention \ + --disable-shared-experts-fusion \ + --dtype bfloat16 \ + --enable-attn-tp-input-scattered + NODE_RANK=$i + 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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=650 + export HCCL_SOCKET_IFNAME= + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=12 + export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 + export SGLANG_ENABLE_SPEC_V2=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 \ + --dp-size 16 \ + --mem-fraction-static 0.75 \ + --max-running-requests 32 \ + --quantization modelslim \ + --moe-a2a-backend deepep \ + --enable-dp-attention \ + --deepep-mode low_latency \ + --enable-dp-lm-head \ + --moe-dense-tp 1 \ + --cuda-graph-bs 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 \ + --prefill-round-robin-balance \ + --disable-shared-experts-fusion \ + --dtype bfloat16 \ + --load-balance-method round_robin + NODE_RANK=$i + break + fi +done +``` + +```shell Command +# ============================================================ +# Before running, replace the following placeholders: +# , : prefill node IP addresses +# : first decode node IP address (decode may have distributed nodes) +# ============================================================ + +export SGLANG_DP_ROUND_ROBIN=1 +python -m sglang_router.launch_router \ + --pd-disaggregation \ + --policy cache_aware \ + --prefill http://:8000 8998 \ + --prefill http://:8000 8999 \ + --decode http://:8001 \ + --host 127.0.0.1 \ + --port 6688 \ + --mini-lb +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 32 \ + --random-input-len 3500 \ + --random-output-len 1024 \ + --num-prompts 32 \ + --random-range-ratio 1 \ + --request-rate 16 +``` + +### DeepSeek-R1 W8A8 2P1D 32P IN3K9 OUT1K 19.0ms + +**Model**: DeepSeek-R1 + +**Hardware**: Atlas 800I A3 + +**Cards**: 32 + +**Deploy Mode**: PD Disaggregation + +**Quantization**: W8A8 INT8 + +**Dataset**: 3.9K+1K + +**TPOT**: 19.0ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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=('' '') +D_IP=('' '') + +export ASCEND_MF_STORE_URL="tcp://: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 DEEP_NORMAL_MODE_USE_INT8_QUANT=1 + export GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=1536 + export HCCL_SOCKET_IFNAME= + 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 \ + --dp-size 2 \ + --enable-dp-attention \ + --disable-shared-experts-fusion \ + --dtype bfloat16 \ + --enable-attn-tp-input-scattered + NODE_RANK=$i + 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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=650 + export HCCL_SOCKET_IFNAME= + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=12 + export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 + export SGLANG_ENABLE_SPEC_V2=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 \ + --dp-size 16 \ + --mem-fraction-static 0.75 \ + --max-running-requests 32 \ + --quantization modelslim \ + --moe-a2a-backend deepep \ + --enable-dp-attention \ + --deepep-mode low_latency \ + --enable-dp-lm-head \ + --moe-dense-tp 1 \ + --cuda-graph-bs 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 \ + --prefill-round-robin-balance \ + --disable-shared-experts-fusion \ + --dtype bfloat16 \ + --load-balance-method round_robin + NODE_RANK=$i + break + fi +done +``` + +```shell Command +# ============================================================ +# Before running, replace the following placeholders: +# , : prefill node IP addresses +# : first decode node IP address (decode may have distributed nodes) +# ============================================================ + +export SGLANG_DP_ROUND_ROBIN=1 +python -m sglang_router.launch_router \ + --pd-disaggregation \ + --policy cache_aware \ + --prefill http://:8000 8998 \ + --prefill http://:8000 8999 \ + --decode http://:8001 \ + --host 127.0.0.1 \ + --port 6688 \ + --mini-lb +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 32 \ + --random-input-len 3900 \ + --random-output-len 1024 \ + --num-prompts 32 \ + --random-range-ratio 1 \ + --request-rate 16 +``` + +### DeepSeek-R1 W8A8 2P1D 32P IN6K OUT1K6 20.5ms + +**Model**: DeepSeek-R1 + +**Hardware**: Atlas 800I A3 + +**Cards**: 32 + +**Deploy Mode**: PD Disaggregation + +**Quantization**: W8A8 INT8 + +**Dataset**: 6K+1.6K + +**TPOT**: 20.5ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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=('' '') +D_IP=('' '') + +export ASCEND_MF_STORE_URL="tcp://: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 DEEP_NORMAL_MODE_USE_INT8_QUANT=1 + export GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=1536 + export HCCL_SOCKET_IFNAME= + 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 \ + --dp-size 2 \ + --enable-dp-attention \ + --disable-shared-experts-fusion \ + --dtype bfloat16 \ + --enable-attn-tp-input-scattered + NODE_RANK=$i + 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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=650 + export HCCL_SOCKET_IFNAME= + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=16 + export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 + export SGLANG_ENABLE_SPEC_V2=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 \ + --dp-size 8 \ + --mem-fraction-static 0.75 \ + --max-running-requests 32 \ + --quantization modelslim \ + --moe-a2a-backend deepep \ + --enable-dp-attention \ + --deepep-mode low_latency \ + --enable-dp-lm-head \ + --moe-dense-tp 1 \ + --cuda-graph-bs 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 \ + --prefill-round-robin-balance \ + --disable-shared-experts-fusion \ + --dtype bfloat16 \ + --load-balance-method round_robin + NODE_RANK=$i + break + fi +done +``` + +```shell Command +# ============================================================ +# Before running, replace the following placeholders: +# , : prefill node IP addresses +# : first decode node IP address (decode may have distributed nodes) +# ============================================================ + +export SGLANG_DP_ROUND_ROBIN=1 +python -m sglang_router.launch_router \ + --pd-disaggregation \ + --policy cache_aware \ + --prefill http://:8000 8998 \ + --prefill http://:8000 8999 \ + --decode http://:8001 \ + --host 127.0.0.1 \ + --port 6688 \ + --mini-lb +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 32 \ + --random-input-len 6000 \ + --random-output-len 1600 \ + --num-prompts 32 \ + --random-range-ratio 1 \ + --request-rate 16 +``` diff --git a/docs_new/docs/hardware-platforms/ascend-npus/best_practice/deepseek_v3_2.mdx b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/deepseek_v3_2.mdx new file mode 100644 index 000000000..7e2a310ce --- /dev/null +++ b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/deepseek_v3_2.mdx @@ -0,0 +1,590 @@ +--- +title: "DeepSeek-V3.2" +metatags: + description: "Best Practice for DeepSeek-V3.2 on Ascend NPU" +--- + +This guide describes the best practice data for DeepSeek-V3.2 on the Ascend NPU. + +### Low Latency + +| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration | +| --- | --- | --- | --- | --- | --- | --- | --- | +| DeepSeek-V3.2 | Atlas 800I A3 | 32 | PD Disaggregation | 128K+1K | 26ms | W8A8 INT8 | [Optimal Configuration](#deepseek-v3-2-w8a8-1p1d-32p-in128k-out1k-26ms) | +| DeepSeek-V3.2 | Atlas 800I A3 | 32 | PD Disaggregation | 128K+1K | 26ms | W8A8 INT8 | [Optimal Configuration](#deepseek-v3-2-w8a8-1p1d-32p-in128k-out1k-bs8) | + +### High Throughput + +| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration | +| --- | --- | --- | --- | --- | --- | --- | --- | +| DeepSeek-V3.2 | Atlas 800I A3 | 32 | PD Disaggregation | 128K+1K | 107ms | W8A8 INT8 | [Optimal Configuration](#deepseek-v3-2-w8a8-1p1d-32p-in128k-out1k-bs16) | + + +## Optimal Configuration + +### DeepSeek-V3.2 W8A8 1P1D 32P IN128K OUT1K 26ms + +**Model**: DeepSeek-V3.2 + +**Hardware**: Atlas 800I A3 + +**Cards**: 32 + +**Deploy Mode**: PD Disaggregation + +**Quantization**: W8A8 INT8 + +**Dataset**: 128K+1K + +**TPOT**: 26ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +P_IP=('' '') +D_IP=('' '') + +export ASCEND_MF_STORE_URL="tcp://: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 DEEP_NORMAL_MODE_USE_INT8_QUANT=1 + export GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=1200 + export HCCL_SOCKET_IFNAME= + export TASK_QUEUE_ENABLE=2 + + python3 -m sglang.launch_server \ + --model-path ${MODEL_PATH} \ + --disaggregation-mode prefill \ + --host ${P_IP[$i]} \ + --port 8000 \ + --dist-init-addr ${P_IP[0]}:5000 \ + --disaggregation-bootstrap-port 8998 \ + --node-rank $i \ + --nnodes 2 \ + --tp 32 \ + --watchdog-timeout 9000 \ + --mem-fraction-static 0.73 \ + --disable-radix-cache \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 68000 \ + --max-running-requests 1 \ + --moe-a2a-backend deepep \ + --deepep-mode normal \ + --quantization modelslim \ + --disaggregation-transfer-backend ascend \ + --disable-cuda-graph \ + --moe-dense-tp-size 1 \ + --enable-nsa-prefill-context-parallel \ + --nsa-prefill-cp-mode in-seq-split \ + --attn-cp-size 32 \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 1 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 2 + NODE_RANK=$i + 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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=400 + export HCCL_SOCKET_IFNAME= + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=8 + export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 + export SGLANG_ENABLE_SPEC_V2=1 + export SGLANG_SCHEDULER_SKIP_ALL_GATHER=1 + export TASK_QUEUE_ENABLE=0 + + 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 32 \ + --dp 8 \ + --ep 32 \ + --moe-dense-tp-size 1 \ + --enable-dp-attention \ + --enable-dp-lm-head \ + --watchdog-timeout 9000 \ + --mem-fraction-static 0.79 \ + --disable-radix-cache \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 68000 \ + --max-running-requests 32 \ + --cuda-graph-max-bs 4 \ + --moe-a2a-backend deepep \ + --deepep-mode low_latency \ + --quantization modelslim \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --disaggregation-transfer-backend ascend + NODE_RANK=$i + break + fi +done +``` + +```shell Command +# ============================================================ +# Before running, replace the following placeholders: +# : prefill node IP address +# : first decode node IP address (decode may have distributed nodes) +# ============================================================ + +python -m sglang_router.launch_router \ + --pd-disaggregation \ + --policy cache_aware \ + --prefill http://:8000 8998 \ + --decode http://:8001 \ + --host 127.0.0.1 \ + --port 6688 \ + --mini-lb +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 8 \ + --random-input-len 131072 \ + --random-output-len 1024 \ + --num-prompts 8 \ + --random-range-ratio 1 +``` + +### DeepSeek-V3.2 W8A8 1P1D 32P IN128K OUT1K BS16 + +**Model**: DeepSeek-V3.2 + +**Hardware**: Atlas 800I A3 + +**Cards**: 32 + +**Deploy Mode**: PD Disaggregation + +**Quantization**: W8A8 INT8 + +**Dataset**: 128K+1K + +**TPOT**: 107ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +P_IP=('' '') +D_IP=('' '') + +export ASCEND_MF_STORE_URL="tcp://: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 DEEP_NORMAL_MODE_USE_INT8_QUANT=1 + export GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=1200 + export HCCL_SOCKET_IFNAME= + export TASK_QUEUE_ENABLE=2 + + python3 -m sglang.launch_server \ + --model-path ${MODEL_PATH} \ + --disaggregation-mode prefill \ + --host ${P_IP[$i]} \ + --port 8000 \ + --dist-init-addr ${P_IP[0]}:5000 \ + --disaggregation-bootstrap-port 8998 \ + --node-rank $i \ + --nnodes 2 \ + --tp 32 \ + --watchdog-timeout 9000 \ + --mem-fraction-static 0.73 \ + --disable-radix-cache \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 68000 \ + --max-running-requests 1 \ + --moe-a2a-backend deepep \ + --deepep-mode normal \ + --quantization modelslim \ + --disaggregation-transfer-backend ascend \ + --disable-cuda-graph \ + --moe-dense-tp-size 1 \ + --enable-nsa-prefill-context-parallel \ + --nsa-prefill-cp-mode in-seq-split \ + --attn-cp-size 32 \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 1 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 2 + NODE_RANK=$i + 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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=400 + export HCCL_SOCKET_IFNAME= + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=8 + export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 + export SGLANG_ENABLE_SPEC_V2=1 + export SGLANG_SCHEDULER_SKIP_ALL_GATHER=1 + export TASK_QUEUE_ENABLE=0 + + 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 32 \ + --dp 8 \ + --ep 32 \ + --moe-dense-tp-size 1 \ + --enable-dp-attention \ + --enable-dp-lm-head \ + --watchdog-timeout 9000 \ + --mem-fraction-static 0.79 \ + --disable-radix-cache \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 68000 \ + --max-running-requests 32 \ + --cuda-graph-max-bs 4 \ + --moe-a2a-backend deepep \ + --deepep-mode low_latency \ + --quantization modelslim \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --disaggregation-transfer-backend ascend + NODE_RANK=$i + break + fi +done +``` + +```shell Command +# ============================================================ +# Before running, replace the following placeholders: +# : prefill node IP address +# : first decode node IP address (decode may have distributed nodes) +# ============================================================ + +python -m sglang_router.launch_router \ + --pd-disaggregation \ + --policy cache_aware \ + --prefill http://:8000 8998 \ + --decode http://:8001 \ + --host 127.0.0.1 \ + --port 6688 \ + --mini-lb +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 16 \ + --random-input-len 131072 \ + --random-output-len 1024 \ + --num-prompts 16 \ + --random-range-ratio 1 +``` + +### DeepSeek-V3.2 W8A8 1P1D 32P IN128K OUT1K BS8 + +**Model**: DeepSeek-V3.2 + +**Hardware**: Atlas 800I A3 + +**Cards**: 32 + +**Deploy Mode**: PD Disaggregation + +**Quantization**: W8A8 INT8 + +**Dataset**: 128K+1K + +**TPOT**: 26ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +P_IP=('' '') +D_IP=('' '') + +export ASCEND_MF_STORE_URL="tcp://: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 DEEP_NORMAL_MODE_USE_INT8_QUANT=1 + export GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=1200 + export HCCL_SOCKET_IFNAME= + export TASK_QUEUE_ENABLE=2 + + python3 -m sglang.launch_server \ + --model-path ${MODEL_PATH} \ + --disaggregation-mode prefill \ + --host ${P_IP[$i]} \ + --port 8000 \ + --dist-init-addr ${P_IP[0]}:5000 \ + --disaggregation-bootstrap-port 8998 \ + --node-rank $i \ + --nnodes 2 \ + --tp 32 \ + --watchdog-timeout 9000 \ + --mem-fraction-static 0.73 \ + --disable-radix-cache \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 68000 \ + --max-running-requests 1 \ + --moe-a2a-backend deepep \ + --deepep-mode normal \ + --quantization modelslim \ + --disaggregation-transfer-backend ascend \ + --disable-cuda-graph \ + --moe-dense-tp-size 1 \ + --enable-nsa-prefill-context-parallel \ + --nsa-prefill-cp-mode in-seq-split \ + --attn-cp-size 32 \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 1 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 2 + NODE_RANK=$i + 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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=400 + export HCCL_SOCKET_IFNAME= + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=8 + export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 + export SGLANG_ENABLE_SPEC_V2=1 + export SGLANG_SCHEDULER_SKIP_ALL_GATHER=1 + export TASK_QUEUE_ENABLE=0 + + 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 32 \ + --dp 8 \ + --ep 32 \ + --moe-dense-tp-size 1 \ + --enable-dp-attention \ + --enable-dp-lm-head \ + --watchdog-timeout 9000 \ + --mem-fraction-static 0.79 \ + --disable-radix-cache \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 68000 \ + --max-running-requests 32 \ + --cuda-graph-max-bs 4 \ + --moe-a2a-backend deepep \ + --deepep-mode low_latency \ + --quantization modelslim \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --disaggregation-transfer-backend ascend + NODE_RANK=$i + break + fi +done +``` + +```shell Command +# ============================================================ +# Before running, replace the following placeholders: +# : prefill node IP address +# : first decode node IP address (decode may have distributed nodes) +# ============================================================ + +python -m sglang_router.launch_router \ + --pd-disaggregation \ + --policy cache_aware \ + --prefill http://:8000 8998 \ + --decode http://:8001 \ + --host 127.0.0.1 \ + --port 6688 \ + --mini-lb +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 8 \ + --random-input-len 131072 \ + --random-output-len 1024 \ + --num-prompts 8 \ + --random-range-ratio 1 +``` diff --git a/docs_new/docs/hardware-platforms/ascend-npus/best_practice/glm5_1.mdx b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/glm5_1.mdx new file mode 100644 index 000000000..1019bd7b8 --- /dev/null +++ b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/glm5_1.mdx @@ -0,0 +1,1730 @@ +--- +title: "GLM-5.1" +metatags: + description: "Best Practice for GLM-5.1 on Ascend NPU" +--- + +This guide describes the best practice data for GLM-5.1 on the Ascend NPU. + +### Low Latency + +| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration | +| --- | --- | --- | --- | --- | --- | --- | --- | +| GLM-5.1 | Atlas 800I A3 | 32 | PD Disaggregation | 64K+1K | 20ms | W4A8 INT8 | [Optimal Configuration](#glm-5-1-w4a8-1p1d-32p-in64k-out1k-20ms) | +| GLM-5.1 | Atlas 800I A3 | 32 | PD Disaggregation | 65K+1.5K (90% prefix cache hit rate) | 25ms | W4A8 INT8 | [Optimal Configuration](#glm-5-1-w4a8-1p1d-32p-in65k-out1k5-prefix90-25ms) | + +### High Throughput + +| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration | +| --- | --- | --- | --- | --- | --- | --- | --- | +| GLM-5.1 | Atlas 800I A3 | 16 | PD Mixed | 3.5K+1.5K | 50ms | W4A8 INT8 | [Optimal Configuration](#glm-5-1-w4a8-16p-in3k5-out1k5-50ms) | +| GLM-5.1 | Atlas 800I A3 | 32 | PD Disaggregation | 128K+1K | 50ms | W4A8 INT8 | [Optimal Configuration](#glm-5-1-w4a8-1p1d-32p-in128k-out1k) | +| GLM-5.1 | Atlas 800I A3 | 32 | PD Disaggregation | 16K+1K | 50ms | W4A8 INT8 | [Optimal Configuration](#glm-5-1-w4a8-1p1d-32p-in16k-out1k-50ms) | +| GLM-5.1 | Atlas 800I A3 | 32 | PD Disaggregation | 64K+1K | 50ms | W4A8 INT8 | [Optimal Configuration](#glm-5-1-w4a8-1p1d-32p-in64k-out1k-50ms) | +| GLM-5.1 | Atlas 800I A3 | 48 | PD Disaggregation | 65K+1.5K (100% prefix cache hit rate) | 33ms | W4A8 INT8 | [Optimal Configuration](#glm-5-1-w4a8-1p1d-48p-in65k-out1k5-prefix100-33ms) | +| GLM-5.1 | Atlas 800I A3 | 48 | PD Disaggregation | 128K+1K (90% prefix cache hit rate) | 50ms | W4A8 INT8 | [Optimal Configuration](#glm-5-1-w4a8-2p1d-48p-in128k-out1k-prefix90-50ms) | +| GLM-5.1 | Atlas 800I A3 | 48 | PD Disaggregation | 64K+1K (90% prefix cache hit rate) | 50ms | W4A8 INT8 | [Optimal Configuration](#glm-5-1-w4a8-4p1d-48p-in64k-out1k-prefix90-50ms) | + + +## Optimal Configuration + +### GLM-5.1 W4A8 16P IN3K5 OUT1K5 50ms + +**Model**: GLM-5.1 + +**Hardware**: Atlas 800I A3 + +**Cards**: 16 + +**Deploy Mode**: PD Mixed + +**Quantization**: W4A8 INT8 + +**Dataset**: 3.5K+1.5K + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=2500 +export HCCL_SOCKET_IFNAME= +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=32 +export SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT=600 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --attention-backend ascend \ + --device npu \ + --tp-size 32 \ + --nnodes 2 \ + --dp-size 16 \ + --enable-dp-attention \ + --chunked-prefill-size 65536 \ + --max-prefill-tokens 280000 \ + --trust-remote-code \ + --mem-fraction-static 0.65 \ + --served-model-name glm-5 \ + --cuda-graph-max-bs 8 \ + --max-running-requests 128 \ + --quantization modelslim \ + --speculative-draft-model-quantization unquant \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --load-balance-method round_robin \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 128 \ + --random-input-len 3500 \ + --random-output-len 1500 \ + --num-prompts 512 \ + --random-range-ratio 1 +``` + +### GLM-5.1 W4A8 1P1D 32P IN128K OUT1K + +**Model**: GLM-5.1 + +**Hardware**: Atlas 800I A3 + +**Cards**: 32 + +**Deploy Mode**: PD Disaggregation + +**Quantization**: W4A8 INT8 + +**Dataset**: 128K+1K + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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_DISAGGREGATION_BOOTSTRAP_TIMEOUT=1200 +export SGLANG_DISAGGREGATION_WAITING_TIMEOUT=1200 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +P_IP=('' '') +D_IP=('' '') + +export ASCEND_MF_STORE_URL="tcp://: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_NORMAL_COMBINE_ENABLE_LONG_SEQ=1 + export DEEPEP_NORMAL_LONG_SEQ_PER_ROUND_TOKENS=1024 + export DEEPEP_NORMAL_LONG_SEQ_ROUND=72 + export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 + export ENABLE_PROFILING=0 + export GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=1200 + export HCCL_SOCKET_IFNAME= + export TASK_QUEUE_ENABLE=2 + + python3 -m sglang.launch_server \ + --model-path ${MODEL_PATH} \ + --disaggregation-mode prefill \ + --host ${P_IP[$i]} \ + --port 8000 \ + --dist-init-addr ${P_IP[0]}:5000 \ + --disaggregation-bootstrap-port 8998 \ + --node-rank $i \ + --tp-size 4 \ + --nnodes 2 \ + --mem-fraction-static 0.72 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --disaggregation-transfer-backend ascend \ + --max-running-requests 16 \ + --served-model-name glm-5 \ + --chunked-prefill-size 16384 \ + --max-prefill-tokens 180000 \ + --moe-a2a-backend deepep \ + --deepep-mode normal \ + --disable-shared-experts-fusion \ + --disable-cuda-graph \ + --dtype bfloat16 \ + --speculative-draft-model-quantization unquant \ + --enable-nsa-prefill-context-parallel \ + --nsa-prefill-cp-mode in-seq-split \ + --attn-cp-size 4 \ + --enable-dp-lm-head \ + --moe-dense-tp 1 \ + --pp-size 8 + NODE_RANK=$i + 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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=200 + export HCCL_SOCKET_IFNAME= + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=16 + export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 + export SGLANG_ENABLE_SPEC_V2=1 + export SGLANG_SPEC_ENABLE_OVERLAP_REFLOW=1 + export TASK_QUEUE_ENABLE=0 + + 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 \ + --tp-size 32 \ + --nnodes 2 \ + --dp-size 32 \ + --ep-size 32 \ + --enable-dp-attention \ + --mem-fraction-static 0.85 \ + --max-running-requests 32 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --served-model-name glm-5 \ + --moe-a2a-backend deepep \ + --deepep-mode low_latency \ + --cuda-graph-bs 1 2 3 \ + --disaggregation-transfer-backend ascend \ + --watchdog-timeout 9000 \ + --context-length 180000 \ + --tokenizer-worker-num 16 \ + --prefill-round-robin-balance \ + --disable-shared-experts-fusion \ + --dtype bfloat16 \ + --load-balance-method round_robin \ + --speculative-draft-model-quantization unquant + NODE_RANK=$i + break + fi +done +``` + +```shell Command +# ============================================================ +# Before running, replace the following placeholders: +# : prefill node IP address +# : first decode node IP address (decode may have distributed nodes) +# ============================================================ + +python -m sglang_router.launch_router \ + --pd-disaggregation \ + --prefill http://:8000 8998 \ + --decode http://:8001 \ + --host 127.0.0.1 \ + --port 6688 \ + --policy round_robin +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 1 \ + --random-input-len 131072 \ + --random-output-len 1024 \ + --num-prompts 1 \ + --random-range-ratio 1 +``` + +### GLM-5.1 W4A8 1P1D 32P IN16K OUT1K 50ms + +**Model**: GLM-5.1 + +**Hardware**: Atlas 800I A3 + +**Cards**: 32 + +**Deploy Mode**: PD Disaggregation + +**Quantization**: W4A8 INT8 + +**Dataset**: 16K+1K + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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_DISAGGREGATION_BOOTSTRAP_TIMEOUT=600 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +P_IP=('' '') +D_IP=('' '') + +export ASCEND_MF_STORE_URL="tcp://: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_NORMAL_COMBINE_ENABLE_LONG_SEQ=1 + export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 + export ENABLE_PROFILING=0 + export GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=1200 + export HCCL_SOCKET_IFNAME= + export TASK_QUEUE_ENABLE=2 + + python3 -m sglang.launch_server \ + --model-path ${MODEL_PATH} \ + --disaggregation-mode prefill \ + --host ${P_IP[$i]} \ + --port 8000 \ + --dist-init-addr ${P_IP[0]}:5000 \ + --disaggregation-bootstrap-port 8998 \ + --node-rank $i \ + --tp-size 32 \ + --nnodes 2 \ + --mem-fraction-static 0.75 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --disaggregation-transfer-backend ascend \ + --max-running-requests 64 \ + --served-model-name glm-5 \ + --chunked-prefill-size 524288 \ + --max-prefill-tokens 180000 \ + --moe-a2a-backend deepep \ + --deepep-mode normal \ + --disable-shared-experts-fusion \ + --disable-cuda-graph \ + --dtype bfloat16 \ + --dp-size 4 \ + --enable-dp-attention \ + --load-balance-method round_robin \ + --enable-nsa-prefill-context-parallel \ + --nsa-prefill-cp-mode in-seq-split \ + --attn-cp-size 8 \ + --enable-dp-lm-head \ + --moe-dense-tp 1 + NODE_RANK=$i + 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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=650 + export HCCL_SOCKET_IFNAME= + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=64 + export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 + export SGLANG_ENABLE_SPEC_V2=1 + export SGLANG_SPEC_ENABLE_OVERLAP_REFLOW=1 + export TASK_QUEUE_ENABLE=0 + + 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 \ + --tp-size 32 \ + --nnodes 2 \ + --dp-size 32 \ + --ep-size 32 \ + --enable-dp-attention \ + --mem-fraction-static 0.87 \ + --max-running-requests 96 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --served-model-name glm-5 \ + --moe-a2a-backend deepep \ + --deepep-mode low_latency \ + --cuda-graph-bs 1 2 3 \ + --disaggregation-transfer-backend ascend \ + --watchdog-timeout 9000 \ + --context-length 180000 \ + --tokenizer-worker-num 4 \ + --prefill-round-robin-balance \ + --disable-shared-experts-fusion \ + --dtype bfloat16 \ + --load-balance-method round_robin \ + --speculative-draft-model-quantization unquant \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 + NODE_RANK=$i + break + fi +done +``` + +```shell Command +# ============================================================ +# Before running, replace the following placeholders: +# : prefill node IP address +# : first decode node IP address (decode may have distributed nodes) +# ============================================================ + +python -m sglang_router.launch_router \ + --pd-disaggregation \ + --prefill http://:8000 8998 \ + --decode http://:8001 \ + --host 127.0.0.1 \ + --port 6688 \ + --policy round_robin +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 128 \ + --random-input-len 16384 \ + --random-output-len 1024 \ + --num-prompts 512 \ + --random-range-ratio 1 +``` + +### GLM-5.1 W4A8 1P1D 32P IN64K OUT1K 20ms + +**Model**: GLM-5.1 + +**Hardware**: Atlas 800I A3 + +**Cards**: 32 + +**Deploy Mode**: PD Disaggregation + +**Quantization**: W4A8 INT8 + +**Dataset**: 64K+1K + +**TPOT**: 20ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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_DISAGGREGATION_BOOTSTRAP_TIMEOUT=1200 +export SGLANG_DISAGGREGATION_WAITING_TIMEOUT=1200 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +P_IP=('' '') +D_IP=('' '') + +export ASCEND_MF_STORE_URL="tcp://: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_NORMAL_COMBINE_ENABLE_LONG_SEQ=1 + export DEEPEP_NORMAL_LONG_SEQ_PER_ROUND_TOKENS=1024 + export DEEPEP_NORMAL_LONG_SEQ_ROUND=72 + export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 + export ENABLE_PROFILING=0 + export GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=1200 + export HCCL_SOCKET_IFNAME= + export TASK_QUEUE_ENABLE=2 + + python3 -m sglang.launch_server \ + --model-path ${MODEL_PATH} \ + --disaggregation-mode prefill \ + --host ${P_IP[$i]} \ + --port 8000 \ + --dist-init-addr ${P_IP[0]}:5000 \ + --disaggregation-bootstrap-port 8998 \ + --node-rank $i \ + --tp-size 4 \ + --nnodes 2 \ + --mem-fraction-static 0.72 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --disaggregation-transfer-backend ascend \ + --max-running-requests 16 \ + --served-model-name glm-5 \ + --chunked-prefill-size 16384 \ + --max-prefill-tokens 180000 \ + --moe-a2a-backend deepep \ + --deepep-mode normal \ + --disable-shared-experts-fusion \ + --disable-cuda-graph \ + --dtype bfloat16 \ + --speculative-draft-model-quantization unquant \ + --enable-nsa-prefill-context-parallel \ + --nsa-prefill-cp-mode in-seq-split \ + --attn-cp-size 4 \ + --enable-dp-lm-head \ + --moe-dense-tp 1 \ + --pp-size 8 + NODE_RANK=$i + 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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=200 + export HCCL_SOCKET_IFNAME= + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=16 + export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 + export SGLANG_ENABLE_SPEC_V2=1 + export SGLANG_SPEC_ENABLE_OVERLAP_REFLOW=1 + export TASK_QUEUE_ENABLE=0 + + 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 \ + --tp-size 32 \ + --nnodes 2 \ + --dp-size 32 \ + --enable-dp-attention \ + --ep-size 32 \ + --mem-fraction-static 0.85 \ + --max-running-requests 32 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --served-model-name glm-5 \ + --moe-a2a-backend deepep \ + --deepep-mode low_latency \ + --cuda-graph-bs 1 2 3 \ + --disaggregation-transfer-backend ascend \ + --watchdog-timeout 9000 \ + --context-length 180000 \ + --tokenizer-worker-num 16 \ + --prefill-round-robin-balance \ + --disable-shared-experts-fusion \ + --dtype bfloat16 \ + --load-balance-method round_robin \ + --speculative-draft-model-quantization unquant + NODE_RANK=$i + break + fi +done +``` + +```shell Command +# ============================================================ +# Before running, replace the following placeholders: +# : prefill node IP address +# : first decode node IP address (decode may have distributed nodes) +# ============================================================ + +python -m sglang_router.launch_router \ + --pd-disaggregation \ + --prefill http://:8000 8998 \ + --decode http://:8001 \ + --host 127.0.0.1 \ + --port 6688 \ + --policy round_robin +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 1 \ + --random-input-len 65536 \ + --random-output-len 1024 \ + --num-prompts 1 \ + --random-range-ratio 1 +``` + +### GLM-5.1 W4A8 1P1D 32P IN64K OUT1K 50ms + +**Model**: GLM-5.1 + +**Hardware**: Atlas 800I A3 + +**Cards**: 32 + +**Deploy Mode**: PD Disaggregation + +**Quantization**: W4A8 INT8 + +**Dataset**: 64K+1K + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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_DISAGGREGATION_BOOTSTRAP_TIMEOUT=1200 +export SGLANG_DISAGGREGATION_WAITING_TIMEOUT=1200 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +P_IP=('' '') +D_IP=('' '') + +export ASCEND_MF_STORE_URL="tcp://: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_NORMAL_COMBINE_ENABLE_LONG_SEQ=1 + export DEEPEP_NORMAL_LONG_SEQ_PER_ROUND_TOKENS=1024 + export DEEPEP_NORMAL_LONG_SEQ_ROUND=72 + export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 + export ENABLE_PROFILING=0 + export GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=1200 + export HCCL_SOCKET_IFNAME= + export TASK_QUEUE_ENABLE=2 + + python3 -m sglang.launch_server \ + --model-path ${MODEL_PATH} \ + --disaggregation-mode prefill \ + --host ${P_IP[$i]} \ + --port 8000 \ + --dist-init-addr ${P_IP[0]}:5000 \ + --disaggregation-bootstrap-port 8998 \ + --node-rank $i \ + --tp-size 4 \ + --nnodes 2 \ + --mem-fraction-static 0.72 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --disaggregation-transfer-backend ascend \ + --max-running-requests 16 \ + --served-model-name glm-5 \ + --chunked-prefill-size 16384 \ + --max-prefill-tokens 180000 \ + --moe-a2a-backend deepep \ + --deepep-mode normal \ + --disable-shared-experts-fusion \ + --disable-cuda-graph \ + --dtype bfloat16 \ + --speculative-draft-model-quantization unquant \ + --enable-nsa-prefill-context-parallel \ + --nsa-prefill-cp-mode in-seq-split \ + --attn-cp-size 4 \ + --enable-dp-lm-head \ + --moe-dense-tp 1 \ + --pp-size 8 + NODE_RANK=$i + 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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=200 + export HCCL_SOCKET_IFNAME= + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=16 + export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 + export SGLANG_ENABLE_SPEC_V2=1 + export SGLANG_SPEC_ENABLE_OVERLAP_REFLOW=1 + export TASK_QUEUE_ENABLE=0 + + 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 \ + --tp-size 32 \ + --nnodes 2 \ + --dp-size 32 \ + --enable-dp-attention \ + --ep-size 32 \ + --mem-fraction-static 0.85 \ + --max-running-requests 32 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --served-model-name glm-5 \ + --moe-a2a-backend deepep \ + --deepep-mode low_latency \ + --cuda-graph-bs 1 2 3 \ + --disaggregation-transfer-backend ascend \ + --watchdog-timeout 9000 \ + --context-length 180000 \ + --tokenizer-worker-num 16 \ + --prefill-round-robin-balance \ + --disable-shared-experts-fusion \ + --dtype bfloat16 \ + --load-balance-method round_robin \ + --speculative-draft-model-quantization unquant + NODE_RANK=$i + break + fi +done +``` + +```shell Command +# ============================================================ +# Before running, replace the following placeholders: +# : prefill node IP address +# : first decode node IP address (decode may have distributed nodes) +# ============================================================ + +python -m sglang_router.launch_router \ + --pd-disaggregation \ + --prefill http://:8000 8998 \ + --decode http://:8001 \ + --host 127.0.0.1 \ + --port 6688 \ + --policy round_robin +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 1 \ + --random-input-len 65536 \ + --random-output-len 1024 \ + --num-prompts 1 \ + --random-range-ratio 1 +``` + +### GLM-5.1 W4A8 1P1D 32P IN65K OUT1K5 PREFIX90 25ms + +**Model**: GLM-5.1 + +**Hardware**: Atlas 800I A3 + +**Cards**: 32 + +**Deploy Mode**: PD Disaggregation + +**Quantization**: W4A8 INT8 + +**Dataset**: 65K+1.5K (90% prefix cache hit rate) + +**TPOT**: 25ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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_DISAGGREGATION_BOOTSTRAP_TIMEOUT=600 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +P_IP=('' '') +D_IP=('' '') + +export ASCEND_MF_STORE_URL="tcp://: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_NORMAL_COMBINE_ENABLE_LONG_SEQ=1 + export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 + export ENABLE_PROFILING=0 + export GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=1200 + export HCCL_SOCKET_IFNAME= + export TASK_QUEUE_ENABLE=2 + + python3 -m sglang.launch_server \ + --model-path ${MODEL_PATH} \ + --disaggregation-mode prefill \ + --host ${P_IP[$i]} \ + --port 8000 \ + --dist-init-addr ${P_IP[0]}:5000 \ + --disaggregation-bootstrap-port 8998 \ + --node-rank $i \ + --tp-size 32 \ + --nnodes 2 \ + --mem-fraction-static 0.75 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --disaggregation-transfer-backend ascend \ + --max-running-requests 64 \ + --served-model-name glm-5 \ + --chunked-prefill-size 524288 \ + --max-prefill-tokens 180000 \ + --moe-a2a-backend deepep \ + --deepep-mode normal \ + --disable-shared-experts-fusion \ + --disable-cuda-graph \ + --dtype bfloat16 \ + --dp-size 4 \ + --enable-dp-attention \ + --load-balance-method round_robin \ + --enable-nsa-prefill-context-parallel \ + --nsa-prefill-cp-mode in-seq-split \ + --attn-cp-size 8 \ + --enable-dp-lm-head \ + --moe-dense-tp 1 + NODE_RANK=$i + 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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=650 + export HCCL_SOCKET_IFNAME= + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=64 + export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 + export SGLANG_ENABLE_SPEC_V2=1 + export SGLANG_SPEC_ENABLE_OVERLAP_REFLOW=1 + export TASK_QUEUE_ENABLE=0 + + 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 \ + --tp-size 32 \ + --nnodes 2 \ + --dp-size 32 \ + --ep-size 32 \ + --enable-dp-attention \ + --mem-fraction-static 0.87 \ + --max-running-requests 96 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --served-model-name glm-5 \ + --moe-a2a-backend deepep \ + --deepep-mode low_latency \ + --cuda-graph-bs 1 2 3 \ + --disaggregation-transfer-backend ascend \ + --watchdog-timeout 9000 \ + --context-length 180000 \ + --tokenizer-worker-num 4 \ + --prefill-round-robin-balance \ + --disable-shared-experts-fusion \ + --dtype bfloat16 \ + --load-balance-method round_robin \ + --speculative-draft-model-quantization unquant \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 + NODE_RANK=$i + break + fi +done +``` + +```shell Command +# ============================================================ +# Before running, replace the following placeholders: +# : prefill node IP address +# : first decode node IP address (decode may have distributed nodes) +# ============================================================ + +python -m sglang_router.launch_router \ + --pd-disaggregation \ + --prefill http://:8000 8998 \ + --decode http://:8001 \ + --host 127.0.0.1 \ + --port 6688 \ + --policy round_robin +``` + +#### Benchmark + +We tested it based on the `generated-shared-prefix` dataset with 90% cache hit (`repeat_rate = 0.9`): +`--gsp-system-prompt-len 59904` = `int(66560 * 0.9)` is the shared prefix portion. +`--gsp-question-len 6655` = `int(66560 * (1 - 0.9))` is the unique per-request suffix. +`--gsp-num-groups 1` keeps all requests in one prefix group for maximum cache reuse. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name generated-shared-prefix \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --gsp-num-groups 1 \ + --gsp-prompts-per-group 480 \ + --gsp-system-prompt-len 59904 \ + --gsp-question-len 6655 \ + --gsp-output-len 1536 \ + --max-concurrency 100 \ + --num-prompts 480 \ + --request-rate inf +``` + +### GLM-5.1 W4A8 1P1D 48P IN65K OUT1K5 PREFIX100 33ms + +**Model**: GLM-5.1 + +**Hardware**: Atlas 800I A3 + +**Cards**: 48 + +**Deploy Mode**: PD Disaggregation + +**Quantization**: W4A8 INT8 + +**Dataset**: 65K+1.5K (100% prefix cache hit rate) + +**TPOT**: 33ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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_DISAGGREGATION_BOOTSTRAP_TIMEOUT=600 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +P_IP=('' '') +D_IP=('' '' '' '') + +export ASCEND_MF_STORE_URL="tcp://: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_NORMAL_COMBINE_ENABLE_LONG_SEQ=1 + export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 + export GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=1200 + export HCCL_SOCKET_IFNAME= + export TASK_QUEUE_ENABLE=2 + + python3 -m sglang.launch_server \ + --model-path ${MODEL_PATH} \ + --disaggregation-mode prefill \ + --host ${P_IP[$i]} \ + --port 8000 \ + --dist-init-addr ${P_IP[0]}:5000 \ + --disaggregation-bootstrap-port 8998 \ + --node-rank $i \ + --tp-size 32 \ + --nnodes 2 \ + --mem-fraction-static 0.72 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --disaggregation-transfer-backend ascend \ + --max-running-requests 192 \ + --served-model-name glm-5 \ + --chunked-prefill-size 16384 \ + --moe-a2a-backend deepep \ + --deepep-mode normal \ + --disable-shared-experts-fusion \ + --disable-cuda-graph \ + --dtype bfloat16 + NODE_RANK=$i + 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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=650 + export HCCL_SOCKET_IFNAME= + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=48 + export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 + export SGLANG_ENABLE_SPEC_V2=1 + export SGLANG_SCHEDULER_SKIP_ALL_GATHER=1 + export SGLANG_SPEC_ENABLE_OVERLAP_REFLOW=1 + export TASK_QUEUE_ENABLE=0 + + 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 \ + --tp-size 64 \ + --nnodes 4 \ + --dp-size 64 \ + --ep-size 64 \ + --enable-dp-attention \ + --mem-fraction-static 0.84 \ + --max-running-requests 192 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --served-model-name glm-5 \ + --moe-a2a-backend deepep \ + --enable-dp-attention \ + --deepep-mode low_latency \ + --enable-dp-lm-head \ + --moe-dense-tp 1 \ + --cuda-graph-bs 1 2 3 \ + --disaggregation-transfer-backend ascend \ + --watchdog-timeout 9000 \ + --context-length 180000 \ + --speculative-draft-model-quantization unquant \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --tokenizer-worker-num 4 \ + --prefill-round-robin-balance \ + --disable-shared-experts-fusion \ + --dtype bfloat16 \ + --load-balance-method round_robin + NODE_RANK=$i + break + fi +done +``` + +```shell Command +# ============================================================ +# Before running, replace the following placeholders: +# : prefill node IP address +# : first decode node IP address (decode may have distributed nodes) +# ============================================================ + +python -m sglang_router.launch_router \ + --pd-disaggregation \ + --prefill http://:8000 8998 \ + --decode http://:8001 \ + --host 127.0.0.1 \ + --port 6688 \ + --policy round_robin +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 128 \ + --random-input-len 66560 \ + --random-output-len 1536 \ + --num-prompts 512 \ + --random-range-ratio 1 +``` + +### GLM-5.1 W4A8 2P1D 48P IN128K OUT1K PREFIX90 50ms + +**Model**: GLM-5.1 + +**Hardware**: Atlas 800I A3 + +**Cards**: 48 + +**Deploy Mode**: PD Disaggregation + +**Quantization**: W4A8 INT8 + +**Dataset**: 128K+1K (90% prefix cache hit rate) + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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_DISAGGREGATION_BOOTSTRAP_TIMEOUT=1200 +export SGLANG_DISAGGREGATION_WAITING_TIMEOUT=1200 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +P_IP=('' '' '' '') +D_IP=('' '') + +export ASCEND_MF_STORE_URL="tcp://: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_NORMAL_COMBINE_ENABLE_LONG_SEQ=1 + export DEEPEP_NORMAL_LONG_SEQ_PER_ROUND_TOKENS=1024 + export DEEPEP_NORMAL_LONG_SEQ_ROUND=72 + export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 + export ENABLE_PROFILING=0 + export GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=1200 + export HCCL_SOCKET_IFNAME= + export TASK_QUEUE_ENABLE=2 + + python3 -m sglang.launch_server \ + --model-path ${MODEL_PATH} \ + --disaggregation-mode prefill \ + --host ${P_IP[$i]} \ + --port 8000 \ + --dist-init-addr ${P_IP[$(( $i / 2 * 2 ))]}:5000 \ + --disaggregation-bootstrap-port $((8998 + $i / 2)) \ + --node-rank $(( $i % 2 )) \ + --tp-size 4 \ + --nnodes 2 \ + --mem-fraction-static 0.72 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --disaggregation-transfer-backend ascend \ + --max-running-requests 32 \ + --served-model-name glm-5 \ + --chunked-prefill-size 16384 \ + --max-prefill-tokens 180000 \ + --moe-a2a-backend deepep \ + --deepep-mode normal \ + --disable-shared-experts-fusion \ + --disable-cuda-graph \ + --dtype bfloat16 \ + --speculative-draft-model-quantization unquant \ + --enable-nsa-prefill-context-parallel \ + --nsa-prefill-cp-mode in-seq-split \ + --attn-cp-size 4 \ + --enable-dp-lm-head \ + --moe-dense-tp 1 \ + --pp-size 8 + NODE_RANK=$i + 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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=200 + export HCCL_SOCKET_IFNAME= + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=24 + export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 + export SGLANG_ENABLE_SPEC_V2=1 + export SGLANG_SPEC_ENABLE_OVERLAP_REFLOW=1 + export TASK_QUEUE_ENABLE=0 + + 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 \ + --tp-size 32 \ + --nnodes 2 \ + --dp-size 32 \ + --ep-size 32 \ + --enable-dp-attention \ + --mem-fraction-static 0.865 \ + --max-running-requests 96 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --served-model-name glm-5 \ + --moe-a2a-backend deepep \ + --deepep-mode low_latency \ + --cuda-graph-bs 1 2 3 4 5 6 \ + --disaggregation-transfer-backend ascend \ + --watchdog-timeout 9000 \ + --context-length 180000 \ + --tokenizer-worker-num 32 \ + --prefill-round-robin-balance \ + --disable-shared-experts-fusion \ + --dtype bfloat16 \ + --load-balance-method round_robin \ + --speculative-draft-model-quantization unquant \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 + NODE_RANK=$i + break + fi +done +``` + +```shell Command +# ============================================================ +# Before running, replace the following placeholders: +# , : prefill node IP addresses +# : first decode node IP address (decode may have distributed nodes) +# ============================================================ + +python -m sglang_router.launch_router \ + --pd-disaggregation \ + --prefill http://:8000 8998 \ + --prefill http://:8000 8999 \ + --decode http://:8001 \ + --host 127.0.0.1 \ + --port 6688 \ + --policy round_robin +``` + +#### Benchmark + +We tested it based on the `generated-shared-prefix` dataset with 90% cache hit (`repeat_rate = 0.9`): +`--gsp-system-prompt-len 117964` = `int(131072 * 0.9)` is the shared prefix portion. +`--gsp-question-len 13107` = `int(131072 * (1 - 0.9))` is the unique per-request suffix. +`--gsp-num-groups 1` keeps all requests in one prefix group for maximum cache reuse. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name generated-shared-prefix \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --gsp-num-groups 1 \ + --gsp-prompts-per-group 576 \ + --gsp-system-prompt-len 117964 \ + --gsp-question-len 13107 \ + --gsp-output-len 1024 \ + --max-concurrency 144 \ + --num-prompts 576 \ + --request-rate inf +``` + +### GLM-5.1 W4A8 4P1D 48P IN64K OUT1K PREFIX90 50ms + +**Model**: GLM-5.1 + +**Hardware**: Atlas 800I A3 + +**Cards**: 48 + +**Deploy Mode**: PD Disaggregation + +**Quantization**: W4A8 INT8 + +**Dataset**: 64K+1K (90% prefix cache hit rate) + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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_DISAGGREGATION_BOOTSTRAP_TIMEOUT=1200 +export SGLANG_DISAGGREGATION_WAITING_TIMEOUT=1200 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +P_IP=('' '' '' '') +D_IP=('' '') + +export ASCEND_MF_STORE_URL="tcp://: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_NORMAL_COMBINE_ENABLE_LONG_SEQ=1 + export DEEPEP_NORMAL_LONG_SEQ_PER_ROUND_TOKENS=1024 + export DEEPEP_NORMAL_LONG_SEQ_ROUND=72 + export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 + export ENABLE_PROFILING=0 + export GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=1200 + export HCCL_SOCKET_IFNAME= + 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 \ + --tp-size 4 \ + --nnodes 1 \ + --mem-fraction-static 0.72 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --disaggregation-transfer-backend ascend \ + --max-running-requests 16 \ + --served-model-name glm-5 \ + --chunked-prefill-size 16384 \ + --max-prefill-tokens 180000 \ + --moe-a2a-backend deepep \ + --deepep-mode normal \ + --disable-shared-experts-fusion \ + --disable-cuda-graph \ + --dtype bfloat16 \ + --speculative-draft-model-quantization unquant \ + --enable-nsa-prefill-context-parallel \ + --nsa-prefill-cp-mode in-seq-split \ + --attn-cp-size 4 \ + --enable-dp-lm-head \ + --moe-dense-tp 1 \ + --pp-size 4 + NODE_RANK=$i + 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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=300 + export HCCL_SOCKET_IFNAME= + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=40 + export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 + export SGLANG_ENABLE_SPEC_V2=1 + export SGLANG_SPEC_ENABLE_OVERLAP_REFLOW=1 + export TASK_QUEUE_ENABLE=0 + + 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 \ + --tp-size 32 \ + --nnodes 2 \ + --dp-size 32 \ + --ep-size 32 \ + --enable-dp-attention \ + --mem-fraction-static 0.85 \ + --max-running-requests 320 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --served-model-name glm-5 \ + --moe-a2a-backend deepep \ + --deepep-mode low_latency \ + --cuda-graph-bs 1 2 3 4 5 6 7 8 9 10 \ + --disaggregation-transfer-backend ascend \ + --watchdog-timeout 9000 \ + --context-length 180000 \ + --tokenizer-worker-num 4 \ + --prefill-round-robin-balance \ + --disable-shared-experts-fusion \ + --dtype bfloat16 \ + --load-balance-method round_robin \ + --speculative-draft-model-quantization unquant \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 + NODE_RANK=$i + break + fi +done +``` + +```shell Command +# ============================================================ +# Before running, replace the following placeholders: +# , , , : prefill node IP addresses +# : first decode node IP address (decode may have distributed nodes) +# ============================================================ + +python -m sglang_router.launch_router \ + --pd-disaggregation \ + --prefill http://:8000 8998 \ + --prefill http://:8000 8999 \ + --prefill http://:8000 9000 \ + --prefill http://:8000 9001 \ + --decode http://:8001 \ + --host 127.0.0.1 \ + --port 6688 \ + --policy round_robin +``` + +#### Benchmark + +We tested it based on the `generated-shared-prefix` dataset with 90% cache hit (`repeat_rate = 0.9`): +`--gsp-system-prompt-len 58982` = `int(65536 * 0.9)` is the shared prefix portion. +`--gsp-question-len 6553` = `int(65536 * (1 - 0.9))` is the unique per-request suffix. +`--gsp-num-groups 1` keeps all requests in one prefix group for maximum cache reuse. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name generated-shared-prefix \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --gsp-num-groups 1 \ + --gsp-prompts-per-group 1280 \ + --gsp-system-prompt-len 58982 \ + --gsp-question-len 6553 \ + --gsp-output-len 1024 \ + --max-concurrency 320 \ + --num-prompts 1280 \ + --request-rate inf +``` diff --git a/docs_new/docs/hardware-platforms/ascend-npus/best_practice/kimi_k2_6.mdx b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/kimi_k2_6.mdx new file mode 100644 index 000000000..eacfd0597 --- /dev/null +++ b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/kimi_k2_6.mdx @@ -0,0 +1,1715 @@ +--- +title: "Kimi-K2.6" +metatags: + description: "Best Practice for Kimi-K2.6 on Ascend NPU" +--- + +This guide describes the best practice data for Kimi-K2.6 on the Ascend NPU. + +### Low Latency + +| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration | +| --- | --- | --- | --- | --- | --- | --- | --- | +| Kimi-K2.6 | Atlas 800I A3 | 8 | PD Mixed | 3.5K+1.5K | 20ms | W4A8 INT8 | [Optimal Configuration](#kimi-k2-6-w4a8-8p-in3k5-out1k5-20ms) | + +### High Throughput + +| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration | +| --- | --- | --- | --- | --- | --- | --- | --- | +| Kimi-K2.6 | Atlas 800I A3 | 16 | PD Mixed | 64K+1K | 100ms | W4A8 INT8 | [Optimal Configuration](#kimi-k2-6-w4a8-16p-in64k-out1k-100ms) | +| Kimi-K2.6 | Atlas 800I A3 | 16 | PD Disaggregation | 128K+1K | 100ms | W4A8 INT8 | [Optimal Configuration](#kimi-k2-6-w4a8-1p1d-16p-in128k-out1k-100ms) | +| Kimi-K2.6 | Atlas 800I A3 | 16 | PD Disaggregation | 128K+1K (90% prefix cache hit rate) | 100ms | W4A8 INT8 | [Optimal Configuration](#kimi-k2-6-w4a8-1p1d-16p-in128k-out1k-prefix90-100ms) | +| Kimi-K2.6 | Atlas 800I A3 | 16 | PD Disaggregation | 64K+1.5K | 100ms | W4A8 INT8 | [Optimal Configuration](#kimi-k2-6-w4a8-1p1d-16p-in64k-out1k5-100ms) | +| Kimi-K2.6 | Atlas 800I A3 | 16 | PD Disaggregation | 64K+1.5K (90% prefix cache hit rate) | 100ms | W4A8 INT8 | [Optimal Configuration](#kimi-k2-6-w4a8-1p1d-16p-in64k-out1k5-prefix90-100ms) | +| Kimi-K2.6 | Atlas 800I A3 | 24 | PD Disaggregation | 128K+1K (90% prefix cache hit rate) | 100ms | W4A8 INT8 | [Optimal Configuration](#kimi-k2-6-w4a8-1p1d-24p-in128k-out1k-prefix90-100ms) | +| Kimi-K2.6 | Atlas 800I A3 | 24 | PD Disaggregation | 64K+1.5K (90% prefix cache hit rate) | 100ms | W4A8 INT8 | [Optimal Configuration](#kimi-k2-6-w4a8-1p1d-24p-in64k-out1k5-prefix90-100ms) | +| Kimi-K2.6 | Atlas 800I A3 | 8 | PD Mixed | 1024x1024 (30)+1024 | 50ms | W4A8 INT8 | [Optimal Configuration](#kimi-k2-6-w4a8-8p-in1024x1024-30-out1024-50ms) | +| Kimi-K2.6 | Atlas 800I A3 | 8 | PD Mixed | 1080p_30+256 | 50ms | W4A8 INT8 | [Optimal Configuration](#kimi-k2-6-w4a8-8p-in1080p-30-out256-50ms) | +| Kimi-K2.6 | Atlas 800I A3 | 8 | PD Mixed | 3.5K+1.5K | 50ms | W4A8 INT8 | [Optimal Configuration](#kimi-k2-6-w4a8-8p-in3k5-out1k5-50ms) | + + +## Optimal Configuration + +### Kimi-K2.6 W4A8 16P IN64K OUT1K 100ms + +**Model**: Kimi-K2.6 + +**Hardware**: Atlas 800I A3 + +**Cards**: 16 + +**Deploy Mode**: PD Mixed + +**Quantization**: W4A8 INT8 + +**Dataset**: 64K+1K + +**TPOT**: 100ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-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 DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=4400 +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=64 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --trust-remote-code \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --dtype bfloat16 \ + --tp-size 32 \ + --nnodes 2 \ + --mem-fraction-static 0.55 \ + --max-running-requests 32 \ + --chunked-prefill-size 262144 \ + --context-length 75000 \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --sampling-backend ascend \ + --enable-dp-attention \ + --dp-size 32 \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --cuda-graph-bs 1 \ + --disable-radix-cache \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --speculative-draft-model-quantization unquant +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 32 \ + --random-input-len 64000 \ + --random-output-len 1000 \ + --num-prompts 32 \ + --random-range-ratio 1 +``` + +### Kimi-K2.6 W4A8 1P1D 16P IN128K OUT1K 100ms + +**Model**: Kimi-K2.6 + +**Hardware**: Atlas 800I A3 + +**Cards**: 16 + +**Deploy Mode**: PD Disaggregation + +**Quantization**: W4A8 INT8 + +**Dataset**: 128K+1K + +**TPOT**: 100ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT=60 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +P_IP=('') +D_IP=('') + +export ASCEND_MF_STORE_URL="tcp://: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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=8 + export HCCL_SOCKET_IFNAME= + export SGLANG_ENABLE_TP_MEMORY_INBALANCE_CHECK=0 + export SGLANG_ZBAL_BOOTSTRAP_URL=tcp://127.0.0.1:24699 + export SGLANG_ZBAL_LOCAL_MEM_SIZE=61184 + export ZBAL_ENABLE_GRAPH=1 + export ZBAL_HCCL_OP=send,recv + export ZBAL_NPU_ALLOC_CONF=use_vmm_for_static_memory:True + + 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 \ + --quantization modelslim \ + --dtype bfloat16 \ + --disaggregation-transfer-backend ascend \ + --nnodes 1 \ + --trust-remote-code \ + --attention-backend ascend \ + --device npu \ + --tp-size 16 \ + --disable-radix-cache \ + --disable-cuda-graph \ + --mem-fraction-static 0.78 \ + --max-running-requests 1 \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --chunked-prefill-size 16384 \ + --prefill-max-requests 1 \ + --max-prefill-tokens 131072 \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --sampling-backend ascend + NODE_RANK=$i + 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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=1200 + export HCCL_SOCKET_IFNAME= + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=64 + export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 + export SGLANG_ENABLE_SPEC_V2=1 + export SGLANG_NPU_USE_MLAPO=1 + export SGLANG_NPU_USE_MULTI_STREAM=1 + + python3 -m sglang.launch_server \ + --model-path ${MODEL_PATH} \ + --disaggregation-mode decode \ + --host ${D_IP[$i]} \ + --port 8001 \ + --quantization modelslim \ + --dtype bfloat16 \ + --disaggregation-transfer-backend ascend \ + --nnodes 1 \ + --trust-remote-code \ + --attention-backend ascend \ + --device npu \ + --tp-size 16 \ + --mem-fraction-static 0.82 \ + --max-running-requests 1 \ + --enable-dp-attention \ + --dp-size 1 \ + --enable-dp-lm-head \ + --disable-radix-cache \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --sampling-backend ascend \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --cuda-graph-bs 1 2 4 6 8 12 16 + NODE_RANK=$i + break + fi +done +``` + +```shell Command +# ============================================================ +# Before running, replace the following placeholders: +# : prefill node IP address +# : decode node IP address +# ============================================================ + +python -m sglang_router.launch_router \ + --pd-disaggregation \ + --prefill http://:8000 8998 \ + --decode http://:8001 \ + --host 127.0.0.1 \ + --port 6688 \ + --policy cache_aware +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 1 \ + --random-input-len 131072 \ + --random-output-len 1024 \ + --num-prompts 1 \ + --random-range-ratio 1 \ + --request-rate inf +``` + +### Kimi-K2.6 W4A8 1P1D 16P IN128K OUT1K PREFIX90 100ms + +**Model**: Kimi-K2.6 + +**Hardware**: Atlas 800I A3 + +**Cards**: 16 + +**Deploy Mode**: PD Disaggregation + +**Quantization**: W4A8 INT8 + +**Dataset**: 128K+1K (90% prefix cache hit rate) + +**TPOT**: 100ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT=60 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +P_IP=('') +D_IP=('') + +export ASCEND_MF_STORE_URL="tcp://: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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=8 + export HCCL_SOCKET_IFNAME= + export SGLANG_ENABLE_TP_MEMORY_INBALANCE_CHECK=0 + export SGLANG_ZBAL_BOOTSTRAP_URL=tcp://127.0.0.1:24699 + export SGLANG_ZBAL_LOCAL_MEM_SIZE=61184 + export ZBAL_ENABLE_GRAPH=1 + export ZBAL_HCCL_OP=send,recv + export ZBAL_NPU_ALLOC_CONF=use_vmm_for_static_memory:True + + 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 \ + --quantization modelslim \ + --dtype bfloat16 \ + --disaggregation-transfer-backend ascend \ + --nnodes 1 \ + --trust-remote-code \ + --attention-backend ascend \ + --device npu \ + --tp-size 16 \ + --mem-fraction-static 0.78 \ + --max-running-requests 2 \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --chunked-prefill-size 16384 \ + --prefill-max-requests 2 \ + --max-prefill-tokens 65536 \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --sampling-backend ascend + NODE_RANK=$i + 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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=1200 + export HCCL_SOCKET_IFNAME= + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=64 + export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 + export SGLANG_ENABLE_SPEC_V2=1 + export SGLANG_NPU_USE_MLAPO=1 + export SGLANG_NPU_USE_MULTI_STREAM=1 + + python3 -m sglang.launch_server \ + --model-path ${MODEL_PATH} \ + --disaggregation-mode decode \ + --host ${D_IP[$i]} \ + --port 8001 \ + --quantization modelslim \ + --dtype bfloat16 \ + --disaggregation-transfer-backend ascend \ + --nnodes 1 \ + --trust-remote-code \ + --attention-backend ascend \ + --device npu \ + --tp-size 16 \ + --mem-fraction-static 0.82 \ + --max-running-requests 2 \ + --enable-dp-attention \ + --dp-size 2 \ + --enable-dp-lm-head \ + --disable-radix-cache \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --sampling-backend ascend \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --cuda-graph-bs 1 2 4 6 8 12 + NODE_RANK=$i + break + fi +done +``` + +```shell Command +# ============================================================ +# Before running, replace the following placeholders: +# : prefill node IP address +# : decode node IP address +# ============================================================ + +python -m sglang_router.launch_router \ + --pd-disaggregation \ + --prefill http://:8000 8998 \ + --decode http://:8001 \ + --host 127.0.0.1 \ + --port 6688 \ + --policy cache_aware +``` + +#### Benchmark + +We tested it based on the `generated-shared-prefix` dataset with 90% cache hit (`repeat_rate = 0.9`): +`--gsp-system-prompt-len 117964` = `int(131072 * 0.9)` is the shared prefix portion. +`--gsp-question-len 13107` = `int(131072 * (1 - 0.9))` is the unique per-request suffix. +`--gsp-num-groups 1` keeps all requests in one prefix group for maximum cache reuse. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name generated-shared-prefix \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --gsp-num-groups 1 \ + --gsp-prompts-per-group 8 \ + --gsp-system-prompt-len 117964 \ + --gsp-question-len 13107 \ + --gsp-output-len 1024 \ + --max-concurrency 2 \ + --num-prompts 8 \ + --request-rate inf +``` + +### Kimi-K2.6 W4A8 1P1D 16P IN64K OUT1K5 100ms + +**Model**: Kimi-K2.6 + +**Hardware**: Atlas 800I A3 + +**Cards**: 16 + +**Deploy Mode**: PD Disaggregation + +**Quantization**: W4A8 INT8 + +**Dataset**: 64K+1.5K + +**TPOT**: 100ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT=60 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +P_IP=('') +D_IP=('') + +export ASCEND_MF_STORE_URL="tcp://: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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=8 + export HCCL_SOCKET_IFNAME= + export SGLANG_ENABLE_TP_MEMORY_INBALANCE_CHECK=0 + export SGLANG_ZBAL_BOOTSTRAP_URL=tcp://127.0.0.1:24699 + export SGLANG_ZBAL_LOCAL_MEM_SIZE=61184 + export ZBAL_ENABLE_GRAPH=1 + export ZBAL_HCCL_OP=send,recv + export ZBAL_NPU_ALLOC_CONF=use_vmm_for_static_memory:True + + 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 \ + --quantization modelslim \ + --dtype bfloat16 \ + --disaggregation-transfer-backend ascend \ + --nnodes 1 \ + --trust-remote-code \ + --attention-backend ascend \ + --device npu \ + --tp-size 16 \ + --disable-radix-cache \ + --disable-cuda-graph \ + --mem-fraction-static 0.78 \ + --max-running-requests 1 \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --chunked-prefill-size 16384 \ + --prefill-max-requests 1 \ + --max-prefill-tokens 65536 \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --sampling-backend ascend + NODE_RANK=$i + 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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=1200 + export HCCL_SOCKET_IFNAME= + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=64 + export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 + export SGLANG_ENABLE_SPEC_V2=1 + export SGLANG_NPU_USE_MLAPO=1 + export SGLANG_NPU_USE_MULTI_STREAM=1 + + python3 -m sglang.launch_server \ + --model-path ${MODEL_PATH} \ + --disaggregation-mode decode \ + --host ${D_IP[$i]} \ + --port 8001 \ + --quantization modelslim \ + --dtype bfloat16 \ + --disaggregation-transfer-backend ascend \ + --nnodes 1 \ + --trust-remote-code \ + --attention-backend ascend \ + --device npu \ + --tp-size 16 \ + --mem-fraction-static 0.82 \ + --max-running-requests 16 \ + --enable-dp-attention \ + --dp-size 1 \ + --enable-dp-lm-head \ + --disable-radix-cache \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --sampling-backend ascend \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --cuda-graph-bs 16 + NODE_RANK=$i + break + fi +done +``` + +```shell Command +# ============================================================ +# Before running, replace the following placeholders: +# : prefill node IP address +# : decode node IP address +# ============================================================ + +python -m sglang_router.launch_router \ + --pd-disaggregation \ + --prefill http://:8000 8998 \ + --decode http://:8001 \ + --host 127.0.0.1 \ + --port 6688 \ + --policy cache_aware +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 1 \ + --random-input-len 65536 \ + --random-output-len 1536 \ + --num-prompts 1 \ + --random-range-ratio 1 \ + --request-rate inf +``` + +### Kimi-K2.6 W4A8 1P1D 16P IN64K OUT1K5 PREFIX90 100ms + +**Model**: Kimi-K2.6 + +**Hardware**: Atlas 800I A3 + +**Cards**: 16 + +**Deploy Mode**: PD Disaggregation + +**Quantization**: W4A8 INT8 + +**Dataset**: 64K+1.5K (90% prefix cache hit rate) + +**TPOT**: 100ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT=60 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +P_IP=('') +D_IP=('') + +export ASCEND_MF_STORE_URL="tcp://: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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=8 + export HCCL_SOCKET_IFNAME= + export SGLANG_ENABLE_TP_MEMORY_INBALANCE_CHECK=0 + export SGLANG_ZBAL_BOOTSTRAP_URL=tcp://127.0.0.1:24699 + export SGLANG_ZBAL_LOCAL_MEM_SIZE=61184 + export ZBAL_ENABLE_GRAPH=1 + export ZBAL_HCCL_OP=send,recv + export ZBAL_NPU_ALLOC_CONF=use_vmm_for_static_memory:True + + 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 \ + --quantization modelslim \ + --dtype bfloat16 \ + --disaggregation-transfer-backend ascend \ + --nnodes 1 \ + --trust-remote-code \ + --attention-backend ascend \ + --device npu \ + --tp-size 16 \ + --mem-fraction-static 0.78 \ + --max-running-requests 2 \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --chunked-prefill-size 16384 \ + --prefill-max-requests 2 \ + --max-prefill-tokens 65536 \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --sampling-backend ascend + NODE_RANK=$i + 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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=1200 + export HCCL_SOCKET_IFNAME= + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=64 + export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 + export SGLANG_ENABLE_SPEC_V2=1 + export SGLANG_NPU_USE_MLAPO=1 + export SGLANG_NPU_USE_MULTI_STREAM=1 + + python3 -m sglang.launch_server \ + --model-path ${MODEL_PATH} \ + --disaggregation-mode decode \ + --host ${D_IP[$i]} \ + --port 8001 \ + --quantization modelslim \ + --dtype bfloat16 \ + --disaggregation-transfer-backend ascend \ + --nnodes 1 \ + --trust-remote-code \ + --attention-backend ascend \ + --device npu \ + --tp-size 16 \ + --mem-fraction-static 0.82 \ + --max-running-requests 2 \ + --enable-dp-attention \ + --dp-size 2 \ + --enable-dp-lm-head \ + --disable-radix-cache \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --sampling-backend ascend \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --cuda-graph-bs 1 2 4 6 8 12 + NODE_RANK=$i + break + fi +done +``` + +```shell Command +# ============================================================ +# Before running, replace the following placeholders: +# : prefill node IP address +# : decode node IP address +# ============================================================ + +python -m sglang_router.launch_router \ + --pd-disaggregation \ + --prefill http://:8000 8998 \ + --decode http://:8001 \ + --host 127.0.0.1 \ + --port 6688 \ + --policy cache_aware +``` + +#### Benchmark + +We tested it based on the `generated-shared-prefix` dataset with 90% cache hit (`repeat_rate = 0.9`): +`--gsp-system-prompt-len 58982` = `int(65536 * 0.9)` is the shared prefix portion. +`--gsp-question-len 6553` = `int(65536 * (1 - 0.9))` is the unique per-request suffix. +`--gsp-num-groups 1` keeps all requests in one prefix group for maximum cache reuse. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name generated-shared-prefix \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --gsp-num-groups 1 \ + --gsp-prompts-per-group 16 \ + --gsp-system-prompt-len 58982 \ + --gsp-question-len 6553 \ + --gsp-output-len 1536 \ + --max-concurrency 2 \ + --num-prompts 16 \ + --request-rate inf +``` + +### Kimi-K2.6 W4A8 1P1D 24P IN128K OUT1K PREFIX90 100ms + +**Model**: Kimi-K2.6 + +**Hardware**: Atlas 800I A3 + +**Cards**: 24 + +**Deploy Mode**: PD Disaggregation + +**Quantization**: W4A8 INT8 + +**Dataset**: 128K+1K (90% prefix cache hit rate) + +**TPOT**: 100ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 +# DRAFT_MODEL_PATH: path to the draft 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 DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT=60 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +P_IP=('') +D_IP=('' '') + +export ASCEND_MF_STORE_URL="tcp://:24670" + +MODEL_PATH=/path/to/model-weights +DRAFT_MODEL_PATH=/path/to/draft-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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=1800 + export HCCL_SOCKET_IFNAME= + + 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 \ + --quantization modelslim \ + --dtype bfloat16 \ + --nnodes 1 \ + --trust-remote-code \ + --attention-backend ascend \ + --device npu \ + --tp-size 16 \ + --mem-fraction-static 0.78 \ + --max-running-requests 8 \ + --chunked-prefill-size 16384 \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --sampling-backend ascend \ + --moe-a2a-backend deepep \ + --deepep-mode auto + NODE_RANK=$i + 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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=1200 + export HCCL_SOCKET_IFNAME= + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=64 + export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 + export SGLANG_ENABLE_SPEC_V2=1 + export SGLANG_NPU_USE_MLAPO=1 + export SGLANG_NPU_USE_MULTI_STREAM=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 \ + --quantization modelslim \ + --dtype bfloat16 \ + --nnodes 2 \ + --trust-remote-code \ + --attention-backend ascend \ + --device npu \ + --tp-size 32 \ + --mem-fraction-static 0.82 \ + --max-running-requests 32 \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --sampling-backend ascend \ + --enable-dp-attention \ + --dp-size 4 \ + --disable-radix-cache \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --cuda-graph-bs 8 \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 1 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 2 \ + --speculative-draft-model-quantization unquant + NODE_RANK=$i + break + fi +done +``` + +```shell Command +# ============================================================ +# Before running, replace the following placeholders: +# : prefill node IP address +# : first decode node IP address (decode may have distributed nodes) +# ============================================================ + +python -m sglang_router.launch_router \ + --pd-disaggregation \ + --prefill http://:8000 8998 \ + --decode http://:8001 \ + --host 127.0.0.1 \ + --port 6688 \ + --policy cache_aware +``` + +#### Benchmark + +We tested it based on the `generated-shared-prefix` dataset with 90% cache hit (`repeat_rate = 0.9`): +`--gsp-system-prompt-len 117964` = `int(131072 * 0.9)` is the shared prefix portion. +`--gsp-question-len 13107` = `int(131072 * (1 - 0.9))` is the unique per-request suffix. +`--gsp-num-groups 1` keeps all requests in one prefix group for maximum cache reuse. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name generated-shared-prefix \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --gsp-num-groups 1 \ + --gsp-prompts-per-group 8 \ + --gsp-system-prompt-len 117964 \ + --gsp-question-len 13107 \ + --gsp-output-len 1024 \ + --max-concurrency 8 \ + --num-prompts 8 \ + --request-rate inf +``` + +### Kimi-K2.6 W4A8 1P1D 24P IN64K OUT1K5 PREFIX90 100ms + +**Model**: Kimi-K2.6 + +**Hardware**: Atlas 800I A3 + +**Cards**: 24 + +**Deploy Mode**: PD Disaggregation + +**Quantization**: W4A8 INT8 + +**Dataset**: 64K+1.5K (90% prefix cache hit rate) + +**TPOT**: 100ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 +# DRAFT_MODEL_PATH: path to the draft 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 DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT=60 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +P_IP=('') +D_IP=('' '') + +export ASCEND_MF_STORE_URL="tcp://:24670" + +MODEL_PATH=/path/to/model-weights +DRAFT_MODEL_PATH=/path/to/draft-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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=1800 + export HCCL_SOCKET_IFNAME= + + 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 \ + --quantization modelslim \ + --dtype bfloat16 \ + --nnodes 1 \ + --trust-remote-code \ + --attention-backend ascend \ + --device npu \ + --tp-size 16 \ + --mem-fraction-static 0.78 \ + --max-running-requests 8 \ + --chunked-prefill-size 16384 \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --sampling-backend ascend \ + --moe-a2a-backend deepep \ + --deepep-mode auto + NODE_RANK=$i + 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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=1200 + export HCCL_SOCKET_IFNAME= + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=64 + export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 + export SGLANG_ENABLE_SPEC_V2=1 + export SGLANG_NPU_USE_MLAPO=1 + export SGLANG_NPU_USE_MULTI_STREAM=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 \ + --quantization modelslim \ + --dtype bfloat16 \ + --nnodes 2 \ + --trust-remote-code \ + --attention-backend ascend \ + --device npu \ + --tp-size 32 \ + --mem-fraction-static 0.82 \ + --max-running-requests 32 \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --sampling-backend ascend \ + --enable-dp-attention \ + --dp-size 4 \ + --disable-radix-cache \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --cuda-graph-bs 8 \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 1 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 2 \ + --speculative-draft-model-quantization unquant + NODE_RANK=$i + break + fi +done +``` + +```shell Command +# ============================================================ +# Before running, replace the following placeholders: +# : prefill node IP address +# : first decode node IP address (decode may have distributed nodes) +# ============================================================ + +python -m sglang_router.launch_router \ + --pd-disaggregation \ + --prefill http://:8000 8998 \ + --decode http://:8001 \ + --host 127.0.0.1 \ + --port 6688 \ + --policy cache_aware +``` + +#### Benchmark + +We tested it based on the `generated-shared-prefix` dataset with 90% cache hit (`repeat_rate = 0.9`): +`--gsp-system-prompt-len 58982` = `int(65536 * 0.9)` is the shared prefix portion. +`--gsp-question-len 6553` = `int(65536 * (1 - 0.9))` is the unique per-request suffix. +`--gsp-num-groups 1` keeps all requests in one prefix group for maximum cache reuse. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name generated-shared-prefix \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --gsp-num-groups 1 \ + --gsp-prompts-per-group 16 \ + --gsp-system-prompt-len 58982 \ + --gsp-question-len 6553 \ + --gsp-output-len 1536 \ + --max-concurrency 16 \ + --num-prompts 16 \ + --request-rate inf +``` + +### Kimi-K2.6 W4A8 8P IN1024X1024 30 OUT1024 50ms + +**Model**: Kimi-K2.6 + +**Hardware**: Atlas 800I A3 + +**Cards**: 8 + +**Deploy Mode**: PD Mixed + +**Quantization**: W4A8 INT8 + +**Dataset**: 1024x1024 (30)+1024 + +*Format: resolution (input tokens) + output tokens* + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-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 DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export HCCL_BUFFSIZE=1500 +export HCCL_OP_EXPANSION_MODE=AIV +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=112 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_NPU_USE_MULTI_STREAM=1 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --quantization modelslim \ + --dtype bfloat16 \ + --model-loader-extra-config {"enable_multithread_load": true} \ + --trust-remote-code \ + --device npu \ + --attention-backend ascend \ + --tp-size 16 \ + --mem-fraction-static 0.76 \ + --max-running-requests 176 \ + --chunked-prefill-size 32768 \ + --context-length 8192 \ + --max-prefill-tokens 16384 \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --sampling-backend ascend \ + --enable-dp-attention \ + --dp-size 16 \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --cuda-graph-bs 1 2 4 8 9 10 11 \ + --disable-radix-cache \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 2 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 3 \ + --speculative-draft-model-quantization unquant \ + --prefill-delayer-max-delay-passes 200 \ + --enable-prefill-delayer +``` + +#### Benchmark + +We tested it based on the `IMAGE` dataset with 1024x1024 resolution. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name image \ + --backend sglang-oai-chat \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 160 \ + --random-input-len 30 \ + --random-output-len 1024 \ + --num-prompts 640 \ + --random-range-ratio 1 \ + --request-rate inf \ + --warmup-requests 16 \ + --image-count 1 \ + --image-resolution 1024x1024 +``` + +### Kimi-K2.6 W4A8 8P IN1080P 30 OUT256 50ms + +**Model**: Kimi-K2.6 + +**Hardware**: Atlas 800I A3 + +**Cards**: 8 + +**Deploy Mode**: PD Mixed + +**Quantization**: W4A8 INT8 + +**Dataset**: 1080p_30+256 + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-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 DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export HCCL_BUFFSIZE=1800 +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=64 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --quantization modelslim \ + --dtype bfloat16 \ + --model-loader-extra-config {"enable_multithread_load": true} \ + --trust-remote-code \ + --device npu \ + --attention-backend ascend \ + --tp-size 16 \ + --mem-fraction-static 0.7 \ + --max-running-requests 80 \ + --chunked-prefill-size -1 \ + --context-length 8192 \ + --prefill-max-requests 1 \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --sampling-backend ascend \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --enable-dp-attention \ + --dp-size 16 \ + --cuda-graph-bs 1 2 4 6 8 10 \ + --disable-radix-cache \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 4 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 5 \ + --speculative-draft-model-quantization unquant +``` + +#### Benchmark + +We tested it based on the `IMAGE` dataset with 1920x1080 resolution. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name image \ + --backend sglang-oai-chat \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 20 \ + --random-input-len 30 \ + --random-output-len 256 \ + --num-prompts 20 \ + --random-range-ratio 1 \ + --request-rate inf \ + --image-count 1 \ + --image-resolution 1920x1080 +``` + +### Kimi-K2.6 W4A8 8P IN3K5 OUT1K5 20ms + +**Model**: Kimi-K2.6 + +**Hardware**: Atlas 800I A3 + +**Cards**: 8 + +**Deploy Mode**: PD Mixed + +**Quantization**: W4A8 INT8 + +**Dataset**: 3.5K+1.5K + +**TPOT**: 20ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-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 DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=1200 +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=96 +export SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT=600 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_NPU_USE_MLAPO=1 +export SGLANG_NPU_USE_MULTI_STREAM=1 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --trust-remote-code \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --dtype bfloat16 \ + --tp-size 16 \ + --mem-fraction-static 0.753 \ + --max-running-requests 80 \ + --chunked-prefill-size 32768 \ + --context-length 6144 \ + --max-prefill-tokens 65536 \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --sampling-backend ascend \ + --enable-dp-attention \ + --dp-size 16 \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --cuda-graph-bs 1 2 3 4 5 \ + --disable-radix-cache \ + --model-loader-extra-config {"enable_multithread_load": true} \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 4 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 5 \ + --speculative-draft-model-quantization unquant \ + --prefill-delayer-max-delay-passes 200 \ + --enable-prefill-delayer +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 64 \ + --random-input-len 3500 \ + --random-output-len 1500 \ + --num-prompts 256 \ + --random-range-ratio 1 \ + --warmup-requests 0 +``` + +### Kimi-K2.6 W4A8 8P IN3K5 OUT1K5 50ms + +**Model**: Kimi-K2.6 + +**Hardware**: Atlas 800I A3 + +**Cards**: 8 + +**Deploy Mode**: PD Mixed + +**Quantization**: W4A8 INT8 + +**Dataset**: 3.5K+1.5K + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-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 DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=1200 +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=96 +export SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT=600 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --trust-remote-code \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --dtype bfloat16 \ + --tp-size 16 \ + --mem-fraction-static 0.783 \ + --max-running-requests 208 \ + --chunked-prefill-size 32768 \ + --context-length 6144 \ + --max-prefill-tokens 16384 \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --sampling-backend ascend \ + --enable-dp-attention \ + --dp-size 16 \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --cuda-graph-bs 1 2 4 8 12 13 \ + --disable-radix-cache \ + --model-loader-extra-config {"enable_multithread_load": true} \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 4 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 5 \ + --speculative-draft-model-quantization unquant \ + --prefill-delayer-max-delay-passes 200 \ + --enable-prefill-delayer +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 192 \ + --random-input-len 3500 \ + --random-output-len 1500 \ + --num-prompts 768 \ + --random-range-ratio 1 \ + --warmup-requests 0 +``` diff --git a/docs_new/docs/hardware-platforms/ascend-npus/best_practice/minimax_m2_5.mdx b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/minimax_m2_5.mdx new file mode 100644 index 000000000..a6915cd2f --- /dev/null +++ b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/minimax_m2_5.mdx @@ -0,0 +1,1090 @@ +--- +title: "MiniMax-M2.5" +metatags: + description: "Best Practice for MiniMax-M2.5 on Ascend NPU" +--- + +This guide describes the best practice data for MiniMax-M2.5 on the Ascend NPU. + +### Low Latency + +| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration | +| --- | --- | --- | --- | --- | --- | --- | --- | +| MiniMax-M2.5 | Atlas 800I A3 | 8 | PD Mixed | 128K+1K (90% prefix cache hit rate) | 20ms | W8A8 INT8 | [Optimal Configuration](#minimax-m2-5-w8a8-8p-in128k-out1k-prefix90-20ms) | +| MiniMax-M2.5 | Atlas 800I A3 | 8 | PD Mixed | 3.5K+1.5K | 20ms | W8A8 INT8 | [Optimal Configuration](#minimax-m2-5-w8a8-8p-in3k5-out1k5-20ms) | + +### High Throughput + +| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration | +| --- | --- | --- | --- | --- | --- | --- | --- | +| MiniMax-M2.5 | Atlas 800I A3 | 16 | PD Disaggregation | 128K+1K (90% prefix cache hit rate) | 50ms | W8A8 INT8 | [Optimal Configuration](#minimax-m2-5-w8a8-1p1d-16p-in128k-out1k-prefix90-50ms) | +| MiniMax-M2.5 | Atlas 800I A3 | 16 | PD Disaggregation | 64K+1K (90% prefix cache hit rate) | 50ms | W8A8 INT8 | [Optimal Configuration](#minimax-m2-5-w8a8-1p1d-16p-in64k-out1k-prefix90-50ms) | +| MiniMax-M2.5 | Atlas 800I A3 | 4 | PD Mixed | 32K+1K | 50ms | W8A8 INT8 | [Optimal Configuration](#minimax-m2-5-w8a8-4p-in32k-out1k-50ms) | +| MiniMax-M2.5 | Atlas 800I A3 | 4 | PD Mixed | 64K+1K (90% prefix cache hit rate) | 50ms | W8A8 INT8 | [Optimal Configuration](#minimax-m2-5-w8a8-4p-in64k-out1k-prefix90-50ms) | +| MiniMax-M2.5 | Atlas 800I A3 | 8 | PD Mixed | 128K+1K (90% prefix cache hit rate) | 50ms | W8A8 INT8 | [Optimal Configuration](#minimax-m2-5-w8a8-8p-in128k-out1k-prefix90-50ms) | +| MiniMax-M2.5 | Atlas 800I A3 | 8 | PD Mixed | 3.5K+1.5K | 50ms | W8A8 INT8 | [Optimal Configuration](#minimax-m2-5-w8a8-8p-in3k5-out1k5-50ms) | + + +## Optimal Configuration + +### MiniMax-M2.5 W8A8 1P1D 16P IN128K OUT1K PREFIX90 50ms + +**Model**: MiniMax-M2.5 + +**Hardware**: Atlas 800I A3 + +**Cards**: 16 + +**Deploy Mode**: PD Disaggregation + +**Quantization**: W8A8 INT8 + +**Dataset**: 128K+1K (90% prefix cache hit rate) + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 +# DRAFT_MODEL_PATH: path to the draft 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_EXTERNAL_MODEL_PACKAGE=custom_eagle3 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +P_IP=('') +D_IP=('') + +export ASCEND_MF_STORE_URL="tcp://:24670" + +MODEL_PATH=/path/to/model-weights +DRAFT_MODEL_PATH=/path/to/draft-model-weights +export PYTHONPATH=${DRAFT_MODEL_PATH}:$PYTHONPATH + +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 ASCEND_USE_FIA=1 + export DEEPEP_NORMAL_COMBINE_ENABLE_LONG_SEQ=1 + export DEEPEP_NORMAL_LONG_SEQ_PER_ROUND_TOKENS=2048 + export DEEPEP_NORMAL_LONG_SEQ_ROUND=64 + export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 + export ENABLE_PROFILING=0 + export GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=2500 + export HCCL_SOCKET_IFNAME= + export PROFILING_BS=8 + export PROFILING_STAGE=prefill + export PROFILING_step=30 + 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 \ + --trust-remote-code \ + --tp-size 16 \ + --mem-fraction-static 0.43 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --disaggregation-transfer-backend ascend \ + --max-running-requests 128 \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 130000 \ + --moe-a2a-backend deepep \ + --deepep-mode normal \ + --tokenizer-worker-num 16 \ + --dp-size 2 \ + --enable-dp-attention \ + --dtype bfloat16 \ + --load-balance-method round_robin \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 2 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 3 \ + --speculative-draft-model-quantization unquant \ + --skip-server-warmup + NODE_RANK=$i + 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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=1600 + export HCCL_SOCKET_IFNAME= + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=640 + export SGLANG_DISAGGREGATION_NUM_PRE_ALLOCATE_REQS=96 + export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 + export SGLANG_ENABLE_SPEC_V2=1 + export SGLANG_NPU_FUSED_MOE_MODE=2 + + python3 -m sglang.launch_server \ + --model-path ${MODEL_PATH} \ + --disaggregation-mode decode \ + --host ${D_IP[$i]} \ + --port 8001 \ + --trust-remote-code \ + --tp-size 16 \ + --mem-fraction-static 0.76 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --disaggregation-transfer-backend ascend \ + --max-running-requests 80 \ + --chunked-prefill-size -1 \ + --moe-a2a-backend ascend_fuseep \ + --deepep-mode low_latency \ + --tokenizer-worker-num 8 \ + --dp-size 2 \ + --enable-dp-attention \ + --dtype bfloat16 \ + --load-balance-method round_robin \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 2 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 3 \ + --speculative-draft-model-quantization unquant \ + --skip-server-warmup \ + --cuda-graph-bs 2 4 8 + NODE_RANK=$i + break + fi +done +``` + +```shell Command +# ============================================================ +# Before running, replace the following placeholders: +# : prefill node IP address +# : decode node IP address +# ============================================================ + +python -m sglang_router.launch_router \ + --pd-disaggregation \ + --prefill http://:8000 8998 \ + --decode http://:8001 \ + --host 127.0.0.1 \ + --port 6688 \ + --policy round_robin --mini-lb +``` + +#### Benchmark + +We tested it based on the `generated-shared-prefix` dataset with 90% cache hit (`repeat_rate = 0.9`): +`--gsp-system-prompt-len 117964` = `int(131072 * 0.9)` is the shared prefix portion. +`--gsp-question-len 13107` = `int(131072 * (1 - 0.9))` is the unique per-request suffix. +`--gsp-num-groups 1` keeps all requests in one prefix group for maximum cache reuse. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name generated-shared-prefix \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --gsp-num-groups 1 \ + --gsp-prompts-per-group 32 \ + --gsp-system-prompt-len 117964 \ + --gsp-question-len 13107 \ + --gsp-output-len 1024 \ + --max-concurrency 8 \ + --num-prompts 32 \ + --request-rate inf +``` + +### MiniMax-M2.5 W8A8 1P1D 16P IN64K OUT1K PREFIX90 50ms + +**Model**: MiniMax-M2.5 + +**Hardware**: Atlas 800I A3 + +**Cards**: 16 + +**Deploy Mode**: PD Disaggregation + +**Quantization**: W8A8 INT8 + +**Dataset**: 64K+1K (90% prefix cache hit rate) + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 +# DRAFT_MODEL_PATH: path to the draft 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_EXTERNAL_MODEL_PACKAGE=custom_eagle3 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +P_IP=('') +D_IP=('') + +export ASCEND_MF_STORE_URL="tcp://:24670" + +MODEL_PATH=/path/to/model-weights +DRAFT_MODEL_PATH=/path/to/draft-model-weights +export PYTHONPATH=${DRAFT_MODEL_PATH}:$PYTHONPATH + +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 ASCEND_USE_FIA=1 + export DEEPEP_NORMAL_COMBINE_ENABLE_LONG_SEQ=1 + export DEEPEP_NORMAL_LONG_SEQ_PER_ROUND_TOKENS=2048 + export DEEPEP_NORMAL_LONG_SEQ_ROUND=64 + export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 + export ENABLE_PROFILING=0 + export GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=2500 + export HCCL_SOCKET_IFNAME= + export PROFILING_BS=8 + export PROFILING_STAGE=prefill + export PROFILING_step=30 + 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 \ + --trust-remote-code \ + --tp-size 16 \ + --mem-fraction-static 0.43 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --disaggregation-transfer-backend ascend \ + --max-running-requests 128 \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 58000 \ + --moe-a2a-backend deepep \ + --deepep-mode normal \ + --tokenizer-worker-num 16 \ + --dp-size 2 \ + --enable-dp-attention \ + --dtype bfloat16 \ + --load-balance-method round_robin \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --speculative-draft-model-quantization unquant \ + --skip-server-warmup + NODE_RANK=$i + 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 GLOO_SOCKET_IFNAME= + export HCCL_BUFFSIZE=1600 + export HCCL_SOCKET_IFNAME= + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=640 + export SGLANG_DISAGGREGATION_NUM_PRE_ALLOCATE_REQS=96 + export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 + export SGLANG_ENABLE_SPEC_V2=1 + export SGLANG_NPU_FUSED_MOE_MODE=2 + + python3 -m sglang.launch_server \ + --model-path ${MODEL_PATH} \ + --disaggregation-mode decode \ + --host ${D_IP[$i]} \ + --port 8001 \ + --trust-remote-code \ + --tp-size 16 \ + --mem-fraction-static 0.76 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --disaggregation-transfer-backend ascend \ + --max-running-requests 80 \ + --chunked-prefill-size -1 \ + --moe-a2a-backend ascend_fuseep \ + --deepep-mode low_latency \ + --tokenizer-worker-num 16 \ + --dp-size 2 \ + --enable-dp-attention \ + --dtype bfloat16 \ + --load-balance-method round_robin \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --speculative-draft-model-quantization unquant \ + --skip-server-warmup \ + --cuda-graph-bs 2 4 8 16 24 32 40 + NODE_RANK=$i + break + fi +done +``` + +```shell Command +# ============================================================ +# Before running, replace the following placeholders: +# : prefill node IP address +# : decode node IP address +# ============================================================ + +python -m sglang_router.launch_router \ + --pd-disaggregation \ + --prefill http://:8000 8998 \ + --decode http://:8001 \ + --host 127.0.0.1 \ + --port 6688 \ + --policy round_robin --mini-lb +``` + +#### Benchmark + +We tested it based on the `generated-shared-prefix` dataset with 90% cache hit (`repeat_rate = 0.9`): +`--gsp-system-prompt-len 58982` = `int(65536 * 0.9)` is the shared prefix portion. +`--gsp-question-len 6553` = `int(65536 * (1 - 0.9))` is the unique per-request suffix. +`--gsp-num-groups 1` keeps all requests in one prefix group for maximum cache reuse. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name generated-shared-prefix \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --gsp-num-groups 1 \ + --gsp-prompts-per-group 640 \ + --gsp-system-prompt-len 58982 \ + --gsp-question-len 6553 \ + --gsp-output-len 1024 \ + --max-concurrency 160 \ + --num-prompts 640 \ + --request-rate inf +``` + +### MiniMax-M2.5 W8A8 4P IN32K OUT1K 50ms + +**Model**: MiniMax-M2.5 + +**Hardware**: Atlas 800I A3 + +**Cards**: 4 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 32K+1K + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-model-weights +export PYTHONPATH=${DRAFT_MODEL_PATH}:$PYTHONPATH + +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 ASCEND_USE_FIA=1 +export DEEPEP_NORMAL_COMBINE_ENABLE_LONG_SEQ=1 +export DEEPEP_NORMAL_LONG_SEQ_PER_ROUND_TOKENS=2048 +export DEEPEP_NORMAL_LONG_SEQ_ROUND=64 +export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=128 +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=640 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_ENABLE_TP_MEMORY_INBALANCE_CHECK=0 +export SGLANG_EXTERNAL_MODEL_PACKAGE=custom_eagle3 +export SGLANG_SET_CPU_AFFINITY=1 +export SGLANG_ZBAL_LOCAL_MEM_SIZE=60184 +export STREAMS_PER_DEVICE=32 +export TASK_QUEUE_ENABLE=1 +export ZBAL_ENABLE_GRAPH=1 +export ZBAL_HCCL_OP=allreduce,_allgather_base,allgather,broadcast,scatter,reduce_scatter,_reduce_scatter_base,alltoall_base +export ZBAL_NPU_ALLOC_CONF=use_vmm_for_static_memory:True + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --tp-size 8 \ + --disable-radix-cache \ + --mem-fraction-static 0.74 \ + --max-running-requests 18 \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 32768 \ + --cuda-graph-bs 2 4 6 8 10 12 14 16 18 24 \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --quantization modelslim \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --speculative-draft-model-quantization unquant \ + --dtype bfloat16 \ + --trust-remote-code \ + --tokenizer-worker-num 4 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 18 \ + --random-input-len 32768 \ + --random-output-len 1024 \ + --num-prompts 72 \ + --random-range-ratio 1 +``` + +### MiniMax-M2.5 W8A8 4P IN64K OUT1K PREFIX90 50ms + +**Model**: MiniMax-M2.5 + +**Hardware**: Atlas 800I A3 + +**Cards**: 4 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 64K+1K (90% prefix cache hit rate) + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-model-weights +export PYTHONPATH=${DRAFT_MODEL_PATH}:$PYTHONPATH + +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 ASCEND_USE_FIA=1 +export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=1024 +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=140000 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_EXTERNAL_MODEL_PACKAGE=custom_eagle3 +export SGLANG_NPU_FUSED_MOE_MODE=2 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 +export TASK_QUEUE_ENABLE=1 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --tp-size 8 \ + --mem-fraction-static 0.63 \ + --max-running-requests 26 \ + --reasoning-parser minimax-append-think \ + --tool-call-parser minimax-m2 \ + --enable-prefill-delayer \ + --prefill-max-requests 10 \ + --chunked-prefill-size 67072 \ + --max-prefill-token 67000 \ + --cuda-graph-bs 2 4 8 12 16 18 20 22 24 26 \ + --moe-a2a-backend ascend_fuseep \ + --deepep-mode auto \ + --quantization modelslim \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --speculative-draft-model-quantization unquant \ + --dtype bfloat16 \ + --trust-remote-code +``` + +#### Benchmark + +We tested it based on the `generated-shared-prefix` dataset with 90% cache hit (`repeat_rate = 0.9`): +`--gsp-system-prompt-len 58982` = `int(65536 * 0.9)` is the shared prefix portion. +`--gsp-question-len 6553` = `int(65536 * (1 - 0.9))` is the unique per-request suffix. +`--gsp-num-groups 1` keeps all requests in one prefix group for maximum cache reuse. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name generated-shared-prefix \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --gsp-num-groups 1 \ + --gsp-prompts-per-group 104 \ + --gsp-system-prompt-len 58982 \ + --gsp-question-len 6553 \ + --gsp-output-len 1024 \ + --max-concurrency 26 \ + --num-prompts 104 \ + --request-rate inf +``` + +### MiniMax-M2.5 W8A8 8P IN128K OUT1K PREFIX90 20ms + +**Model**: MiniMax-M2.5 + +**Hardware**: Atlas 800I A3 + +**Cards**: 8 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 128K+1K (90% prefix cache hit rate) + +**TPOT**: 20ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-model-weights +export PYTHONPATH=${DRAFT_MODEL_PATH}:$PYTHONPATH + +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 ASCEND_USE_FIA=1 +export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=1024 +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=160000 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_EXTERNAL_MODEL_PACKAGE=custom_eagle3 +export SGLANG_NPU_FUSED_MOE_MODE=2 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 +export TASK_QUEUE_ENABLE=1 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --tp-size 16 \ + --dp-size 2 \ + --enable-dp-attention \ + --mem-fraction-static 0.65 \ + --max-running-requests 4 \ + --reasoning-parser minimax-append-think \ + --tool-call-parser minimax-m2 \ + --enable-prefill-delayer \ + --prefill-max-requests 4 \ + --chunked-prefill-size 160000 \ + --max-prefill-token 80000 \ + --cuda-graph-bs 2 4 6 8 \ + --moe-a2a-backend ascend_fuseep \ + --deepep-mode auto \ + --quantization modelslim \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --speculative-draft-model-quantization unquant \ + --tokenizer-worker-num 4 \ + --dtype bfloat16 +``` + +#### Benchmark + +We tested it based on the `generated-shared-prefix` dataset with 90% cache hit (`repeat_rate = 0.9`): +`--gsp-system-prompt-len 117964` = `int(131072 * 0.9)` is the shared prefix portion. +`--gsp-question-len 13107` = `int(131072 * (1 - 0.9))` is the unique per-request suffix. +`--gsp-num-groups 1` keeps all requests in one prefix group for maximum cache reuse. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name generated-shared-prefix \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --gsp-num-groups 1 \ + --gsp-prompts-per-group 16 \ + --gsp-system-prompt-len 117964 \ + --gsp-question-len 13107 \ + --gsp-output-len 1024 \ + --max-concurrency 4 \ + --num-prompts 16 \ + --request-rate inf +``` + +### MiniMax-M2.5 W8A8 8P IN128K OUT1K PREFIX90 50ms + +**Model**: MiniMax-M2.5 + +**Hardware**: Atlas 800I A3 + +**Cards**: 8 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 128K+1K (90% prefix cache hit rate) + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-model-weights +export PYTHONPATH=${DRAFT_MODEL_PATH}:$PYTHONPATH + +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 ASCEND_USE_FIA=1 +export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=1024 +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=160000 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_EXTERNAL_MODEL_PACKAGE=custom_eagle3 +export SGLANG_NPU_FUSED_MOE_MODE=2 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 +export TASK_QUEUE_ENABLE=1 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --tp-size 16 \ + --dp-size 2 \ + --enable-dp-attention \ + --mem-fraction-static 0.65 \ + --max-running-requests 20 \ + --reasoning-parser minimax-append-think \ + --tool-call-parser minimax-m2 \ + --enable-prefill-delayer \ + --prefill-max-requests 4 \ + --chunked-prefill-size 160000 \ + --max-prefill-tokens 80000 \ + --cuda-graph-bs 2 4 6 8 10 16 \ + --moe-a2a-backend ascend_fuseep \ + --deepep-mode auto \ + --quantization modelslim \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --speculative-draft-model-quantization unquant \ + --tokenizer-worker-num 4 \ + --dtype bfloat16 +``` + +#### Benchmark + +We tested it based on the `generated-shared-prefix` dataset with 90% cache hit (`repeat_rate = 0.9`): +`--gsp-system-prompt-len 117964` = `int(131072 * 0.9)` is the shared prefix portion. +`--gsp-question-len 13107` = `int(131072 * (1 - 0.9))` is the unique per-request suffix. +`--gsp-num-groups 1` keeps all requests in one prefix group for maximum cache reuse. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name generated-shared-prefix \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --gsp-num-groups 1 \ + --gsp-prompts-per-group 80 \ + --gsp-system-prompt-len 117964 \ + --gsp-question-len 13107 \ + --gsp-output-len 1024 \ + --max-concurrency 20 \ + --num-prompts 80 \ + --request-rate inf +``` + +### MiniMax-M2.5 W8A8 8P IN3K5 OUT1K5 20ms + +**Model**: MiniMax-M2.5 + +**Hardware**: Atlas 800I A3 + +**Cards**: 8 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 3.5K+1.5K + +**TPOT**: 20ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-model-weights +export PYTHONPATH=${DRAFT_MODEL_PATH}:$PYTHONPATH + +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 ASCEND_USE_FIA=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=2048 +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=204800 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_EXTERNAL_MODEL_PACKAGE=custom_eagle3 +export SGLANG_NPU_FUSED_MOE_MODE=2 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 +export TASK_QUEUE_ENABLE=1 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --tp-size 16 \ + --enable-dp-attention \ + --dp-size 16 \ + --mem-fraction-static 0.53 \ + --max-running-requests 96 \ + --disable-radix-cache \ + --reasoning-parser minimax-append-think \ + --tool-call-parser minimax-m2 \ + --prefill-delayer-max-delay-passes 500 \ + --enable-prefill-delayer \ + --prefill-max-requests 3 \ + --chunked-prefill-size -1 \ + --max-prefill-token 8192 \ + --cuda-graph-bs 1 2 3 4 5 6 \ + --moe-a2a-backend ascend_fuseep \ + --deepep-mode auto \ + --quantization modelslim \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --speculative-draft-model-quantization unquant \ + --dtype bfloat16 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 112 \ + --random-input-len 3500 \ + --random-output-len 1500 \ + --num-prompts 448 \ + --random-range-ratio 1 +``` + +### MiniMax-M2.5 W8A8 8P IN3K5 OUT1K5 50ms + +**Model**: MiniMax-M2.5 + +**Hardware**: Atlas 800I A3 + +**Cards**: 8 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 3.5K+1.5K + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-model-weights +export PYTHONPATH=${DRAFT_MODEL_PATH}:$PYTHONPATH + +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 ASCEND_USE_FIA=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=1024 +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=204800 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_EXTERNAL_MODEL_PACKAGE=custom_eagle3 +export SGLANG_NPU_FUSED_MOE_MODE=2 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 +export TASK_QUEUE_ENABLE=1 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --tp-size 16 \ + --enable-dp-attention \ + --dp-size 16 \ + --mem-fraction-static 0.75 \ + --max-running-requests 320 \ + --disable-radix-cache \ + --reasoning-parser minimax-append-think \ + --tool-call-parser minimax-m2 \ + --prefill-delayer-max-delay-passes 500 \ + --enable-prefill-delayer \ + --chunked-prefill-size -1 \ + --max-prefill-token 8192 \ + --cuda-graph-bs 1 2 4 8 12 16 20 \ + --moe-a2a-backend ascend_fuseep \ + --deepep-mode auto \ + --quantization modelslim \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --speculative-draft-model-quantization unquant \ + --dtype bfloat16 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 320 \ + --random-input-len 3500 \ + --random-output-len 1500 \ + --num-prompts 1280 \ + --random-range-ratio 1 +``` diff --git a/docs_new/docs/hardware-platforms/ascend-npus/best_practice/qwen3-8b.mdx b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/qwen3-8b.mdx new file mode 100644 index 000000000..6070d8ab1 --- /dev/null +++ b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/qwen3-8b.mdx @@ -0,0 +1,307 @@ +--- +title: "Qwen3-8B" +metatags: + description: "Best Practice for Qwen3-8B on Ascend NPU" +--- + +This guide describes the best practice data for Qwen3-8B on the Ascend NPU. + +### Low Latency + +| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration | +| --- | --- | --- | --- | --- | --- | --- | --- | +| Qwen3-8B | Atlas 800I A3 | 1 | PD Mixed | 3.5K+1.5K | 5ms | W8A8 INT8 | [Optimal Configuration](#qwen3-8b-w8a8-1p-in3k5-out1k5-5ms) | +| Qwen3-8B | Atlas 800I A3 | 1 | PD Mixed | 6K+1.5K | 11.79ms | W8A8 INT8 | [Optimal Configuration](#qwen3-8b-w8a8-1p-in6k-out1k5-bs16) | + +### High Throughput + +| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration | +| --- | --- | --- | --- | --- | --- | --- | --- | +| Qwen3-8B | Atlas 800I A3 | 1 | PD Mixed | 3.5K+1.5K | 37ms | W8A8 INT8 | [Optimal Configuration](#qwen3-8b-w8a8-1p-in3k5-out1k5-37ms) | + + +## Optimal Configuration + +### Qwen3-8B W8A8 1P IN3K5 OUT1K5 37ms + +**Model**: Qwen3-8B + +**Hardware**: Atlas 800I A3 + +**Cards**: 1 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 3.5K+1.5K + +**TPOT**: 37ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-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 GLOO_SOCKET_IFNAME= +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT=600 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_PREFILL_DELAYER_MAX_DELAY_PASSES=50 +export SGLANG_SCHEDULER_DECREASE_PREFILL_IDLE=1 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --trust-remote-code \ + --nnodes 1 \ + --node-rank 0 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --max-running-requests 70 \ + --max-prefill-tokens 16384 \ + --disable-radix-cache \ + --chunked-prefill-size 16384 \ + --tp-size 1 \ + --mem-fraction-static 0.85 \ + --cuda-graph-bs 8 12 24 36 48 51 55 60 63 64 66 68 70 \ + --dtype bfloat16 \ + --speculative-draft-model-quantization unquant \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 64 \ + --random-input-len 3500 \ + --random-output-len 1500 \ + --num-prompts 256 \ + --random-range-ratio 1 +``` + +### Qwen3-8B W8A8 1P IN3K5 OUT1K5 5ms + +**Model**: Qwen3-8B + +**Hardware**: Atlas 800I A3 + +**Cards**: 1 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 3.5K+1.5K + +**TPOT**: 5ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-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 GLOO_SOCKET_IFNAME= +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT=600 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --trust-remote-code \ + --nnodes 1 \ + --node-rank 0 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --max-running-requests 1 \ + --max-prefill-tokens 16384 \ + --disable-radix-cache \ + --chunked-prefill-size -1 \ + --tp-size 2 \ + --mem-fraction-static 0.894 \ + --cuda-graph-bs 1 \ + --dtype bfloat16 \ + --speculative-draft-model-quantization unquant \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 4 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 5 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 1 \ + --random-input-len 3500 \ + --random-output-len 1500 \ + --num-prompts 4 \ + --random-range-ratio 1 +``` + +### Qwen3-8B W8A8 1P IN6K OUT1K5 BS16 + +**Model**: Qwen3-8B + +**Hardware**: Atlas 800I A3 + +**Cards**: 1 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 6K+1.5K + +**TPOT**: 11.79ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-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 GLOO_SOCKET_IFNAME= +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT=600 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --trust-remote-code \ + --nnodes 1 \ + --node-rank 0 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --max-running-requests 16 \ + --max-prefill-tokens 16384 \ + --disable-radix-cache \ + --chunked-prefill-size -1 \ + --tp-size 2 \ + --mem-fraction-static 0.894 \ + --cuda-graph-bs 1 5 15 16 \ + --dtype bfloat16 \ + --speculative-draft-model-quantization unquant \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 4 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 5 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 16 \ + --random-input-len 6144 \ + --random-output-len 1500 \ + --num-prompts 16 \ + --random-range-ratio 1 +``` diff --git a/docs_new/docs/hardware-platforms/ascend-npus/best_practice/qwen3_235b_a22b.mdx b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/qwen3_235b_a22b.mdx new file mode 100644 index 000000000..8d9cf860e --- /dev/null +++ b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/qwen3_235b_a22b.mdx @@ -0,0 +1,226 @@ +--- +title: "Qwen3-235B-A22B" +metatags: + description: "Best Practice for Qwen3-235B-A22B on Ascend NPU" +--- + +This guide describes the best practice data for Qwen3-235B-A22B on the Ascend NPU. + +### Low Latency + +| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration | +| --- | --- | --- | --- | --- | --- | --- | --- | +| Qwen3-235B-A22B | Atlas 800I A3 | 8 | PD Mixed | 11K+1.5K | 8ms | BF16 | [Optimal Configuration](#qwen3-235b-a22b-bf16-8p-in11k-out1k5-8ms) | + +### High Throughput + +| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration | +| --- | --- | --- | --- | --- | --- | --- | --- | +| Qwen3-235B-A22B | Atlas 800I A3 | 8 | PD Mixed | 3.5K+1.5K | 50.1ms | W8A8 INT8 | [Optimal Configuration](#qwen3-235b-a22b-w8a8-8p-in3k5-out1k5-50-1ms) | + + +## Optimal Configuration + +### Qwen3-235B-A22B BF16 8P IN11K OUT1K5 8ms + +**Model**: Qwen3-235B-A22B + +**Hardware**: Atlas 800I A3 + +**Cards**: 8 + +**Deploy Mode**: PD Mixed + +**Quantization**: BF16 + +**Dataset**: 11K+1.5K + +**TPOT**: 8ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-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 GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=1600 +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT=600 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --trust-remote-code \ + --nnodes 1 \ + --node-rank 0 \ + --attention-backend ascend \ + --device npu \ + --max-running-requests 1 \ + --dtype bfloat16 \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 16384 \ + --speculative-draft-model-quantization unquant \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 4 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 5 \ + --disable-radix-cache \ + --enable-dp-lm-head \ + --tp 16 \ + --mem-fraction-static 0.78 \ + --cuda-graph-bs 1 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 1 \ + --random-input-len 11000 \ + --random-output-len 1500 \ + --num-prompts 1 \ + --random-range-ratio 1 +``` + +### Qwen3-235B-A22B W8A8 8P IN3K5 OUT1K5 50.1ms + +**Model**: Qwen3-235B-A22B + +**Hardware**: Atlas 800I A3 + +**Cards**: 8 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 3.5K+1.5K + +**TPOT**: 50.1ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-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 GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=570 +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=188416 +export SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT=600 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_NPU_FUSED_MOE_MODE=2 +export SGLANG_NPU_PROFILING=0 +export SGLANG_NPU_PROFILING_BS=27 +export SGLANG_PREFILL_DELAYER_MAX_DELAY_PASSES=100 +export SGLANG_SCHEDULER_DECREASE_PREFILL_IDLE=1 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --trust-remote-code \ + --nnodes 1 \ + --node-rank 0 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --max-running-requests 432 \ + --context-length 8192 \ + --dtype bfloat16 \ + --chunked-prefill-size 94208 \ + --max-prefill-tokens 458880 \ + --sampling-backend ascend \ + --ep-dispatch-algorithm static \ + --init-expert-location /root/.cache/modelscope/hub/models/hot_map/235B_3_5k_decode.pt \ + --disable-radix-cache \ + --moe-a2a-backend ascend_fuseep \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --speculative-draft-model-quantization unquant \ + --tp 16 \ + --dp-size 16 \ + --enable-dp-attention \ + --enable-dp-lm-head \ + --mem-fraction-static 0.8 \ + --cuda-graph-bs 1 2 4 8 16 20 24 26 27 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 432 \ + --random-input-len 3500 \ + --random-output-len 1500 \ + --num-prompts 1728 \ + --random-range-ratio 1 +``` diff --git a/docs_new/docs/hardware-platforms/ascend-npus/best_practice/qwen3_30b_a3b.mdx b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/qwen3_30b_a3b.mdx new file mode 100644 index 000000000..00ca721fb --- /dev/null +++ b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/qwen3_30b_a3b.mdx @@ -0,0 +1,419 @@ +--- +title: "Qwen3-30B-A3B" +metatags: + description: "Best Practice for Qwen3-30B-A3B on Ascend NPU" +--- + +This guide describes the best practice data for Qwen3-30B-A3B on the Ascend NPU. + +### Low Latency + +| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration | +| --- | --- | --- | --- | --- | --- | --- | --- | +| Qwen3-30B-A3B | Atlas 800I A3 | 1 | PD Mixed | 3.5K+1.5K | 10ms | W8A8 INT8 | [Optimal Configuration](#qwen3-30b-a3b-w8a8-1p-in3k5-out1k5-10ms) | +| Qwen3-30B-A3B | Atlas 800I A3 | 1 | PD Mixed | 6K+1.5K | 10.25ms | W8A8 INT8 | [Optimal Configuration](#qwen3-30b-a3b-w8a8-1p-in6k-out1k5-bs16) | + +### High Throughput + +| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration | +| --- | --- | --- | --- | --- | --- | --- | --- | +| Qwen3-30B-A3B | Atlas 800I A3 | 1 | PD Mixed | 1K+100 | 10000ms | BF16 | [Optimal Configuration](#qwen3-30b-a3b-bf16-1p-in1k-out100) | +| Qwen3-30B-A3B | Atlas 800I A3 | 1 | PD Mixed | 3.5K+1.5K | 50ms | W8A8 INT8 | [Optimal Configuration](#qwen3-30b-a3b-w8a8-1p-in3k5-out1k5-50ms) | + + +## Optimal Configuration + +### Qwen3-30B-A3B BF16 1P IN1K OUT100 + +**Model**: Qwen3-30B-A3B + +**Hardware**: Atlas 800I A3 + +**Cards**: 1 + +**Deploy Mode**: PD Mixed + +**Quantization**: BF16 + +**Dataset**: 1K+100 + +**TPOT**: 10000ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-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 ASCEND_LAUNCH_BLOCKING=0 +export DP_ROUND_ROBIN=1 +export GLOO_SOCKET_IFNAME= +export HCCL_ALGO=level0:NA;level1:ring +export HCCL_SOCKET_IFNAME= +export INF_NAN_MODE_FORCE_DISABLE=1 +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:False +export SGLANG_ALLOW_OVERWRITE_LONGER_CONTEXT_LEN=1 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_PREFILL_DELAYER_MAX_DELAY_PASSES=200 +export SGLANG_SCHEDULER_DECREASE_PREFILL_IDLE=1 +export SGLANG_USE_MAX_DP_ATT=1 +export STREAMS_PER_DEVICE=32 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --trust-remote-code \ + --nnodes 1 \ + --node-rank 0 \ + --attention-backend ascend \ + --device npu \ + --max-running-requests 168 \ + --disable-radix-cache \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 8300 \ + --speculative-draft-model-quantization unquant \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 7 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 8 \ + --tp-size 2 \ + --enable-dp-attention \ + --dp-size 2 \ + --mem-fraction-static 0.85 \ + --cuda-graph-bs 1 2 4 8 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 \ + --dtype bfloat16 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 162 \ + --random-input-len 1000 \ + --random-output-len 100 \ + --num-prompts 624 \ + --random-range-ratio 1 +``` + +### Qwen3-30B-A3B W8A8 1P IN3K5 OUT1K5 10ms + +**Model**: Qwen3-30B-A3B + +**Hardware**: Atlas 800I A3 + +**Cards**: 1 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 3.5K+1.5K + +**TPOT**: 10ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-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 ASCEND_LAUNCH_BLOCKING=0 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=400 +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT=600 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_PREFILL_DELAYER_MAX_DELAY_PASSES=200 +export SGLANG_SCHEDULER_DECREASE_PREFILL_IDLE=1 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --trust-remote-code \ + --nnodes 1 \ + --node-rank 0 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --max-running-requests 162 \ + --disable-radix-cache \ + --speculative-draft-model-quantization unquant \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 35000 \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --tp-size 2 \ + --mem-fraction-static 0.87 \ + --cuda-graph-bs 1 5 15 40 70 100 120 130 140 146 150 154 156 158 160 162 \ + --dtype bfloat16 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 1 \ + --random-input-len 3500 \ + --random-output-len 1500 \ + --num-prompts 1 \ + --random-range-ratio 1 +``` + +### Qwen3-30B-A3B W8A8 1P IN3K5 OUT1K5 50ms + +**Model**: Qwen3-30B-A3B + +**Hardware**: Atlas 800I A3 + +**Cards**: 1 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 3.5K+1.5K + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-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 ASCEND_LAUNCH_BLOCKING=0 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=400 +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT=600 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_PREFILL_DELAYER_MAX_DELAY_PASSES=200 +export SGLANG_SCHEDULER_DECREASE_PREFILL_IDLE=1 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --trust-remote-code \ + --nnodes 1 \ + --node-rank 0 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --max-running-requests 162 \ + --disable-radix-cache \ + --speculative-draft-model-quantization unquant \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 35000 \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --tp-size 2 \ + --mem-fraction-static 0.87 \ + --cuda-graph-bs 1 5 15 40 70 100 120 130 140 146 150 154 156 158 160 162 \ + --dtype bfloat16 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 160 \ + --random-input-len 3500 \ + --random-output-len 1500 \ + --num-prompts 640 \ + --random-range-ratio 1 +``` + +### Qwen3-30B-A3B W8A8 1P IN6K OUT1K5 BS16 + +**Model**: Qwen3-30B-A3B + +**Hardware**: Atlas 800I A3 + +**Cards**: 1 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 6K+1.5K + +**TPOT**: 10.25ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-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 GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=400 +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT=600 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_SET_CPU_AFFINITY=1 +export TRANSFORMERS_VERBOSITY=error + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --trust-remote-code \ + --nnodes 1 \ + --node-rank 0 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --max-running-requests 16 \ + --disable-radix-cache \ + --speculative-draft-model-quantization unquant \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 4 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 5 \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 35000 \ + --tp-size 2 \ + --mem-fraction-static 0.6 \ + --cuda-graph-bs 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 \ + --dtype bfloat16 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 16 \ + --random-input-len 6144 \ + --random-output-len 1500 \ + --num-prompts 16 \ + --random-range-ratio 1 +``` diff --git a/docs_new/docs/hardware-platforms/ascend-npus/best_practice/qwen3_32b.mdx b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/qwen3_32b.mdx new file mode 100644 index 000000000..7b8d3439f --- /dev/null +++ b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/qwen3_32b.mdx @@ -0,0 +1,312 @@ +--- +title: "Qwen3-32B" +metatags: + description: "Best Practice for Qwen3-32B on Ascend NPU" +--- + +This guide describes the best practice data for Qwen3-32B on the Ascend NPU. + +### Low Latency + +| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration | +| --- | --- | --- | --- | --- | --- | --- | --- | +| Qwen3-32B | Atlas 800I A3 | 8 | PD Mixed | 18K+4K | 6ms | BF16 | [Optimal Configuration](#qwen3-32b-bf16-8p-in18k-out4k-6ms) | + +### High Throughput + +| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration | +| --- | --- | --- | --- | --- | --- | --- | --- | +| Qwen3-32B | Atlas 800I A2 | 2 | PD Mixed | 3.5K+1.5K | 50ms | W8A8 INT8 | [Optimal Configuration](#qwen3-32b-w8a8-2p-in3k5-out1k5-50ms-a2) | +| Qwen3-32B | Atlas 800I A3 | 2 | PD Mixed | 3.5K+1.5K | 50ms | W8A8 INT8 | [Optimal Configuration](#qwen3-32b-w8a8-2p-in3k5-out1k5-50ms) | + + +## Optimal Configuration + +### Qwen3-32B BF16 8P IN18K OUT4K 6ms + +**Model**: Qwen3-32B + +**Hardware**: Atlas 800I A3 + +**Cards**: 8 + +**Deploy Mode**: PD Mixed + +**Quantization**: BF16 + +**Dataset**: 18K+4K + +**TPOT**: 6ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-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 GLOO_SOCKET_IFNAME= +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT=600 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_PREFILL_DELAYER_MAX_DELAY_PASSES=200 +export SGLANG_SCHEDULER_DECREASE_PREFILL_IDLE=1 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --trust-remote-code \ + --nnodes 1 \ + --node-rank 0 \ + --attention-backend ascend \ + --device npu \ + --max-running-requests 1 \ + --disable-radix-cache \ + --speculative-draft-model-quantization unquant \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 65536 \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 4 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 5 \ + --tp-size 16 \ + --mem-fraction-static 0.72 \ + --cuda-graph-bs 1 \ + --dtype bfloat16 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 1 \ + --random-input-len 18000 \ + --random-output-len 4000 \ + --num-prompts 1 \ + --random-range-ratio 1 +``` + +### Qwen3-32B W8A8 2P IN3K5 OUT1K5 50ms A2 + +**Model**: Qwen3-32B + +**Hardware**: Atlas 800I A2 + +**Cards**: 2 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 3.5K+1.5K + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-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 GLOO_SOCKET_IFNAME= +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT=600 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_NPU_USE_DEEPGEMM=1 +export SGLANG_PREFILL_DELAYER_MAX_DELAY_PASSES=100 +export SGLANG_SCHEDULER_DECREASE_PREFILL_IDLE=1 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --trust-remote-code \ + --nnodes 1 \ + --node-rank 0 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --max-running-requests 101 \ + --disable-radix-cache \ + --speculative-draft-model-quantization unquant \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 35000 \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --tp-size 4 \ + --mem-fraction-static 0.845 \ + --cuda-graph-bs 16 32 64 72 88 90 92 94 96 97 98 99 100 101 \ + --dtype bfloat16 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 100 \ + --random-input-len 3584 \ + --random-output-len 1536 \ + --num-prompts 400 \ + --random-range-ratio 1 +``` + +### Qwen3-32B W8A8 2P IN3K5 OUT1K5 50ms + +**Model**: Qwen3-32B + +**Hardware**: Atlas 800I A3 + +**Cards**: 2 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 3.5K+1.5K + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-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 GLOO_SOCKET_IFNAME= +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT=600 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_NPU_USE_DEEPGEMM=1 +export SGLANG_PREFILL_DELAYER_MAX_DELAY_PASSES=100 +export SGLANG_SCHEDULER_DECREASE_PREFILL_IDLE=1 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --trust-remote-code \ + --nnodes 1 \ + --node-rank 0 \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --max-running-requests 101 \ + --disable-radix-cache \ + --speculative-draft-model-quantization unquant \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 35000 \ + --speculative-algorithm EAGLE3 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --tp-size 4 \ + --mem-fraction-static 0.845 \ + --cuda-graph-bs 16 32 64 72 88 90 92 94 96 97 98 99 100 101 \ + --dtype bfloat16 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 100 \ + --random-input-len 3584 \ + --random-output-len 1536 \ + --num-prompts 400 \ + --random-range-ratio 1 +``` diff --git a/docs_new/docs/hardware-platforms/ascend-npus/best_practice/qwen3_5_397b.mdx b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/qwen3_5_397b.mdx new file mode 100644 index 000000000..8af7a7a89 --- /dev/null +++ b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/qwen3_5_397b.mdx @@ -0,0 +1,1155 @@ +--- +title: "Qwen3.5-397B" +metatags: + description: "Best Practice for Qwen3.5-397B on Ascend NPU" +--- + +This guide describes the best practice data for Qwen3.5-397B on the Ascend NPU. + +### Low Latency + +| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration | +| --- | --- | --- | --- | --- | --- | --- | --- | +| Qwen3.5-397B | Atlas 800I A3 | 8 | PD Mixed | 128K+1K | 20ms | W4A8 INT8 | [Optimal Configuration](#qwen3-5-397b-w4a8-8p-in128k-out1k-20ms) | +| Qwen3.5-397B | Atlas 800I A3 | 8 | PD Mixed | 16K+1K | 20ms | W4A8 INT8 | [Optimal Configuration](#qwen3-5-397b-w4a8-8p-in16k-out1k-20ms) | +| Qwen3.5-397B | Atlas 800I A3 | 8 | PD Mixed | 3.5K+1.5K | 20ms | W4A8 INT8 | [Optimal Configuration](#qwen3-5-397b-w4a8-8p-in3k5-out1k5-20ms) | +| Qwen3.5-397B | Atlas 800I A3 | 8 | PD Mixed | 64K+1K | 20ms | W4A8 INT8 | [Optimal Configuration](#qwen3-5-397b-w4a8-8p-in64k-out1k-20ms) | + +### High Throughput + +| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration | +| --- | --- | --- | --- | --- | --- | --- | --- | +| Qwen3.5-397B | Atlas 800I A3 | 8 | PD Mixed | 128K+1K | 50ms | W4A8 INT8 | [Optimal Configuration](#qwen3-5-397b-w4a8-8p-in128k-out1k-50ms) | +| Qwen3.5-397B | Atlas 800I A3 | 8 | PD Mixed | 128K+1K (90% prefix cache hit rate) | 50ms | W4A8 INT8 | [Optimal Configuration](#qwen3-5-397b-w4a8-8p-in128k-out1k-prefix90-50ms) | +| Qwen3.5-397B | Atlas 800I A3 | 8 | PD Mixed | 16K+1K | 50ms | W4A8 INT8 | [Optimal Configuration](#qwen3-5-397b-w4a8-8p-in16k-out1k-50ms) | +| Qwen3.5-397B | Atlas 800I A3 | 8 | PD Mixed | 3.5K+1.5K | 50ms | W4A8 INT8 | [Optimal Configuration](#qwen3-5-397b-w4a8-8p-in3k5-out1k5-50ms) | +| Qwen3.5-397B | Atlas 800I A3 | 8 | PD Mixed | 64K+1K | 50ms | W4A8 INT8 | [Optimal Configuration](#qwen3-5-397b-w4a8-8p-in64k-out1k-50ms) | +| Qwen3.5-397B | Atlas 800I A3 | 8 | PD Mixed | 64K+1K (90% prefix cache hit rate) | 50ms | W4A8 INT8 | [Optimal Configuration](#qwen3-5-397b-w4a8-8p-in64k-out1k-prefix90-50ms) | + + +## Optimal Configuration + +### Qwen3.5-397B W4A8 8P IN128K OUT1K 20ms + +**Model**: Qwen3.5-397B + +**Hardware**: Atlas 800I A3 + +**Cards**: 8 + +**Deploy Mode**: PD Mixed + +**Quantization**: W4A8 INT8 + +**Dataset**: 128K+1K + +**TPOT**: 20ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export DEEPEP_NORMAL_LONG_SEQ_PER_ROUND_TOKENS=4096 +export DEEPEP_NORMAL_LONG_SEQ_ROUND=32 +export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export GDN_ATTN_BACKEND_TRITON=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=0 +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=128 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_ENABLE_TP_MEMORY_INBALANCE_CHECK=0 +export SGLANG_SET_CPU_AFFINITY=1 +export SGLANG_ZBAL_BOOTSTRAP_URL=tcp://127.0.0.1:24669 +export SGLANG_ZBAL_LOCAL_MEM_SIZE=60672 +export STREAMS_PER_DEVICE=32 +export ZBAL_ENABLE_GRAPH=1 +export ZBAL_NPU_ALLOC_CONF=use_vmm_for_static_memory:True + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --attention-backend ascend \ + --device npu \ + --tp-size 16 \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 131072 \ + --prefill-max-requests 1 \ + --disable-radix-cache \ + --trust-remote-code \ + --max-running-requests 16 \ + --mem-fraction-static 0.6 \ + --cuda-graph-bs 2 3 4 5 6 8 10 12 14 16 \ + --quantization modelslim \ + --enable-multimodal \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --mm-attention-backend ascend_attn \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --speculative-draft-model-quantization unquant +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 3 \ + --random-input-len 131072 \ + --random-output-len 1024 \ + --num-prompts 3 \ + --random-range-ratio 1 \ + --request-rate inf \ + --warmup-requests 2 +``` + +### Qwen3.5-397B W4A8 8P IN128K OUT1K 50ms + +**Model**: Qwen3.5-397B + +**Hardware**: Atlas 800I A3 + +**Cards**: 8 + +**Deploy Mode**: PD Mixed + +**Quantization**: W4A8 INT8 + +**Dataset**: 128K+1K + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export DEEPEP_NORMAL_LONG_SEQ_PER_ROUND_TOKENS=4096 +export DEEPEP_NORMAL_LONG_SEQ_ROUND=32 +export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export GDN_ATTN_BACKEND_TRITON=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=0 +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=128 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_ENABLE_TP_MEMORY_INBALANCE_CHECK=0 +export SGLANG_SET_CPU_AFFINITY=1 +export SGLANG_ZBAL_BOOTSTRAP_URL=tcp://127.0.0.1:24669 +export SGLANG_ZBAL_LOCAL_MEM_SIZE=60672 +export STREAMS_PER_DEVICE=32 +export ZBAL_ENABLE_GRAPH=1 +export ZBAL_NPU_ALLOC_CONF=use_vmm_for_static_memory:True + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --attention-backend ascend \ + --device npu \ + --tp-size 16 \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 131072 \ + --prefill-max-requests 1 \ + --disable-radix-cache \ + --trust-remote-code \ + --max-running-requests 16 \ + --mem-fraction-static 0.6 \ + --cuda-graph-bs 2 4 6 8 12 14 16 \ + --quantization modelslim \ + --enable-multimodal \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --mm-attention-backend ascend_attn \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --speculative-draft-model-quantization unquant +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 10 \ + --random-input-len 131072 \ + --random-output-len 1024 \ + --num-prompts 10 \ + --random-range-ratio 1 \ + --request-rate inf \ + --warmup-requests 8 +``` + +### Qwen3.5-397B W4A8 8P IN128K OUT1K PREFIX90 50ms + +**Model**: Qwen3.5-397B + +**Hardware**: Atlas 800I A3 + +**Cards**: 8 + +**Deploy Mode**: PD Mixed + +**Quantization**: W4A8 INT8 + +**Dataset**: 128K+1K (90% prefix cache hit rate) + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export DEEPEP_NORMAL_LONG_SEQ_PER_ROUND_TOKENS=4096 +export DEEPEP_NORMAL_LONG_SEQ_ROUND=32 +export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export GDN_ATTN_BACKEND_TRITON=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=0 +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=128 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_ENABLE_TP_MEMORY_INBALANCE_CHECK=0 +export SGLANG_SET_CPU_AFFINITY=1 +export SGLANG_ZBAL_BOOTSTRAP_URL=tcp://127.0.0.1:24669 +export SGLANG_ZBAL_LOCAL_MEM_SIZE=59648 +export STREAMS_PER_DEVICE=32 +export ZBAL_ENABLE_GRAPH=1 +export ZBAL_NPU_ALLOC_CONF=use_vmm_for_static_memory:True + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --attention-backend ascend \ + --device npu \ + --tp-size 16 \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 131072 \ + --max-mamba-cache-size 320 \ + --prefill-max-requests 10 \ + --mamba-scheduler-strategy extra_buffer \ + --trust-remote-code \ + --max-running-requests 64 \ + --mem-fraction-static 0.6 \ + --cuda-graph-bs 2 4 6 8 10 12 16 20 24 32 40 48 56 64 \ + --quantization modelslim \ + --enable-multimodal \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --mm-attention-backend ascend_attn \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --speculative-draft-model-quantization unquant +``` + +#### Benchmark + +We tested it based on the `generated-shared-prefix` dataset with 90% cache hit (`repeat_rate = 0.9`): +`--gsp-system-prompt-len 117964` = `int(131072 * 0.9)` is the shared prefix portion. +`--gsp-question-len 13107` = `int(131072 * (1 - 0.9))` is the unique per-request suffix. +`--gsp-num-groups 1` keeps all requests in one prefix group for maximum cache reuse. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name generated-shared-prefix \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --gsp-num-groups 1 \ + --gsp-prompts-per-group 40 \ + --gsp-system-prompt-len 117964 \ + --gsp-question-len 13107 \ + --gsp-output-len 1024 \ + --max-concurrency 40 \ + --num-prompts 40 \ + --request-rate inf +``` + +### Qwen3.5-397B W4A8 8P IN16K OUT1K 20ms + +**Model**: Qwen3.5-397B + +**Hardware**: Atlas 800I A3 + +**Cards**: 8 + +**Deploy Mode**: PD Mixed + +**Quantization**: W4A8 INT8 + +**Dataset**: 16K+1K + +**TPOT**: 20ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export DEEPEP_NORMAL_LONG_SEQ_PER_ROUND_TOKENS=4096 +export DEEPEP_NORMAL_LONG_SEQ_ROUND=20 +export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export GDN_ATTN_BACKEND_TRITON=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=0 +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=128 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_ENABLE_TP_MEMORY_INBALANCE_CHECK=0 +export SGLANG_SET_CPU_AFFINITY=1 +export SGLANG_ZBAL_BOOTSTRAP_URL=tcp://127.0.0.1:24669 +export SGLANG_ZBAL_LOCAL_MEM_SIZE=59648 +export STREAMS_PER_DEVICE=32 +export ZBAL_ENABLE_GRAPH=1 +export ZBAL_NPU_ALLOC_CONF=use_vmm_for_static_memory:True + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --attention-backend ascend \ + --device npu \ + --tp-size 16 \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 50000 \ + --prefill-max-requests 4 \ + --disable-radix-cache \ + --trust-remote-code \ + --max-running-requests 48 \ + --mem-fraction-static 0.8 \ + --max-total-tokens 210000 \ + --cuda-graph-bs 2 4 6 8 10 12 \ + --quantization modelslim \ + --enable-multimodal \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --mm-attention-backend ascend_attn \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 \ + --dp-size 4 \ + --enable-dp-attention \ + --enable-dp-lm-head \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --speculative-draft-model-quantization unquant +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 40 \ + --random-input-len 16384 \ + --random-output-len 1024 \ + --num-prompts 40 \ + --random-range-ratio 1 \ + --request-rate inf \ + --warmup-requests 32 +``` + +### Qwen3.5-397B W4A8 8P IN16K OUT1K 50ms + +**Model**: Qwen3.5-397B + +**Hardware**: Atlas 800I A3 + +**Cards**: 8 + +**Deploy Mode**: PD Mixed + +**Quantization**: W4A8 INT8 + +**Dataset**: 16K+1K + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export DEEPEP_NORMAL_LONG_SEQ_PER_ROUND_TOKENS=4096 +export DEEPEP_NORMAL_LONG_SEQ_ROUND=20 +export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export GDN_ATTN_BACKEND_TRITON=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=0 +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=128 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_ENABLE_TP_MEMORY_INBALANCE_CHECK=0 +export SGLANG_SET_CPU_AFFINITY=1 +export SGLANG_ZBAL_BOOTSTRAP_URL=tcp://127.0.0.1:24669 +export SGLANG_ZBAL_LOCAL_MEM_SIZE=58624 +export STREAMS_PER_DEVICE=32 +export ZBAL_ENABLE_GRAPH=1 +export ZBAL_NPU_ALLOC_CONF=use_vmm_for_static_memory:True + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --attention-backend ascend \ + --device npu \ + --tp-size 16 \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 65536 \ + --prefill-max-requests 4 \ + --disable-radix-cache \ + --trust-remote-code \ + --max-running-requests 144 \ + --mem-fraction-static 0.8 \ + --max-total-tokens 635000 \ + --cuda-graph-bs 2 4 6 8 12 14 16 18 20 24 26 28 30 32 34 36 \ + --quantization modelslim \ + --enable-multimodal \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --mm-attention-backend ascend_attn \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 \ + --dp-size 4 \ + --enable-dp-attention \ + --enable-dp-lm-head \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --speculative-draft-model-quantization unquant +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 144 \ + --random-input-len 16384 \ + --random-output-len 1024 \ + --num-prompts 144 \ + --random-range-ratio 1 \ + --request-rate inf \ + --warmup-requests 8 +``` + +### Qwen3.5-397B W4A8 8P IN3K5 OUT1K5 20ms + +**Model**: Qwen3.5-397B + +**Hardware**: Atlas 800I A3 + +**Cards**: 8 + +**Deploy Mode**: PD Mixed + +**Quantization**: W4A8 INT8 + +**Dataset**: 3.5K+1.5K + +**TPOT**: 20ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export DEEPEP_NORMAL_LONG_SEQ_PER_ROUND_TOKENS=3584 +export DEEPEP_NORMAL_LONG_SEQ_ROUND=6 +export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export GDN_ATTN_BACKEND_TRITON=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=0 +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=128 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_ENABLE_TP_MEMORY_INBALANCE_CHECK=0 +export SGLANG_SET_CPU_AFFINITY=1 +export SGLANG_ZBAL_BOOTSTRAP_URL=tcp://127.0.0.1:24669 +export SGLANG_ZBAL_LOCAL_MEM_SIZE=58624 +export STREAMS_PER_DEVICE=32 +export ZBAL_ENABLE_GRAPH=1 +export ZBAL_NPU_ALLOC_CONF=use_vmm_for_static_memory:True + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --attention-backend ascend \ + --device npu \ + --tp-size 16 \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 35000 \ + --max-total-tokens 128000 \ + --disable-radix-cache \ + --trust-remote-code \ + --max-running-requests 160 \ + --mem-fraction-static 0.8 \ + --cuda-graph-bs 2 4 6 8 10 12 14 16 18 20 \ + --quantization modelslim \ + --enable-multimodal \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --mm-attention-backend ascend_attn \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 \ + --dp-size 8 \ + --enable-dp-attention \ + --enable-dp-lm-head \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --speculative-draft-model-quantization unquant +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 160 \ + --random-input-len 3500 \ + --random-output-len 1500 \ + --num-prompts 160 \ + --random-range-ratio 1 \ + --request-rate inf \ + --warmup-requests 64 +``` + +### Qwen3.5-397B W4A8 8P IN3K5 OUT1K5 50ms + +**Model**: Qwen3.5-397B + +**Hardware**: Atlas 800I A3 + +**Cards**: 8 + +**Deploy Mode**: PD Mixed + +**Quantization**: W4A8 INT8 + +**Dataset**: 3.5K+1.5K + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export DEEPEP_NORMAL_LONG_SEQ_PER_ROUND_TOKENS=3584 +export DEEPEP_NORMAL_LONG_SEQ_ROUND=6 +export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export GDN_ATTN_BACKEND_TRITON=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=0 +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=128 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_ENABLE_TP_MEMORY_INBALANCE_CHECK=0 +export SGLANG_SET_CPU_AFFINITY=1 +export SGLANG_ZBAL_BOOTSTRAP_URL=tcp://127.0.0.1:24669 +export SGLANG_ZBAL_LOCAL_MEM_SIZE=59648 +export STREAMS_PER_DEVICE=32 +export ZBAL_ENABLE_GRAPH=1 +export ZBAL_NPU_ALLOC_CONF=use_vmm_for_static_memory:True + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --attention-backend ascend \ + --device npu \ + --tp-size 16 \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 17500 \ + --max-total-tokens 280000 \ + --disable-radix-cache \ + --trust-remote-code \ + --max-running-requests 432 \ + --mem-fraction-static 0.8 \ + --cuda-graph-bs 2 4 6 8 12 16 20 24 28 32 36 40 44 48 50 52 54 \ + --quantization modelslim \ + --enable-multimodal \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --mm-attention-backend ascend_attn \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 \ + --dp-size 8 \ + --enable-dp-attention \ + --enable-dp-lm-head \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --speculative-draft-model-quantization unquant +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 432 \ + --random-input-len 3500 \ + --random-output-len 1500 \ + --num-prompts 432 \ + --random-range-ratio 1 \ + --request-rate inf \ + --warmup-requests 16 +``` + +### Qwen3.5-397B W4A8 8P IN64K OUT1K 20ms + +**Model**: Qwen3.5-397B + +**Hardware**: Atlas 800I A3 + +**Cards**: 8 + +**Deploy Mode**: PD Mixed + +**Quantization**: W4A8 INT8 + +**Dataset**: 64K+1K + +**TPOT**: 20ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export DEEPEP_NORMAL_LONG_SEQ_PER_ROUND_TOKENS=4096 +export DEEPEP_NORMAL_LONG_SEQ_ROUND=20 +export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export GDN_ATTN_BACKEND_TRITON=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=0 +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=128 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_ENABLE_TP_MEMORY_INBALANCE_CHECK=0 +export SGLANG_SET_CPU_AFFINITY=1 +export SGLANG_ZBAL_BOOTSTRAP_URL=tcp://127.0.0.1:24669 +export SGLANG_ZBAL_LOCAL_MEM_SIZE=58672 +export STREAMS_PER_DEVICE=32 +export ZBAL_ENABLE_GRAPH=1 +export ZBAL_NPU_ALLOC_CONF=use_vmm_for_static_memory:True + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --attention-backend ascend \ + --device npu \ + --tp-size 16 \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 65536 \ + --prefill-max-requests 1 \ + --disable-radix-cache \ + --trust-remote-code \ + --max-running-requests 16 \ + --mem-fraction-static 0.6 \ + --max-total-tokens 1065000 \ + --cuda-graph-bs 2 4 6 8 10 12 14 16 \ + --quantization modelslim \ + --enable-multimodal \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --mm-attention-backend ascend_attn \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 \ + --dp-size 2 \ + --enable-dp-attention \ + --enable-dp-lm-head \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --speculative-draft-model-quantization unquant +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 8 \ + --random-input-len 65536 \ + --random-output-len 1024 \ + --num-prompts 8 \ + --random-range-ratio 1 \ + --request-rate inf \ + --warmup-requests 8 +``` + +### Qwen3.5-397B W4A8 8P IN64K OUT1K 50ms + +**Model**: Qwen3.5-397B + +**Hardware**: Atlas 800I A3 + +**Cards**: 8 + +**Deploy Mode**: PD Mixed + +**Quantization**: W4A8 INT8 + +**Dataset**: 64K+1K + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export DEEPEP_NORMAL_LONG_SEQ_PER_ROUND_TOKENS=4096 +export DEEPEP_NORMAL_LONG_SEQ_ROUND=20 +export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export GDN_ATTN_BACKEND_TRITON=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=0 +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=128 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_ENABLE_TP_MEMORY_INBALANCE_CHECK=0 +export SGLANG_SET_CPU_AFFINITY=1 +export SGLANG_ZBAL_BOOTSTRAP_URL=tcp://127.0.0.1:24669 +export SGLANG_ZBAL_LOCAL_MEM_SIZE=58672 +export STREAMS_PER_DEVICE=32 +export ZBAL_ENABLE_GRAPH=1 +export ZBAL_NPU_ALLOC_CONF=use_vmm_for_static_memory:True + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --attention-backend ascend \ + --device npu \ + --tp-size 16 \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 65536 \ + --prefill-max-requests 1 \ + --disable-radix-cache \ + --trust-remote-code \ + --max-running-requests 32 \ + --mem-fraction-static 0.6 \ + --max-total-tokens 1065000 \ + --cuda-graph-bs 2 4 6 8 12 14 16 \ + --quantization modelslim \ + --enable-multimodal \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --mm-attention-backend ascend_attn \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 \ + --dp-size 2 \ + --enable-dp-attention \ + --enable-dp-lm-head \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --speculative-draft-model-quantization unquant +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 28 \ + --random-input-len 65536 \ + --random-output-len 1024 \ + --num-prompts 28 \ + --random-range-ratio 1 \ + --request-rate inf \ + --warmup-requests 8 +``` + +### Qwen3.5-397B W4A8 8P IN64K OUT1K PREFIX90 50ms + +**Model**: Qwen3.5-397B + +**Hardware**: Atlas 800I A3 + +**Cards**: 8 + +**Deploy Mode**: PD Mixed + +**Quantization**: W4A8 INT8 + +**Dataset**: 64K+1K (90% prefix cache hit rate) + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export DEEPEP_NORMAL_LONG_SEQ_PER_ROUND_TOKENS=4096 +export DEEPEP_NORMAL_LONG_SEQ_ROUND=20 +export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export GDN_ATTN_BACKEND_TRITON=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=0 +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=128 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_ENABLE_TP_MEMORY_INBALANCE_CHECK=0 +export SGLANG_SET_CPU_AFFINITY=1 +export SGLANG_ZBAL_BOOTSTRAP_URL=tcp://127.0.0.1:24669 +export SGLANG_ZBAL_LOCAL_MEM_SIZE=58672 +export STREAMS_PER_DEVICE=32 +export ZBAL_ENABLE_GRAPH=1 +export ZBAL_NPU_ALLOC_CONF=use_vmm_for_static_memory:True + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --attention-backend ascend \ + --device npu \ + --tp-size 16 \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 65536 \ + --max-mamba-cache-size 640 \ + --mamba-scheduler-strategy extra_buffer \ + --trust-remote-code \ + --max-running-requests 128 \ + --mem-fraction-static 0.6 \ + --max-total-tokens 1310720 \ + --cuda-graph-bs 2 4 6 8 10 12 16 20 24 32 40 48 56 64 \ + --quantization modelslim \ + --enable-multimodal \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --mm-attention-backend ascend_attn \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 \ + --dp-size 2 \ + --enable-dp-attention \ + --enable-dp-lm-head \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --speculative-draft-model-quantization unquant +``` + +#### Benchmark + +We tested it based on the `generated-shared-prefix` dataset with 90% cache hit (`repeat_rate = 0.9`): +`--gsp-system-prompt-len 58982` = `int(65536 * 0.9)` is the shared prefix portion. +`--gsp-question-len 6553` = `int(65536 * (1 - 0.9))` is the unique per-request suffix. +`--gsp-num-groups 1` keeps all requests in one prefix group for maximum cache reuse. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name generated-shared-prefix \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --gsp-num-groups 1 \ + --gsp-prompts-per-group 128 \ + --gsp-system-prompt-len 58982 \ + --gsp-question-len 6553 \ + --gsp-output-len 1024 \ + --max-concurrency 128 \ + --num-prompts 128 \ + --request-rate inf +``` diff --git a/docs_new/docs/hardware-platforms/ascend-npus/best_practice/qwen3_6_27b.mdx b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/qwen3_6_27b.mdx new file mode 100644 index 000000000..9ba09c583 --- /dev/null +++ b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/qwen3_6_27b.mdx @@ -0,0 +1,703 @@ +--- +title: "Qwen3.6-27B" +metatags: + description: "Best Practice for Qwen3.6-27B on Ascend NPU" +--- + +This guide describes the best practice data for Qwen3.6-27B on the Ascend NPU. + +### High Throughput + +| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration | +| --- | --- | --- | --- | --- | --- | --- | --- | +| Qwen3.6-27B | Atlas 800I A3 | 1 | PD Mixed | 1024x1024 (30)+1024 | 50ms | W8A8 INT8 | [Optimal Configuration](#qwen3-6-27b-1p-in1024x1024-30-out1024-50ms) | +| Qwen3.6-27B | Atlas 800I A3 | 1 | PD Mixed | 1080p_30+256 | 50ms | W8A8 INT8 | [Optimal Configuration](#qwen3-6-27b-1p-in1080p-30-out256-50ms) | +| Qwen3.6-27B | Atlas 800I A3 | 2 | PD Mixed | 64K+1K (90% prefix cache hit rate) | 50ms | W8A8 INT8 | [Optimal Configuration](#qwen3-6-27b-2p-in64k-out1k-prefix90-50ms) | +| Qwen3.6-27B | Atlas 800I A3 | 1 | PD Mixed | 3.5K+1.5K | 50ms | W8A8 INT8 | [Optimal Configuration](#qwen3-6-27b-w8a8-1p-in3k5-out1k5-50ms) | +| Qwen3.6-27B | Atlas 800I A3 | 2 | PD Mixed | 128K+1K | 50ms | W8A8 INT8 | [Optimal Configuration](#qwen3-6-27b-w8a8-2p-in128k-out1k-50ms) | +| Qwen3.6-27B | Atlas 800I A3 | 2 | PD Mixed | 16K+1K | 50ms | W8A8 INT8 | [Optimal Configuration](#qwen3-6-27b-w8a8-2p-in16k-out1k-50ms) | +| Qwen3.6-27B | Atlas 800I A3 | 2 | PD Mixed | 64K+1K | 50ms | W8A8 INT8 | [Optimal Configuration](#qwen3-6-27b-w8a8-2p-in64k-out1k-50ms) | + + +## Optimal Configuration + +### Qwen3.6-27B 1P IN1024X1024 30 OUT1024 50ms + +**Model**: Qwen3.6-27B + +**Hardware**: Atlas 800I A3 + +**Cards**: 1 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 1024x1024 (30)+1024 + +*Format: resolution (input tokens) + output tokens* + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export GLOO_SOCKET_IFNAME= +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_NPU_PROFILING=1 +export SGLANG_NPU_PROFILING_STAGE=prefill +export SGLANG_PREFILL_DELAYER_MAX_DELAY_PASSES=150 +export SGLANG_SCHEDULER_DECREASE_PREFILL_IDLE=1 +export SGLANG_SET_CPU_AFFINITY=1 +export SGLANG_VIT_ENABLE_CUDA_GRAPH=1 +export STREAMS_PER_DEVICE=32 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --tp-size 2 \ + --nnodes 1 \ + --attention-backend ascend \ + --device npu \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 52000 \ + --disable-radix-cache \ + --trust-remote-code \ + --max-running-requests 50 \ + --max-mamba-cache-size 60 \ + --mem-fraction-static 0.76 \ + --cuda-graph-bs 2 4 8 16 24 32 40 42 45 50 \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --mm-enable-dp-encoder +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 48 \ + --random-input-len 30 \ + --random-output-len 1024 \ + --num-prompts 48 \ + --random-range-ratio 1 +``` + +### Qwen3.6-27B 1P IN1080P 30 OUT256 50ms + +**Model**: Qwen3.6-27B + +**Hardware**: Atlas 800I A3 + +**Cards**: 1 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 1080p_30+256 + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export GLOO_SOCKET_IFNAME= +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_NPU_PROFILING=1 +export SGLANG_NPU_PROFILING_STAGE=prefill +export SGLANG_PREFILL_DELAYER_MAX_DELAY_PASSES=150 +export SGLANG_SCHEDULER_DECREASE_PREFILL_IDLE=1 +export SGLANG_SET_CPU_AFFINITY=1 +export SGLANG_VIT_ENABLE_CUDA_GRAPH=1 +export STREAMS_PER_DEVICE=32 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --tp-size 2 \ + --nnodes 1 \ + --attention-backend ascend \ + --device npu \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 48000 \ + --disable-radix-cache \ + --trust-remote-code \ + --max-running-requests 30 \ + --max-mamba-cache-size 40 \ + --mem-fraction-static 0.76 \ + --cuda-graph-bs 2 4 8 16 24 28 30 \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --mm-enable-dp-encoder +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 30 \ + --random-input-len 30 \ + --random-output-len 256 \ + --num-prompts 120 \ + --random-range-ratio 1 +``` + +### Qwen3.6-27B 2P IN64K OUT1K PREFIX90 50ms + +**Model**: Qwen3.6-27B + +**Hardware**: Atlas 800I A3 + +**Cards**: 2 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 64K+1K (90% prefix cache hit rate) + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export GDN_ATTN_BACKEND_TRITON=1 +export GLOO_SOCKET_IFNAME= +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --tp-size 2 \ + --nnodes 1 \ + --attention-backend ascend \ + --device npu \ + --chunked-prefill-size 32768 \ + --max-prefill-tokens 32768 \ + --mamba-scheduler-strategy extra_buffer \ + --trust-remote-code \ + --max-running-requests 20 \ + --max-mamba-cache-size 108 \ + --mem-fraction-static 0.7 \ + --cuda-graph-bs 1 2 4 8 12 15 17 19 20 \ + --enable-prefill-delayer \ + --prefill-delayer-queue-min-ratio 0.8 \ + --prefill-delayer-max-delay-ms 30000 \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 +``` + +#### Benchmark + +We tested it based on the `generated-shared-prefix` dataset with 90% cache hit (`repeat_rate = 0.9`): +`--gsp-system-prompt-len 57600` = `int(64000 * 0.9)` is the shared prefix portion. +`--gsp-question-len 6399` = `int(64000 * (1 - 0.9))` is the unique per-request suffix. +`--gsp-num-groups 1` keeps all requests in one prefix group for maximum cache reuse. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name generated-shared-prefix \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --gsp-num-groups 1 \ + --gsp-prompts-per-group 80 \ + --gsp-system-prompt-len 57600 \ + --gsp-question-len 6399 \ + --gsp-output-len 1000 \ + --max-concurrency 20 \ + --num-prompts 80 \ + --request-rate inf +``` + +### Qwen3.6-27B W8A8 1P IN3K5 OUT1K5 50ms + +**Model**: Qwen3.6-27B + +**Hardware**: Atlas 800I A3 + +**Cards**: 1 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 3.5K+1.5K + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export GLOO_SOCKET_IFNAME= +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=0 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_PREFILL_DELAYER_MAX_DELAY_PASSES=130 +export SGLANG_SCHEDULER_DECREASE_PREFILL_IDLE=1 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --tp-size 2 \ + --nnodes 1 \ + --attention-backend ascend \ + --device npu \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 60000 \ + --disable-radix-cache \ + --trust-remote-code \ + --max-running-requests 64 \ + --max-mamba-cache-size 74 \ + --mem-fraction-static 0.7 \ + --cuda-graph-bs 2 8 16 32 40 45 50 54 \ + --enable-multimodal \ + --quantization modelslim \ + --mm-attention-backend ascend_attn \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 54 \ + --random-input-len 3500 \ + --random-output-len 1500 \ + --num-prompts 216 \ + --random-range-ratio 1 +``` + +### Qwen3.6-27B W8A8 2P IN128K OUT1K 50ms + +**Model**: Qwen3.6-27B + +**Hardware**: Atlas 800I A3 + +**Cards**: 2 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 128K+1K + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export GLOO_SOCKET_IFNAME= +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_PREFILL_DELAYER_MAX_DELAY_PASSES=20 +export SGLANG_SCHEDULER_DECREASE_PREFILL_IDLE=1 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --tp-size 4 \ + --nnodes 1 \ + --attention-backend ascend \ + --device npu \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 74000 \ + --disable-radix-cache \ + --trust-remote-code \ + --max-running-requests 6 \ + --max-mamba-cache-size 7 \ + --mem-fraction-static 0.63 \ + --cuda-graph-bs 1 2 4 5 6 \ + --enable-multimodal \ + --quantization modelslim \ + --mm-attention-backend ascend_attn \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 4 \ + --random-input-len 128000 \ + --random-output-len 1000 \ + --num-prompts 16 \ + --random-range-ratio 1 +``` + +### Qwen3.6-27B W8A8 2P IN16K OUT1K 50ms + +**Model**: Qwen3.6-27B + +**Hardware**: Atlas 800I A3 + +**Cards**: 2 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 16K+1K + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export GLOO_SOCKET_IFNAME= +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_PREFILL_DELAYER_MAX_DELAY_PASSES=130 +export SGLANG_SCHEDULER_DECREASE_PREFILL_IDLE=1 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --tp-size 4 \ + --nnodes 1 \ + --attention-backend ascend \ + --device npu \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 50000 \ + --disable-radix-cache \ + --trust-remote-code \ + --max-running-requests 28 \ + --max-mamba-cache-size 50 \ + --mem-fraction-static 0.7 \ + --cuda-graph-bs 2 8 12 16 20 24 26 28 \ + --enable-multimodal \ + --quantization modelslim \ + --mm-attention-backend ascend_attn \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 28 \ + --random-input-len 16000 \ + --random-output-len 1000 \ + --num-prompts 112 \ + --random-range-ratio 1 +``` + +### Qwen3.6-27B W8A8 2P IN64K OUT1K 50ms + +**Model**: Qwen3.6-27B + +**Hardware**: Atlas 800I A3 + +**Cards**: 2 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 64K+1K + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export GLOO_SOCKET_IFNAME= +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_PREFILL_DELAYER_MAX_DELAY_PASSES=30 +export SGLANG_SCHEDULER_DECREASE_PREFILL_IDLE=1 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --tp-size 4 \ + --nnodes 1 \ + --attention-backend ascend \ + --device npu \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 50000 \ + --disable-radix-cache \ + --trust-remote-code \ + --max-running-requests 28 \ + --max-mamba-cache-size 50 \ + --mem-fraction-static 0.7 \ + --cuda-graph-bs 2 4 6 \ + --enable-multimodal \ + --quantization modelslim \ + --mm-attention-backend ascend_attn \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 6 \ + --random-input-len 64000 \ + --random-output-len 1000 \ + --num-prompts 24 \ + --random-range-ratio 1 +``` diff --git a/docs_new/docs/hardware-platforms/ascend-npus/best_practice/qwen3_6_35b_a3b.mdx b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/qwen3_6_35b_a3b.mdx new file mode 100644 index 000000000..ad3b6b0b9 --- /dev/null +++ b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/qwen3_6_35b_a3b.mdx @@ -0,0 +1,903 @@ +--- +title: "Qwen3.6-35B-A3B" +metatags: + description: "Best Practice for Qwen3.6-35B-A3B on Ascend NPU" +--- + +This guide describes the best practice data for Qwen3.6-35B-A3B on the Ascend NPU. + +### Low Latency + +| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration | +| --- | --- | --- | --- | --- | --- | --- | --- | +| Qwen3.6-35B-A3B | Atlas 800I A3 | 1 | PD Mixed | 254K+1K | 16.1ms | W8A8 INT8 | [Optimal Configuration](#qwen3-6-35b-a3b-1p-in254k-out1k) | + +### High Throughput + +| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration | +| --- | --- | --- | --- | --- | --- | --- | --- | +| Qwen3.6-35B-A3B | Atlas 800I A3 | 1 | PD Mixed | 1024x1024 (30)+1024 | 50ms | W8A8 INT8 | [Optimal Configuration](#qwen3-6-35b-a3b-1p-in1024x1024-30-out1024-50ms) | +| Qwen3.6-35B-A3B | Atlas 800I A3 | 1 | PD Mixed | 1080p_30+256 | 50ms | W8A8 INT8 | [Optimal Configuration](#qwen3-6-35b-a3b-1p-in1080p-30-out256-50ms) | +| Qwen3.6-35B-A3B | Atlas 800I A3 | 1 | PD Mixed | 128K+1K | 50ms | W8A8 INT8 | [Optimal Configuration](#qwen3-6-35b-a3b-1p-in128k-out1k-50ms) | +| Qwen3.6-35B-A3B | Atlas 800I A3 | 1 | PD Mixed | 128K+1K (90% prefix cache hit rate) | 50ms | W8A8 INT8 | [Optimal Configuration](#qwen3-6-35b-a3b-1p-in128k-out1k-prefix90-50ms) | +| Qwen3.6-35B-A3B | Atlas 800I A3 | 1 | PD Mixed | 3.5K+1.5K | 50ms | W8A8 INT8 | [Optimal Configuration](#qwen3-6-35b-a3b-1p-in3k5-out1k5-50ms) | +| Qwen3.6-35B-A3B | Atlas 800I A3 | 1 | PD Mixed | 64K+1K | 50ms | W8A8 INT8 | [Optimal Configuration](#qwen3-6-35b-a3b-1p-in64k-out1k-50ms) | +| Qwen3.6-35B-A3B | Atlas 800I A3 | 1 | PD Mixed | 64K+1K (90% prefix cache hit rate) | 50ms | W8A8 INT8 | [Optimal Configuration](#qwen3-6-35b-a3b-1p-in64k-out1k-prefix90-50ms) | +| Qwen3.6-35B-A3B | Atlas 800I A3 | 2 | PD Mixed | 984K+1K | 40.91ms | W8A8 INT8 | [Optimal Configuration](#qwen3-6-35b-a3b-2p-in984k-out1k) | + + +## Optimal Configuration + +### Qwen3.6-35B-A3B 1P IN1024X1024 30 OUT1024 50ms + +**Model**: Qwen3.6-35B-A3B + +**Hardware**: Atlas 800I A3 + +**Cards**: 1 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 1024x1024 (30)+1024 + +*Format: resolution (input tokens) + output tokens* + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export GLOO_SOCKET_IFNAME= +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_PREFILL_DELAYER_MAX_DELAY_PASSES=30 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --tp-size 2 \ + --nnodes 1 \ + --attention-backend ascend \ + --device npu \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 16384 \ + --disable-radix-cache \ + --trust-remote-code \ + --enable-prefill-delayer \ + --max-running-requests 120 \ + --max-mamba-cache-size 240 \ + --mem-fraction-static 0.78 \ + --cuda-graph-bs 4 8 16 24 32 48 64 80 96 112 120 \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 120 \ + --random-input-len 30 \ + --random-output-len 1024 \ + --num-prompts 480 \ + --random-range-ratio 1 \ + --request-rate inf +``` + +### Qwen3.6-35B-A3B 1P IN1080P 30 OUT256 50ms + +**Model**: Qwen3.6-35B-A3B + +**Hardware**: Atlas 800I A3 + +**Cards**: 1 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 1080p_30+256 + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export GLOO_SOCKET_IFNAME= +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_PREFILL_DELAYER_MAX_DELAY_PASSES=10 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --tp-size 2 \ + --nnodes 1 \ + --attention-backend ascend \ + --device npu \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 16384 \ + --disable-radix-cache \ + --trust-remote-code \ + --enable-prefill-delayer \ + --max-running-requests 50 \ + --max-mamba-cache-size 55 \ + --mem-fraction-static 0.8 \ + --cuda-graph-bs 2 4 8 12 16 20 24 28 32 36 40 44 48 50 \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 50 \ + --random-input-len 30 \ + --random-output-len 256 \ + --num-prompts 200 \ + --random-range-ratio 1 \ + --request-rate inf +``` + +### Qwen3.6-35B-A3B 1P IN128K OUT1K 50ms + +**Model**: Qwen3.6-35B-A3B + +**Hardware**: Atlas 800I A3 + +**Cards**: 1 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 128K+1K + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export GDN_ATTN_BACKEND_TRITON=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=1600 +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_PREFILL_DELAYER_MAX_DELAY_PASSES=20 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --tp-size 2 \ + --nnodes 1 \ + --attention-backend ascend \ + --device npu \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 128000 \ + --disable-radix-cache \ + --trust-remote-code \ + --enable-prefill-delayer \ + --max-running-requests 3 \ + --max-mamba-cache-size 10 \ + --mem-fraction-static 0.63 \ + --cuda-graph-bs 1 2 3 \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 3 \ + --random-input-len 128000 \ + --random-output-len 1000 \ + --num-prompts 12 \ + --random-range-ratio 1 +``` + +### Qwen3.6-35B-A3B 1P IN128K OUT1K PREFIX90 50ms + +**Model**: Qwen3.6-35B-A3B + +**Hardware**: Atlas 800I A3 + +**Cards**: 1 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 128K+1K (90% prefix cache hit rate) + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export GLOO_SOCKET_IFNAME= +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_PREFILL_DELAYER_MAX_DELAY_PASSES=30 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --tp-size 2 \ + --nnodes 1 \ + --attention-backend ascend \ + --device npu \ + --chunked-prefill-size 16384 \ + --max-prefill-tokens 65536 \ + --trust-remote-code \ + --enable-prefill-delayer \ + --mamba-scheduler-strategy extra_buffer \ + --max-running-requests 103 \ + --max-mamba-cache-size 85 \ + --mem-fraction-static 0.85 \ + --cuda-graph-bs 2 4 8 16 32 48 64 80 96 103 \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 +``` + +#### Benchmark + +We tested it based on the `generated-shared-prefix` dataset with 90% cache hit (`repeat_rate = 0.9`): +`--gsp-system-prompt-len 57600` = `int(64000 * 0.9)` is the shared prefix portion. +`--gsp-question-len 6399` = `int(64000 * (1 - 0.9))` is the unique per-request suffix. +`--gsp-num-groups 1` keeps all requests in one prefix group for maximum cache reuse. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name generated-shared-prefix \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --gsp-num-groups 1 \ + --gsp-prompts-per-group 412 \ + --gsp-system-prompt-len 57600 \ + --gsp-question-len 6399 \ + --gsp-output-len 1000 \ + --max-concurrency 103 \ + --num-prompts 412 \ + --request-rate inf +``` + +### Qwen3.6-35B-A3B 1P IN254K OUT1K + +**Model**: Qwen3.6-35B-A3B + +**Hardware**: Atlas 800I A3 + +**Cards**: 1 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 254K+1K + +**TPOT**: 16.1ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export GLOO_SOCKET_IFNAME= +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --tp-size 2 \ + --nnodes 1 \ + --attention-backend ascend \ + --device npu \ + --chunked-prefill-size 131072 \ + --max-prefill-tokens 254000 \ + --disable-radix-cache \ + --trust-remote-code \ + --max-running-requests 1 \ + --max-mamba-cache-size 6 \ + --mem-fraction-static 0.65 \ + --cuda-graph-bs 1 \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 1 \ + --random-input-len 254000 \ + --random-output-len 1000 \ + --num-prompts 1 \ + --random-range-ratio 1 +``` + +### Qwen3.6-35B-A3B 1P IN3K5 OUT1K5 50ms + +**Model**: Qwen3.6-35B-A3B + +**Hardware**: Atlas 800I A3 + +**Cards**: 1 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 3.5K+1.5K + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=1 +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=0 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --tp-size 2 \ + --nnodes 1 \ + --attention-backend ascend \ + --device npu \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 43400 \ + --disable-radix-cache \ + --trust-remote-code \ + --enable-prefill-delayer \ + --prefill-delayer-max-delay-passes 50 \ + --max-running-requests 124 \ + --max-mamba-cache-size 124 \ + --mem-fraction-static 0.8 \ + --cuda-graph-bs 4 16 32 64 96 112 116 120 124 \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 124 \ + --random-input-len 3500 \ + --random-output-len 1500 \ + --num-prompts 496 \ + --random-range-ratio 1 +``` + +### Qwen3.6-35B-A3B 1P IN64K OUT1K 50ms + +**Model**: Qwen3.6-35B-A3B + +**Hardware**: Atlas 800I A3 + +**Cards**: 1 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 64K+1K + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export GLOO_SOCKET_IFNAME= +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_PREFILL_DELAYER_MAX_DELAY_PASSES=1 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --tp-size 2 \ + --nnodes 1 \ + --attention-backend ascend \ + --device npu \ + --chunked-prefill-size -1 \ + --max-total-tokens 600000 \ + --max-prefill-tokens 65536 \ + --disable-radix-cache \ + --trust-remote-code \ + --enable-prefill-delayer \ + --max-running-requests 10 \ + --max-mamba-cache-size 20 \ + --mem-fraction-static 0.65 \ + --cuda-graph-bs 2 4 8 12 14 16 \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 10 \ + --random-input-len 64000 \ + --random-output-len 1000 \ + --num-prompts 40 \ + --random-range-ratio 1 +``` + +### Qwen3.6-35B-A3B 1P IN64K OUT1K PREFIX90 50ms + +**Model**: Qwen3.6-35B-A3B + +**Hardware**: Atlas 800I A3 + +**Cards**: 1 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 64K+1K (90% prefix cache hit rate) + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export GDN_ATTN_BACKEND_TRITON=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=300 +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=0 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --tp-size 2 \ + --nnodes 1 \ + --attention-backend ascend \ + --device npu \ + --chunked-prefill-size -1 \ + --max-prefill-tokens 65536 \ + --trust-remote-code \ + --enable-prefill-delayer \ + --mamba-scheduler-strategy extra_buffer \ + --max-running-requests 42 \ + --max-mamba-cache-size 210 \ + --mem-fraction-static 0.71 \ + --cuda-graph-bs 2 8 16 24 32 36 40 42 \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 +``` + +#### Benchmark + +We tested it based on the `generated-shared-prefix` dataset with 90% cache hit (`repeat_rate = 0.9`): +`--gsp-system-prompt-len 58982` = `int(65536 * 0.9)` is the shared prefix portion. +`--gsp-question-len 6553` = `int(65536 * (1 - 0.9))` is the unique per-request suffix. +`--gsp-num-groups 1` keeps all requests in one prefix group for maximum cache reuse. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name generated-shared-prefix \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --gsp-num-groups 1 \ + --gsp-prompts-per-group 42 \ + --gsp-system-prompt-len 58982 \ + --gsp-question-len 6553 \ + --gsp-output-len 1024 \ + --max-concurrency 42 \ + --num-prompts 42 \ + --request-rate inf +``` + +### Qwen3.6-35B-A3B 2P IN984K OUT1K + +**Model**: Qwen3.6-35B-A3B + +**Hardware**: Atlas 800I A3 + +**Cards**: 2 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 984K+1K + +**TPOT**: 40.91ms + +#### Model Deployment + +```bash Command +# ============================================================ +# 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 ASCEND_USE_FIA=1 +export GLOO_SOCKET_IFNAME= +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_ALLOW_OVERWRITE_LONGER_CONTEXT_LEN=1 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_SET_CPU_AFFINITY=1 +export STREAMS_PER_DEVICE=32 + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --tp-size 4 \ + --nnodes 1 \ + --attention-backend ascend \ + --device npu \ + --chunked-prefill-size 131072 \ + --max-prefill-tokens 984000 \ + --disable-radix-cache \ + --trust-remote-code \ + --max-running-requests 1 \ + --max-mamba-cache-size 6 \ + --mem-fraction-static 0.68 \ + --cuda-graph-bs 1 \ + --enable-multimodal \ + --mm-attention-backend ascend_attn \ + --dtype bfloat16 \ + --mamba-ssm-dtype bfloat16 \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --context-length 1010000 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 1 \ + --random-input-len 984000 \ + --random-output-len 1000 \ + --num-prompts 1 \ + --random-range-ratio 1 +``` diff --git a/docs_new/docs/hardware-platforms/ascend-npus/best_practice/qwen3_next_80b_a3b_instruct.mdx b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/qwen3_next_80b_a3b_instruct.mdx new file mode 100644 index 000000000..0f4456948 --- /dev/null +++ b/docs_new/docs/hardware-platforms/ascend-npus/best_practice/qwen3_next_80b_a3b_instruct.mdx @@ -0,0 +1,362 @@ +--- +title: "Qwen3-Next-80B-A3B-Instruct" +metatags: + description: "Best Practice for Qwen3-Next-80B-A3B-Instruct on Ascend NPU" +--- + +This guide describes the best practice data for Qwen3-Next-80B-A3B-Instruct on the Ascend NPU. + +### Low Latency + +| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration | +| --- | --- | --- | --- | --- | --- | --- | --- | +| Qwen3-Next-80B-A3B-Instruct | Atlas 800I A3 | 2 | PD Mixed | 3.5K+1.5K | 20ms | W8A8 INT8 | [Optimal Configuration](#qwen3-next-80b-a3b-instruct-w8a8-2p-in3k5-out1k5-20ms) | +| Qwen3-Next-80B-A3B-Instruct | Atlas 800I A3 | 2 | PD Mixed | 6K+1.5K | 15.62ms | W8A8 INT8 | [Optimal Configuration](#qwen3-next-80b-a3b-instruct-w8a8-2p-in6k-out1k5-bs16) | + +### High Throughput + +| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration | +| --- | --- | --- | --- | --- | --- | --- | --- | +| Qwen3-Next-80B-A3B-Instruct | Atlas 800I A3 | 2 | PD Mixed | 3.5K+1.5K | 50ms | W8A8 INT8 | [Optimal Configuration](#qwen3-next-80b-a3b-instruct-w8a8-2p-in3k5-out1k5-50ms) | + + +## Optimal Configuration + +### Qwen3-Next-80B-A3B-Instruct W8A8 2P IN3K5 OUT1K5 20ms + +**Model**: Qwen3-Next-80B-A3B-Instruct + +**Hardware**: Atlas 800I A3 + +**Cards**: 2 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 3.5K+1.5K + +**TPOT**: 20ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-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 ASCEND_USE_FIA=1 +export DEEPEP_NORMAL_LONG_SEQ_PER_ROUND_TOKENS=2048 +export DEEPEP_NORMAL_LONG_SEQ_ROUND=10 +export FORCE_DRAFT_MODEL_NON_QUANT=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=2000 +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=400 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_ENABLE_TP_MEMORY_INBALANCE_CHECK=0 +export SGLANG_NPU_USE_MULTI_STREAM=0 +export SGLANG_SET_CPU_AFFINITY=1 +export SGLANG_WARMUP_TIMEOUT=3600 +export STREAMS_PER_DEVICE=32 +export TASK_QUEUE_ENABLE=1 +export ZBCCL_BOOTSTRAP_URL=tcp://127.0.0.1:24669 +export ZBCCL_ENABLE_GRAPH=1 +export ZBCCL_LOCAL_MEM_SIZE=60416 +export ZBCCL_NPU_ALLOC_CONF=use_vmm_for_static_memory:True + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --trust-remote-code \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --page-size 128 \ + --tp-size 2 \ + --watchdog-timeout 9000 \ + --mem-fraction-static 0.85 \ + --disable-radix-cache \ + --max-prefill-tokens 28672 \ + --context-length 26384 \ + --max-total-tokens 122304 \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --speculative-draft-model-quantization unquant \ + --chunked-prefill-size -1 \ + --max-running-requests 2 \ + --cuda-graph-bs 2 \ + --mamba-ssm-dtype bfloat16 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 1 \ + --random-input-len 3500 \ + --random-output-len 1500 \ + --num-prompts 1 \ + --random-range-ratio 1 +``` + +### Qwen3-Next-80B-A3B-Instruct W8A8 2P IN3K5 OUT1K5 50ms + +**Model**: Qwen3-Next-80B-A3B-Instruct + +**Hardware**: Atlas 800I A3 + +**Cards**: 2 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 3.5K+1.5K + +**TPOT**: 50ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-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 ASCEND_USE_FIA=1 +export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export FORCE_DRAFT_MODEL_NON_QUANT=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=64 +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=330 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_ENABLE_TP_MEMORY_INBALANCE_CHECK=0 +export SGLANG_NPU_USE_MULTI_STREAM=0 +export SGLANG_SET_CPU_AFFINITY=1 +export SGLANG_WARMUP_TIMEOUT=3600 +export SGLANG_ZBAL_BOOTSTRAP_URL=tcp://127.0.0.1:24669 +export SGLANG_ZBAL_LOCAL_MEM_SIZE=59648 +export STREAMS_PER_DEVICE=32 +export ZBAL_ENABLE_GRAPH=1 +export ZBAL_HCCL_OP=allreduce,_allgather_base,allgather,broadcast,scatter,reduce_scatter,_reduce_scatter_base,alltoall_base +export ZBAL_NPU_ALLOC_CONF=use_vmm_for_static_memory:True + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --trust-remote-code \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --page-size 128 \ + --tp-size 4 \ + --watchdog-timeout 9000 \ + --mem-fraction-static 0.75 \ + --disable-radix-cache \ + --max-prefill-tokens 14080 \ + --context-length 26384 \ + --chunked-prefill-size -1 \ + --max-running-requests 300 \ + --mamba-ssm-dtype bfloat16 \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --speculative-draft-model-quantization unquant \ + --speculative-draft-model-path $DRAFT_MODEL_PATH \ + --dp-size 2 \ + --enable-dp-attention \ + --enable-dp-lm-head \ + --moe-a2a-backend deepep \ + --deepep-mode auto \ + --cuda-graph-bs 1 2 3 4 5 6 7 8 10 12 14 16 18 20 22 24 26 28 30 32 40 44 48 52 56 60 64 72 80 88 96 104 112 120 128 136 144 150 +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 300 \ + --random-input-len 3500 \ + --random-output-len 1500 \ + --num-prompts 300 \ + --random-range-ratio 1 +``` + +### Qwen3-Next-80B-A3B-Instruct W8A8 2P IN6K OUT1K5 BS16 + +**Model**: Qwen3-Next-80B-A3B-Instruct + +**Hardware**: Atlas 800I A3 + +**Cards**: 2 + +**Deploy Mode**: PD Mixed + +**Quantization**: W8A8 INT8 + +**Dataset**: 6K+1.5K + +**TPOT**: 15.62ms + +#### Model Deployment + +```bash Command +# ============================================================ +# Before running, update the following variables: +# MODEL_PATH: path to the model weights directory +# DRAFT_MODEL_PATH: path to the draft 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 +DRAFT_MODEL_PATH=/path/to/draft-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 ASCEND_USE_FIA=1 +export DEEPEP_NORMAL_LONG_SEQ_PER_ROUND_TOKENS=2048 +export DEEPEP_NORMAL_LONG_SEQ_ROUND=10 +export DEEP_NORMAL_MODE_USE_INT8_QUANT=1 +export FORCE_DRAFT_MODEL_NON_QUANT=1 +export GLOO_SOCKET_IFNAME= +export HCCL_BUFFSIZE=2000 +export HCCL_OP_EXPANSION_MODE=AIV +export HCCL_SOCKET_IFNAME= +export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True +export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=400 +export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_ENABLE_TP_MEMORY_INBALANCE_CHECK=0 +export SGLANG_NPU_USE_MULTI_STREAM=0 +export SGLANG_WARMUP_TIMEOUT=3600 +export STREAMS_PER_DEVICE=32 +export TASK_QUEUE_ENABLE=1 +export ZBCCL_BOOTSTRAP_URL=tcp://127.0.0.1:24669 +export ZBCCL_ENABLE_GRAPH=1 +export ZBCCL_LOCAL_MEM_SIZE=60416 +export ZBCCL_NPU_ALLOC_CONF=use_vmm_for_static_memory:True + +python3 -m sglang.launch_server \ + --model-path $MODEL_PATH \ + --host 127.0.0.1 --port 6688 \ + --trust-remote-code \ + --attention-backend ascend \ + --device npu \ + --quantization modelslim \ + --page-size 128 \ + --tp-size 4 \ + --watchdog-timeout 9000 \ + --mem-fraction-static 0.85 \ + --disable-radix-cache \ + --max-prefill-tokens 28672 \ + --context-length 81920 \ + --max-total-tokens 122304 \ + --dp-size 2 \ + --enable-dp-attention \ + --enable-dp-lm-head \ + --speculative-algorithm NEXTN \ + --speculative-num-steps 3 \ + --speculative-eagle-topk 1 \ + --speculative-num-draft-tokens 4 \ + --speculative-draft-model-quantization unquant \ + --chunked-prefill-size -1 \ + --max-running-requests 16 \ + --cuda-graph-bs 2 4 8 \ + --mamba-ssm-dtype bfloat16 \ + --speculative-draft-model-path $DRAFT_MODEL_PATH +``` + +#### Benchmark + +We tested it based on the `RANDOM` dataset. + +```shell Command +python -m sglang.bench_serving \ + --dataset-name random \ + --backend sglang \ + --host 127.0.0.1 \ + --port 6688 \ + --max-concurrency 16 \ + --random-input-len 6144 \ + --random-output-len 1500 \ + --num-prompts 16 \ + --random-range-ratio 1 +```