> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sglang.io/llms.txt
> Use this file to discover all available pages before exploring further.

# GLM-5.3

> [!NOTE]
>
> This page focuses on optimal configuration and benchmark results for GLM-5.3 on the Ascend NPU. For environment setup, model weight download, feature configuration, and deployment instructions, etc., see the [GLM-5.3 Model Tutorial](https://docs.sglang.io/docs/hardware-platforms/ascend-npus/model-deployment/tutorials/glm_5_3.md).
>
> On the A3 Series, each card has 2 dies, so `--tp-size` is twice the card count for that role (the Cards column sums both roles); with pipeline parallelism, `--tp-size` multiplied by `--pp-size` is the total die count; see [Ascend NPU Reference](https://docs.sglang.io/docs/hardware-platforms/ascend-npus/reference/glossary.md#hardware) for details.

### Low Latency

| Model | Hardware | Cards | Deploy Mode | Dataset | TPOT | Quantization | Configuration |
| - | - | - | - | - | - | - | - |
| GLM-5.3 | A3 Series Products | 32 | PD Disaggregation | 128k+1k (90% prefix cache hit rate) | 20ms | W8A8 INT8 | [Optimal Configuration](#glm-5-3-w8a8-1p1d-32p-in128k-out1k-prefix90-20ms) |

## Optimal Configuration

Referenced by external docs. Verify before removing.

### GLM-5.3 W8A8 1P1D 32P IN128K OUT1K PREFIX90 20ms

**Model**: GLM-5.3

**Hardware**: A3 Series Products

**Cards**: 32

**Deploy Mode**: PD Disaggregation

**Quantization**: W8A8 INT8

**Dataset**: 128k+1k (90% prefix cache hit rate)

**TPOT**: 20ms

#### Model Deployment

```bash Command theme={null}
# ============================================================
# 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
# Optional vendor op packages.
source /usr/local/Ascend/ascend-toolkit/latest/opp/vendors/customize/bin/set_env.bash 2>/dev/null || true
source /usr/local/Ascend/ascend-toolkit/latest/opp/vendors/custom_transformer/bin/set_env.bash 2>/dev/null || true

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=('<your prefill ip1>' '<your prefill ip2>')
D_IP=('<your decode ip1>' '<your decode ip2>')

export ASCEND_MF_STORE_URL="tcp://<your prefill ip1>:24670"

MODEL_PATH=/path/to/model-weights

LOCAL_HOST1=`hostname -I|awk -F " " '{print$1}'`
LOCAL_HOST2=`hostname -I|awk -F " " '{print$2}'`
echo "${LOCAL_HOST1}"
echo "${LOCAL_HOST2}"
# prefill
for i in "${!P_IP[@]}";
do
    if [[ "$LOCAL_HOST1" == "${P_IP[$i]}" || "$LOCAL_HOST2" == "${P_IP[$i]}" ]];
    then
        echo "${P_IP[$i]}"
        export DEEPEP_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 GLOO_SOCKET_IFNAME=<network-interface>
        export HCCL_BUFFSIZE=1200
        export HCCL_SOCKET_IFNAME=<network-interface>
        export SGLANG_PP_LAYER_PARTITION=18,20,24,16
        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 \
        --trust-remote-code \
        --nnodes 2 \
        --tp-size 8 \
        --pp-size 4 \
        --attn-dp-size 1 \
        --attn-cp-size 8 \
        --enable-prefill-cp \
        --cp-strategy interleave \
        --enable-dp-lm-head \
        --moe-dense-tp-size 1 \
        --load-balance-method round_robin \
        --disaggregation-transfer-backend ascend \
        --max-running-requests 64 \
        --served-model-name glm-5 \
        --chunked-prefill-size 4096 \
        --max-prefill-tokens 180000 \
        --moe-a2a-backend deepep \
        --deepep-mode normal \
        --disable-shared-experts-fusion \
        --disable-decode-cuda-graph \
        --disable-prefill-cuda-graph \
        --dtype bfloat16 \
        --quantization modelslim \
        --speculative-algorithm NEXTN \
        --speculative-num-steps 1 \
        --speculative-eagle-topk 1 \
        --speculative-num-draft-tokens 2 \
        --attention-backend ascend \
        --device npu
        break
    fi
done

# decode
for i in "${!D_IP[@]}";
do
    if [[ "$LOCAL_HOST1" == "${D_IP[$i]}" || "$LOCAL_HOST2" == "${D_IP[$i]}" ]];
    then
        echo "${D_IP[$i]}"
        export DEEPEP_HCCL_BUFFSIZE=200
        export GLOO_SOCKET_IFNAME=<network-interface>
        export HCCL_SOCKET_IFNAME=<network-interface>
        export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=16
        export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1
        export SGLANG_NPU_USE_MULTI_STREAM=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 \
        --trust-remote-code \
        --nnodes 2 \
        --tp-size 32 \
        --attn-dp-size 32 \
        --ep-size 32 \
        --mem-fraction-static 0.97 \
        --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-decode 1 2 3 \
        --disaggregation-transfer-backend ascend \
        --watchdog-timeout 9000 \
        --context-length 180000 \
        --tokenizer-worker-num 4 \
        --disable-shared-experts-fusion \
        --dtype bfloat16 \
        --load-balance-method round_robin \
        --speculative-algorithm NEXTN \
        --speculative-num-steps 4 \
        --speculative-eagle-topk 1 \
        --speculative-num-draft-tokens 5
        break
    fi
done
```

```bash Command theme={null}
# ============================================================
# Before running, replace the following placeholders:
#   <your prefill ip>: prefill node IP address
#   <your decode ip1>: first decode node IP address (decode may have distributed nodes)
# ============================================================

sgl-router \
    --model-id glm-5 \
    --no-tokenizer \
    --worker-urls http://<your prefill ip>:8000 http://<your decode ip1>:8001 \
    --host 127.0.0.1 \
    --port 6688 \
    --request-timeout-secs 1800 \
    --stale-request-timeout-secs 1800 \
    --policy round_robin
```

#### Benchmark

The measured run used AISBench's prefix-cache mode (`repeat_rate = 0.9`, `--dp 32` client parallelism); the command below is the equivalent `bench_serving` `generated-shared-prefix` reproduction with a 90% shared prefix:
`--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.

```bash Command theme={null}
python -m sglang.benchmark.serving \
    --dataset-name generated-shared-prefix \
    --backend sglang \
    --host 127.0.0.1 \
    --port 6688 \
    --gsp-num-groups 1 \
    --gsp-prompts-per-group 256 \
    --gsp-system-prompt-len 117964 \
    --gsp-question-len 13107 \
    --gsp-output-len 1024 \
    --max-concurrency 64 \
    --num-prompts 256
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.