MiniMax M3 MXFP4 部署指南

更新时间:
复制 MD 格式

基于灵骏真武 M890P 实例 efg3.GP9A 部署

SGLang v0.5.23

环境准备

镜像

docker pull egslingjun-registry.cn-wulanchabu.cr.aliyuncs.com/egslingjun-tmp/sglang:v0.5.23-ppu2.2.1-20261126

下载模型。

# T-HEAD量化模型
modelscope download --model T-HEAD/MiniMax-M3-MoE-Quant-W-MXFP4-A-MXFP4-Dense-Quant-W-FP8-PerChannel-A-FP8-PerToken --local_dir /path/to/your/model
ModelScope 地址:https://modelscope.cn/models/T-HEAD/MiniMax-M3-MoE-Quant-W-MXFP4-A-MXFP4-Dense-Quant-W-FP8-PerChannel-A-FP8-PerToken
部署拓扑:采用 1P1D(各 1 节点 8 卡,共 16 卡)拓扑,可基于M890P实例部署。

PD 分离部署(基于 Mooncake)

PD 分离部署采用开源 Mooncake,通过 RDMA 传输 KVCache。

部署拓扑

角色

节点数

每节点卡数

并行策略

Prefill

1

8

TP8 / EP8 + prefill CP(zigzag),DeepEP normal

Decode

1

8

TP8 / DP8 / EP8,a2a none,FA3

Prefill

export MODEL_PATH=/path/to/your/model
export SERVED_MODEL_NAME=MiniMax-M3
export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
export IB_DEVICE=mlx5_bond_0,mlx5_bond_1,mlx5_bond_2,mlx5_bond_3
export SGLANG_CACHE_DIR=/root/.cache/sglang
export NCCL_IB_GID_INDEX=3
export SGLANG_DG_CACHE_DIR=/root/.cache/sglang/deep_gemm
export SGLANG_JIT_CACHE_DIR=/root/.cache/sglang/jit
export SERVING_PORT=8000
export DG_USE_MOE_DYNAMIC_TILE=1
export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=256
export SGLANG_PPU_MINIMAX_M3_MSA=1
export SGLANG_PPU_MINIMAX_M3_MSA_ATTEND=1
export SGLANG_PPU_MINIMAX_M3_MSA_INDEXER_FP8=1
export SGLANG_PPU_MINIMAX_M3_MSA_INDEXER_SCORE_BF16=1
export SGLANG_SAIL_DEEPEP_RECV_HOOK=0
export SGLANG_WARMUP_TIMEOUT=3600
export TORCHINDUCTOR_WORKER_START=spawn
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 MC_FORCE_HCA=1
export MOONCAKE_PROTOCOL=rdma
export HGGC_EMBEDDED_COPY_THRESHOLD=0x10000
export PYTHONUNBUFFERED=1
export SGLANG_ENABLE_CACHELINK=0
sglang serve \
  --model-path ${MODEL_PATH} \
  --served-model-name ${SERVED_MODEL_NAME} \
  --trust-remote-code \
  --page-size 128 \
  --tp-size 8 \
  --attn-cp-size 8 \
  --enable-prefill-cp \
  --cp-strategy zigzag \
  --ep-size 8 \
  --moe-a2a-backend deepep \
  --deepep-mode normal \
  --disaggregation-transfer-backend mooncake \
  --mem-fraction-static 0.8 \
  --context-length 65536 \
  --max-running-requests 256 \
  --max-total-tokens 262144 \
  --chunked-prefill-size 32768 \
  --max-prefill-tokens 32768 \
  --reasoning-parser minimax-m3 \
  --tool-call-parser minimax-m3 \
  --watchdog-timeout 60000 \
  --dist-timeout 60000 \
  --disable-overlap-schedule \
  --enable-metrics \
  --enable-cache-report \
  --disaggregation-mode prefill \
  --disaggregation-bootstrap-port $((SERVING_PORT + 30)) \
  --disaggregation-ib-device ${IB_DEVICE} \
  --port ${SERVING_PORT} \
  --host 0.0.0.0

Decode

