Qwen3.5 397B A17B MXFP4 deployment guide
Updated at:
Copy as MD
Deployment on Lingjun Zhenwu M890P efg3.GP9A instance
SGLang v0.5.21
Environment preparation
Image
docker pull egslingjun-registry.cn-wulanchabu.cr.aliyuncs.com/egslingjun-tmp/inference-xpu-pytorch-opt:v0.5.21_1ccf267d76_20261116_175604
Download the model.
# T-HEAD quantized model
modelscope download --model T-HEAD/Qwen3.5-397B-A17B-MoE-Quant-W-MXFP4-A-MXFP4-Dense-Quant-W-FP8-PerChannel-A-FP8-PerToken --local_dir /path/to/your/model
ModelScope Address: https://modelscope.cn/models/T-HEAD/Qwen3.5-397B-A17B-MoE-Quant-W-MXFP4-A-MXFP4-Dense-Quant-W-FP8-PerChannel-A-FP8-PerToken
PD disaggregation deployment (with Mooncake)
This guide uses the open-source Mooncake library for PD disaggregation, transferring the KV cache via RDMA.
Prefill
export MODEL_PATH=/path/to/your/model
export SERVED_MODEL_NAME=qwen35
export SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=65536
export DG_MOE_G2_RING_SCRATCH_BLOCKS_PER_SM=0
export DG_MOE_G2_DIRECT_FRAGMENT_SCATTER=1
export SGLANG_OPT_ULTRA_EP_PPU=1
export SGLANG_OPT_ULTRA_EP_PPU_REDUNDANT_PER_RANK=2
export MEGA_MOE_PULL_SMS=20
export SGLANG_WARMUP_TIMEOUT=3600
export SGLANG_ENABLE_HEALTH_ENDPOINT_GENERATION=false
export SGLANG_ENABLE_JIT_DEEPGEMM=1
export SGLANG_JIT_DEEPGEMM_PRECOMPILE=1
export SGLANG_JIT_DEEPGEMM_FAST_WARMUP=0
export PYTHONUNBUFFERED=1
export SERVING_PORT=8000
export NCCL_IB_GID_INDEX=3
export SGLANG_ENABLE_CACHELINK=0
export MC_FORCE_HCA=1
export MOONCAKE_PROTOCOL=rdma
sglang serve \
--model-path ${MODEL_PATH} \
--served-model-name ${SERVED_MODEL_NAME} \
--trust-remote-code \
--tp-size 8 \
--ep-size 8 \
--moe-a2a-backend megamoe \
--attention-backend fa3 \
--disaggregation-transfer-backend mooncake \
--page-size 64 \
--chunked-prefill-size 65536 \
--max-prefill-tokens 65536 \
--mem-fraction-static 0.8 \
--disable-shared-experts-fusion \
--disable-custom-all-reduce \
--disable-cuda-graph \
--watchdog-timeout 60000 \
--dist-timeout 60000 \
--reasoning-parser qwen3 \
--tool-call-parser qwen3_coder \
--disable-overlap-schedule \
--enable-metrics \
--enable-cache-report \
--disaggregation-mode prefill \
--disaggregation-bootstrap-port 8030 \
--disaggregation-ib-device mlx5_bond_0,mlx5_bond_1,mlx5_bond_2,mlx5_bond_3 \
--port ${SERVING_PORT} \
--host 0.0.0.0
Decode
export MODEL_PATH=/path/to/your/model
export SERVED_MODEL_NAME=qwen35
export SGLANG_WARMUP_TIMEOUT=3600
export DG_USE_MOE_DYNAMIC_TILE=1
export SGLANG_MAMBA_SLOT_INDIRECTION=1
export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=256
export DEEPEP_TIMEOUT_SECONDS=3600
export SGLANG_ENABLE_JIT_DEEPGEMM=1
export SGLANG_JIT_DEEPGEMM_PRECOMPILE=1
export SGLANG_JIT_DEEPGEMM_FAST_WARMUP=0
export PYTHONUNBUFFERED=1
export SERVING_PORT=8000
export NCCL_IB_GID_INDEX=3
export SGLANG_ENABLE_CACHELINK=0
export MC_FORCE_HCA=1
export MOONCAKE_PROTOCOL=rdma
sglang serve \
--model-path ${MODEL_PATH} \
--served-model-name ${SERVED_MODEL_NAME} \
--trust-remote-code \
--tp-size 8 \
--dp-size 8 \
--enable-dp-attention \
--moe-dense-tp-size 1 \
--enable-dp-lm-head \
--moe-runner-backend deep_gemm \
--attention-backend fa3 \
--disaggregation-transfer-backend mooncake \
--page-size 64 \
--cuda-graph-max-bs-decode 80 \
--max-running-requests 640 \
--max-mamba-cache-size 640 \
--mem-fraction-static 0.85 \
--speculative-algorithm NEXTN \
--speculative-num-steps 2 \
--speculative-eagle-topk 1 \
--speculative-num-draft-tokens 3 \
--disable-shared-experts-fusion \
--disable-custom-all-reduce \
--disable-radix-cache \
--stream-interval 128 \
--watchdog-timeout 60000 \
--dist-timeout 60000 \
--reasoning-parser qwen3 \
--tool-call-parser qwen3_coder \
--enable-metrics \
--enable-cache-report \
--disaggregation-mode decode \
--disaggregation-bootstrap-port 8030 \
--disaggregation-ib-device mlx5_bond_0,mlx5_bond_1,mlx5_bond_2,mlx5_bond_3 \
--port ${SERVING_PORT} \
--host 0.0.0.0
Start the router
python -m sglang_router.launch_router \
--prefill http://$PREFILL_IP:$PREFILL_PORT $BOOTSTRAP_PORT \
--decode http://$DECODE_IP:$DECODE_PORT \
--host 0.0.0.0 \
--port $SERVICE_PORT \
--pd-disaggregation \
--disable-health-check \
--worker-startup-check-interval 1800 \
--request-timeout-secs 3600
Is this page helpful?