export MODEL_PATH=/path/to/your/model
export SERVED_MODEL_NAME=MiniMax-M3
export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
export IB_DEVICE=mlx5_bond_0,mlx5_bond_1,mlx5_bond_2,mlx5_bond_3
export SGLANG_CACHE_DIR=/root/.cache/sglang
export NCCL_IB_GID_INDEX=3
export SGLANG_DG_CACHE_DIR=/root/.cache/sglang/deep_gemm
export SGLANG_JIT_CACHE_DIR=/root/.cache/sglang/jit
export SERVING_PORT=8000
export DG_USE_MOE_DYNAMIC_TILE=1
export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=256
export SGLANG_PPU_MINIMAX_M3_MSA=1
export SGLANG_PPU_MINIMAX_M3_MSA_ATTEND=1
export SGLANG_PPU_MINIMAX_M3_MSA_INDEXER_FP8=1
export SGLANG_PPU_MINIMAX_M3_MSA_INDEXER_SCORE_BF16=1
export SGLANG_SAIL_DEEPEP_RECV_HOOK=0
export SGLANG_WARMUP_TIMEOUT=3600
export TORCHINDUCTOR_WORKER_START=spawn
export SGLANG_ENABLE_JIT_DEEPGEMM=1
export SGLANG_JIT_DEEPGEMM_PRECOMPILE=1
export SGLANG_JIT_DEEPGEMM_FAST_WARMUP=0
export MC_FORCE_HCA=1
export MOONCAKE_PROTOCOL=rdma
export HGGC_EMBEDDED_COPY_THRESHOLD=0x10000
export PYTHONUNBUFFERED=1
export SGLANG_ENABLE_CACHELINK=0
sglang serve \
  --model-path ${MODEL_PATH} \
  --served-model-name ${SERVED_MODEL_NAME} \
  --trust-remote-code \
  --page-size 128 \
  --tp-size 8 \
  --dp-size 8 \
  --enable-dp-attention \
  --ep-size 8 \
  --moe-a2a-backend none \
  --deepep-mode normal \
  --attention-backend fa3 \
  --cuda-graph-backend-decode full \
  --cuda-graph-backend-prefill disabled \
  --disaggregation-transfer-backend mooncake \
  --mem-fraction-static 0.8 \
  --context-length 65536 \
  --max-running-requests 256 \
  --max-total-tokens 262144 \
  --max-prefill-tokens 4096 \
  --chunked-prefill-size 4096 \
  --cuda-graph-max-bs-decode 256 \
  --reasoning-parser minimax-m3 \
  --tool-call-parser minimax-m3 \
  --watchdog-timeout 60000 \
  --dist-timeout 60000 \
  --disable-radix-cache \
  --enable-metrics \
  --enable-cache-report \
  --disaggregation-mode decode \
  --disaggregation-bootstrap-port $((SERVING_PORT + 30)) \
  --disaggregation-ib-device ${IB_DEVICE} \
  --port ${SERVING_PORT} \
  --host 0.0.0.0

启动 Router

export PREFILL0_IP=<prefill 节点 IP>
export DECODE_IP=<decode 节点 IP>
export PREFILL0_PORT=8000
export DECODE_PORT=8000
export BOOTSTRAP_PORT=8030
export SERVICE_PORT=8080

python -m sglang_router.launch_router \
    --prefill http://$PREFILL0_IP:$PREFILL0_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

SGLang v0.5.21

环境准备

镜像

docker pull egslingjun-registry.cn-wulanchabu.cr.aliyuncs.com/egslingjun-tmp/inference-xpu-pytorch-opt:v0.5.21_1ccf267d76_20261116_175604

下载模型。

# T-HEAD量化模型
modelscope download --model T-HEAD/MiniMax-M3-MoE-Quant-W-MXFP4-A-MXFP4-Dense-Quant-W-FP8-PerChannel-A-FP8-PerToken --local_dir /path/to/your/model
模型:https://modelscope.cn/models/T-HEAD/MiniMax-M3-MoE-Quant-W-MXFP4-A-MXFP4-Dense-Quant-W-FP8-PerChannel-A-FP8-PerToken

PD分离部署(基于Mooncake)

这里PD分离部署采用开源Mooncake,通过RDMA传输KVCache。

Prefill

export MODEL_PATH=/path/to/your/model
export SERVED_MODEL_NAME=MiniMax-M3
export DG_USE_MOE_DYNAMIC_TILE=1
export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=256
export SGLANG_PPU_MINIMAX_M3_MSA=1
export SGLANG_PPU_MINIMAX_M3_MSA_ATTEND=1
export SGLANG_PPU_MINIMAX_M3_MSA_INDEXER_FP8=1
export SGLANG_PPU_MINIMAX_M3_MSA_INDEXER_SCORE_BF16=1
export SGLANG_SAIL_DEEPEP_RECV_HOOK=0
export SGLANG_WARMUP_TIMEOUT=3600
export TORCHINDUCTOR_WORKER_START=spawn
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 SGLANG_ENABLE_CACHELINK=0
export MC_FORCE_HCA=1
export NCCL_IB_GID_INDEX=3
export MOONCAKE_PROTOCOL=rdma
export SGLANG_USE_MODELSCOPE=1
sglang serve \
  --model-path ${MODEL_PATH} \
  --served-model-name ${SERVED_MODEL_NAME} \
  --trust-remote-code \
  --tokenizer-path ${MODEL_PATH} \
  --tp-size 8 \
  --attn-cp-size 8 \
  --enable-prefill-cp \
  --cp-strategy zigzag \
  --ep-size 8 \
  --moe-a2a-backend deepep \
  --deepep-mode auto \
  --mem-fraction-static 0.8 \
  --context-length 65536 \
  --max-running-requests 256 \
  --max-total-tokens 262144 \
  --chunked-prefill-size 32768 \
  --max-prefill-tokens 32768 \
  --reasoning-parser minimax-m3 \
  --tool-call-parser minimax-m3 \
  --watchdog-timeout 60000 \
  --dist-timeout 60000 \
  --disaggregation-mode prefill \
  --disaggregation-bootstrap-port 8030 \
  --disaggregation-transfer-backend mooncake \
  --enable-metrics \
  --enable-cache-report \
  --disable-overlap-schedule \
  --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=MiniMax-M3
export DG_USE_MOE_DYNAMIC_TILE=1
export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=256
export SGLANG_PPU_MINIMAX_M3_MSA=1
export SGLANG_PPU_MINIMAX_M3_MSA_ATTEND=1
export SGLANG_PPU_MINIMAX_M3_MSA_INDEXER_FP8=1
export SGLANG_PPU_MINIMAX_M3_MSA_INDEXER_SCORE_BF16=1
export SGLANG_SAIL_DEEPEP_RECV_HOOK=0
export SGLANG_WARMUP_TIMEOUT=3600
export TORCHINDUCTOR_WORKER_START=spawn
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 SGLANG_ENABLE_CACHELINK=0
export MC_FORCE_HCA=1
export NCCL_IB_GID_INDEX=3
export MOONCAKE_PROTOCOL=rdma
export SGLANG_USE_MODELSCOPE=1
sglang serve \
  --model-path ${MODEL_PATH} \
  --served-model-name ${SERVED_MODEL_NAME} \
  --trust-remote-code \
  --tokenizer-path ${MODEL_PATH} \
  --tp-size 8 \
  --dp-size 8 \
  --enable-dp-attention \
  --ep-size 8 \
  --moe-a2a-backend deepep \
  --deepep-mode auto \
  --attention-backend fa3 \
  --mem-fraction-static 0.8 \
  --context-length 65536 \
  --max-running-requests 256 \
  --max-total-tokens 262144 \
  --max-prefill-tokens 4096 \
  --chunked-prefill-size 4096 \
  --cuda-graph-backend-decode full \
  --cuda-graph-max-bs-decode 256 \
  --cuda-graph-backend-prefill disabled \
  --reasoning-parser minimax-m3 \
  --tool-call-parser minimax-m3 \
  --watchdog-timeout 60000 \
  --dist-timeout 60000 \
  --disaggregation-mode decode \
  --disaggregation-bootstrap-port 8030 \
  --disaggregation-transfer-backend mooncake \
  --enable-metrics \
  --enable-cache-report \
  --disable-radix-cache \
  --disaggregation-ib-device mlx5_bond_0,mlx5_bond_1,mlx5_bond_2,mlx5_bond_3 \
  --port ${SERVING_PORT} \
  --host 0.0.0.0

启动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