# MiniMaxAI/MiniMax-M3.1-Flash — vLLM serving recipe

> MiniMax M3.1-Flash vision-language MoE (~428B total / 23B active) with MSA sparse attention throughout and a built-in DSpark draft; quantization-aware trained, MXFP8 dense layers and NVFP4 experts. Served TP4 on NVIDIA Blackwell or AMD MI355X, prefill/decode disaggregated as TP4 + TP4 on MI355X or DEP2 + DEP4 on GB200/GB300, and TP8 on NVIDIA Hopper.

Configuration: hardware `b300` (8× B300) · strategy `single_node_tp` (Tensor Parallel) · variant `default` (NVFP4) · features `tool_calling`, `reasoning`, `spec_decoding`

- Interactive page: https://vllm-recipes-acejrj0gz-inferact-inc.vercel.app/MiniMaxAI/MiniMax-M3.1-Flash
- This configuration as JSON: https://vllm-recipes-acejrj0gz-inferact-inc.vercel.app/MiniMaxAI/MiniMax-M3.1-Flash.json?hardware=b300

The commands below were rendered for exactly this configuration and take precedence over any example in the guide.

## Other configurations

Change the query string (the same parameters as the page URL) and fetch this URL again. Unknown or incompatible values fall back to the recipe default, so check the Configuration line.

- `hardware`: `b200`, `gb200`, `b300`, `gb300`, `vr200`, `mi355x`
- `variant`: `default`, `mxfp4`, `fp8`, `ascend_w8a8`, `ascend_w8a8_mxfp8`
- `strategy`: `single_node_tp`, `single_node_tep`, `single_node_dep`, `multi_node_tp`, `multi_node_dep`, `multi_node_tep`, `pd_cluster` (multi-node strategies also need `nodes=<n>`)
- `features`: comma-separated list of `tool_calling`, `reasoning`, `spec_decoding`, `text_only`, `prefill_dbo_sp`, `parallel_topk`, `mono_decode` (default: `tool_calling`, `reasoning`, `spec_decoding`). Use `features=none` to turn them all off.
- `prefill_nodes`, `decode_nodes`: dedicated node counts for each pool under `strategy=pd_cluster`.
- `prefill_mode`, `decode_mode`: `tp`, `tep`, `dep`.
- `prefill_rank`, `decode_rank`: zero-based node indices (`0` to the pool's node count minus one). These select the singular command; `node_commands[]` always includes every node.
- `pd_router`: `vllm`, `dynamo`, `smg`, `ascend`. Hardware and pool compatibility applies.
- `pd_connector`: `nixl`, `mooncake`, `mooncake_ascend`, `moriio`. Select independently of the router; catalog hardware/router compatibility still applies.
- `preset`: a tuned, evidence-backed configuration (`baseline` opts out of a default one). Each sets its own hardware and strategy:
  - `gb300_agentx_agg` — AgentX TP4 (Dynamo) (gb300 · TP · Agentic (InferenceX AgentX) · opt-in): `hardware=gb300&strategy=single_node_tp&preset=gb300_agentx_agg`
  - `gb300_agentx_pd` — AgentX PD (Dynamo) (gb300 · PD · Agentic (InferenceX AgentX) · opt-in): `hardware=gb300&strategy=pd_cluster&preset=gb300_agentx_pd`
  - `gb300_agentx_tp4` — AgentX TP4 (gb300 · TP · Agentic (InferenceX AgentX) · opt-in): `hardware=gb300&strategy=single_node_tp&preset=gb300_agentx_tp4`
  - `gb300_agentx_dep4` — AgentX DEP4 (gb300 · DEP · Agentic (InferenceX AgentX) · opt-in): `hardware=gb300&strategy=single_node_dep&preset=gb300_agentx_dep4`
  - `gb300_agentx_tp2` — AgentX TP2 + KV offload (gb300 · TP · Agentic (InferenceX AgentX) · opt-in): `hardware=gb300&strategy=single_node_tp&preset=gb300_agentx_tp2`
  - `b300_agentx_tp4` — AgentX TP4 (b300 · TP · Agentic (InferenceX AgentX) · opt-in): `hardware=b300&strategy=single_node_tp&preset=b300_agentx_tp4`
  - `b300_agentx_tp2` — AgentX TP2 + KV offload (b300 · TP · Agentic (InferenceX AgentX) · opt-in): `hardware=b300&strategy=single_node_tp&preset=b300_agentx_tp2`
  - `gb200_agentx_agg` — AgentX TP4 (Dynamo) (gb200 · TP · Agentic (InferenceX AgentX) · opt-in): `hardware=gb200&strategy=single_node_tp&preset=gb200_agentx_agg`
  - `gb200_agentx_pd` — AgentX PD (Dynamo) (gb200 · PD · Agentic (InferenceX AgentX) · opt-in): `hardware=gb200&strategy=pd_cluster&preset=gb200_agentx_pd`
  - `h100_agentx` — AgentX TP8 (h100 · TP · Agentic (InferenceX AgentX) · opt-in): `hardware=h100&variant=fp8&strategy=single_node_tp&preset=h100_agentx`
  - `mi355x_agentx` — AgentX TP4 (mi355x · TP · Agentic (InferenceX AgentX) · opt-in): `hardware=mi355x&variant=mxfp4&strategy=single_node_tp&preset=mi355x_agentx`
  - `mi355x_agentx_pd` — AgentX 1P2D (Mooncake) (mi355x · PD · Agentic (InferenceX AgentX) · opt-in): `hardware=mi355x&variant=mxfp4&strategy=pd_cluster&preset=mi355x_agentx_pd`
  - `h200_agentx` — AgentX TP8 (h200 · TP · Agentic (InferenceX AgentX) · opt-in): `hardware=h200&variant=fp8&strategy=single_node_tp&preset=h200_agentx`
  - `ascend_a3_w8a8_agg` — A3 W8A8 single node (DP4 x TP4) (ascend_910c · TP · 128K context, DSpark, vision input · default): `hardware=ascend_910c&variant=ascend_w8a8&strategy=single_node_tp&preset=ascend_a3_w8a8_agg`
  - `ascend_a5_w8a8_mxfp8_agg` — 950DT MXFP8 single node (DP2 x TP4) (ascend_950dt_8x · TP · 128K context, DSpark, vision input · default): `hardware=ascend_950dt_8x&variant=ascend_w8a8_mxfp8&strategy=single_node_tp&preset=ascend_a5_w8a8_mxfp8_agg`
  - `ascend_a3_w8a8_pd` — A3 W8A8 PD (1P1D) (ascend_910c · PD · Prefill/decode disaggregation, 128K context, DSpark · default): `hardware=ascend_910c&variant=ascend_w8a8&strategy=pd_cluster&preset=ascend_a3_w8a8_pd`
  - `ascend_a5_w8a8_mxfp8_pd` — 950DT MXFP8 PD (1P1D) (ascend_950dt_8x · PD · Prefill/decode disaggregation, 128K context, DSpark · default): `hardware=ascend_950dt_8x&variant=ascend_w8a8_mxfp8&strategy=pd_cluster&preset=ascend_a5_w8a8_mxfp8_pd`

## Install

Requires vLLM >= 0.33.0 (not released yet — nightly wheel).

Docker image: `vllm/vllm-openai:minimax-m31-flash`

## Serve

```bash
export VLLM_FLOAT32_MATMUL_PRECISION=high
vllm serve MiniMaxAI/MiniMax-M3.1-Flash \
  --block-size 128 \
  --disable-hybrid-kv-cache-manager \
  --tensor-parallel-size 8 \
  --kv-cache-dtype nvfp4 \
  --attention-config '{"indexer_kv_dtype": "nvfp4", "use_prefill_query_quantization": true}' \
  --compilation-config '{"cudagraph_mode": "FULL_AND_PIECEWISE"}' \
  --tool-call-parser minimax_m3 \
  --enable-auto-tool-choice \
  --reasoning-parser minimax_m3 \
  --speculative-config '{"method":"dspark","num_speculative_tokens":7,"attention_backend":"FLASHINFER_TS","kv_cache_dtype":"fp8","draft_sample_method":"probabilistic","rejection_sample_method":"block"}'
```

Docker equivalent:

```bash
docker run --gpus all \
  --privileged --ipc=host -p 8000:8000 \
  -v ~/.cache/huggingface:/root/.cache/huggingface \
  -e VLLM_FLOAT32_MATMUL_PRECISION=high \
  vllm/vllm-openai:minimax-m31-flash MiniMaxAI/MiniMax-M3.1-Flash \
  --block-size 128 \
  --disable-hybrid-kv-cache-manager \
  --tensor-parallel-size 8 \
  --kv-cache-dtype nvfp4 \
  --attention-config '{"indexer_kv_dtype": "nvfp4", "use_prefill_query_quantization": true}' \
  --compilation-config '{"cudagraph_mode": "FULL_AND_PIECEWISE"}' \
  --tool-call-parser minimax_m3 \
  --enable-auto-tool-choice \
  --reasoning-parser minimax_m3 \
  --speculative-config '{"method":"dspark","num_speculative_tokens":7,"attention_backend":"FLASHINFER_TS","kv_cache_dtype":"fp8","draft_sample_method":"probabilistic","rejection_sample_method":"block"}'
```

## Guide

> Background reference. Commands in it are examples and may target another configuration — use the Serve section above.

### Overview

[MiniMax-M3.1-Flash](https://huggingface.co/MiniMaxAI/MiniMax-M3.1-Flash) is a
vision-language MoE model from [MiniMax](https://www.minimax.io/) that keeps
the MoE architecture of [MiniMax-M3](https://huggingface.co/MiniMaxAI/MiniMax-M3):
about 428B total / 23B active parameters and a 1M-token context, with MSA
sparse attention in every layer.

- **Quantization-aware training** — the checkpoint stores MXFP8 dense layers
  and NVFP4 experts.
- **Built-in DSpark draft** — the `dspark/` directory of the checkpoint;
  `--speculative-config` needs no draft model path.
- **Native multimodal** — image and video inputs.

### Prerequisites

- **AMD:** MI355X (gfx950), ROCm 7.2+, TP4.
- **NVIDIA Blackwell:** GB200, GB300, B200 or B300, TP4; NVFP4 MoE runs
  natively on the FP4 tensor cores.
- **NVIDIA Rubin (preview):** VR200, TP4, with the
  `vllm/vllm-openai:minimax-m31-flash-cu134` image (CUDA 13.4) and no pip
  path. It uses the Blackwell flags and hasn't been tuned on Rubin; the
  GB200/GB300 PD and AgentX configurations don't apply.
- **NVIDIA Hopper:** H100 or H200, TP8 on a full node, with the FP8
  variant: FP8 KV and indexer caches, NVFP4 MoE on Marlin.
- **`--block-size 128` is mandatory** (MSA sparse/index cache).

### Launching the Server

#### Single node (TP4, AMD MI355X)

```bash
VLLM_ROCM_USE_AITER=1 VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS=1 \
vllm serve MiniMaxAI/MiniMax-M3.1-Flash \
  -tp 4 \
  --reasoning-parser minimax_m3 \
  --block-size 128 \
  --kv-cache-dtype nvfp4 \
  --attention-config '{"indexer_kv_dtype": "nvfp4", "indexer_decode_cp": true}' \
  --quantization-config.moe mxfp8 \
  --speculative-config '{"method":"dspark","num_speculative_tokens":3,"attention_backend":"TRITON_ATTN","kv_cache_dtype":"fp8","draft_sample_method":"probabilistic"}' \
  --disable-hybrid-kv-cache-manager
```

- `--kv-cache-dtype nvfp4` and `indexer_kv_dtype: nvfp4` store the KV cache
  and the sparse-attention indexer's K cache in NVFP4.
- `indexer_decode_cp` splits the indexer's decode scoring across the TP ranks
  by context instead of by index head.
- `--quantization-config.moe mxfp8` re-quantizes the NVFP4 experts to MXFP8 at
  load for the AITER MoE.
- With a seven-token DSpark draft (`num_speculative_tokens: 7`),
  `--monokernel` runs draft steps of up to 10 requests as fused FlyDSL
  kernels.

#### Parallel index top-k (AMD MI355X)

`parallel_topk` enables parallel decode top-16 selection for the NVFP4
indexer. It is disabled by default. Use a build containing the selector and
set `VLLM_ROCM_PARALLEL_INDEX_TOPK=1`, or enable the recipe feature.
FP8 indexers, including mono decode, bypass this path. Benchmark and CI
lanes must explicitly enable it in an image containing the patch; adding
the kernel or running correctness CI alone does not enable it for serving.

#### DBO and SP prefill (TP4, AMD MI355X)

Two opt-in switches make long prefill steps faster on the single-node MI355X
engine (the **DBO / SP prefill** feature in the command builder):

- **DBO** (dual-batch overlap): `--enable-dbo` splits a prefill step into two
  microbatches and runs one microbatch's all-reduce under the other's compute.
  `--dbo-decode-token-threshold 32768` keeps decode steps whole. DBO needs
  `VLLM_USE_V2_MODEL_RUNNER=1`: without it, `--enable-dbo` selects the V1
  runner, which refuses the DSpark draft.
- **SP** (sequence-parallel prefill): `VLLM_ROCM_MINIMAX_M3_SP_PREFILL=1`
  keeps the residual stream sharded by tokens on steps of 4096+ tokens, so
  each layer's two all-reduces become an all-to-all and a reduce-scatter. It
  keeps a full `o_proj` copy per GPU, about 3.1 GB less KV cache.
- **SP + DBO**: set both, with `--dbo-prefill-token-threshold 16384`, so each
  DBO microbatch has 8192+ tokens and stays on the SP path.

On the MXFP8 MoE, one 32K-token prefill takes 1035 ms plain, 655 ms with DBO
and 484 ms with SP + DBO. The server log confirms SP with
`MiniMax-M3 sequence-parallel prefill (from 4096 tokens, DBO microbatches from 8192): on`.

```bash
VLLM_ROCM_USE_AITER=1 VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS=1 \
VLLM_USE_V2_MODEL_RUNNER=1 VLLM_ROCM_MINIMAX_M3_SP_PREFILL=1 \
vllm serve MiniMaxAI/MiniMax-M3.1-Flash \
  -tp 4 \
  --reasoning-parser minimax_m3 \
  --block-size 128 \
  --kv-cache-dtype nvfp4 \
  --attention-config '{"indexer_kv_dtype": "nvfp4", "indexer_decode_cp": true}' \
  --quantization-config.moe mxfp8 \
  --speculative-config '{"method":"dspark","num_speculative_tokens":3,"attention_backend":"TRITON_ATTN","kv_cache_dtype":"fp8","draft_sample_method":"probabilistic"}' \
  --enable-dbo \
  --dbo-prefill-token-threshold 16384 \
  --dbo-decode-token-threshold 32768 \
  --disable-hybrid-kv-cache-manager
```

#### Single node (TP4, NVIDIA GB200)

```bash
VLLM_FLOAT32_MATMUL_PRECISION=high \
vllm serve MiniMaxAI/MiniMax-M3.1-Flash \
  -tp 4 \
  --reasoning-parser minimax_m3 \
  --block-size 128 \
  --kv-cache-dtype nvfp4 \
  --attention-config '{"indexer_kv_dtype": "nvfp4", "use_prefill_query_quantization": true}' \
  --compilation-config '{"cudagraph_mode": "FULL_AND_PIECEWISE"}' \
  --speculative-config '{"method":"dspark","num_speculative_tokens":7,"attention_backend":"FLASHINFER_TS","kv_cache_dtype":"fp8","draft_sample_method":"probabilistic","rejection_sample_method":"block"}' \
  --max-num-seqs 256 \
  --disable-hybrid-kv-cache-manager
```

- Blackwell runs the NVFP4 experts natively, so no
  `--quantization-config.moe` override is needed.
- `use_prefill_query_quantization` quantizes the prefill query on the MSA
  indexer path (Q8KV4).

#### Single node (TP8, NVIDIA H100 / H200)

```bash
vllm serve MiniMaxAI/MiniMax-M3.1-Flash \
  --tensor-parallel-size 8 \
  --reasoning-parser minimax_m3 \
  --block-size 128 \
  --kv-cache-dtype fp8 \
  --attention-config '{"indexer_kv_dtype": "fp8"}' \
  --compilation-config '{"cudagraph_mode": "FULL_AND_PIECEWISE"}' \
  --max-model-len 262144 \
  --max-num-seqs 80 \
  --limit-mm-per-prompt '{"video": 0}' \
  --no-enable-log-requests \
  --disable-hybrid-kv-cache-manager \
  --moe-backend marlin \
  --enable-auto-tool-choice \
  --tool-call-parser minimax_m3
```

- Hopper has no FP4 tensor cores: the KV cache and the indexer K cache use
  FP8, and the NVFP4 experts run on the Marlin MoE kernel.
- `--limit-mm-per-prompt '{"video": 0}'` turns off video inputs; images
  still work.
- DSpark speculative decoding is not enabled on Hopper.

#### Prefill/decode disaggregation (1P1D, TP4 + TP4, AMD MI355X)

Prefill node:

```bash
VLLM_ROCM_USE_AITER=1 VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS=1 \
VLLM_KV_CACHE_LAYOUT=BLHNC VLLM_NIXL_SIDE_CHANNEL_HOST=<P_IP> \
vllm serve MiniMaxAI/MiniMax-M3.1-Flash \
  -tp 4 \
  --reasoning-parser minimax_m3 \
  --block-size 128 \
  --kv-cache-dtype nvfp4 \
  --attention-config '{"indexer_kv_dtype": "nvfp4"}' \
  --quantization-config.moe mxfp8 \
  --speculative-config '{"method":"dspark","num_speculative_tokens":3,"attention_backend":"TRITON_ATTN","kv_cache_dtype":"fp8","draft_sample_method":"probabilistic"}' \
  --disable-hybrid-kv-cache-manager \
  --max-num-batched-tokens 32768 \
  --port 8100 \
  --kv-transfer-config '{"kv_connector":"MultiConnector","kv_role":"kv_both","kv_connector_extra_config":{"connectors":[
    {"kv_connector":"NixlConnector","kv_role":"kv_producer","kv_connector_extra_config":{"num_threads":4}},
    {"kv_connector":"SimpleCPUOffloadConnector","kv_role":"kv_both","kv_connector_extra_config":{"cpu_bytes_to_use_per_rank":601295421440,"cpu_hugepage_block_size":"1GB","lazy_offload":false}}]}}'
```

Decode node:

```bash
VLLM_ROCM_USE_AITER=1 VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS=1 \
VLLM_KV_CACHE_LAYOUT=BLHNC VLLM_NIXL_SIDE_CHANNEL_HOST=<D_IP> \
vllm serve MiniMaxAI/MiniMax-M3.1-Flash \
  -tp 4 \
  --reasoning-parser minimax_m3 \
  --block-size 128 \
  --kv-cache-dtype nvfp4 \
  --attention-config '{"indexer_kv_dtype": "nvfp4", "indexer_decode_cp": true}' \
  --quantization-config.moe mxfp8 \
  --speculative-config '{"method":"dspark","num_speculative_tokens":3,"attention_backend":"TRITON_ATTN","kv_cache_dtype":"fp8","draft_sample_method":"probabilistic"}' \
  --disable-hybrid-kv-cache-manager \
  --port 8200 \
  --kv-transfer-config '{"kv_connector":"NixlConnector","kv_role":"kv_consumer","kv_connector_extra_config":{"num_threads":4}}'
```

- `<P_IP>` and `<D_IP>` are each node's own address, reachable from the
  other node (the NIXL side channel).
- `VLLM_KV_CACHE_LAYOUT=BLHNC` goes on both nodes. It keeps all layers of a
  block contiguous, so NIXL reads one region per block instead of one per
  layer.
- The prefill node never decodes, so it leaves `indexer_decode_cp` off.
- The prefill node also offloads KV to host memory
  (`SimpleCPUOffloadConnector`): 560 GiB per rank in 1 GiB HugeTLB pages, so
  2240 pages for the four ranks. Reserve them on the host before the start
  (and allow them in the container's hugetlb limit), or the server fails at
  startup with `Cannot map 560.00 GiB of 1024 MiB HugeTLB pages`:

  ```bash
  echo 2240 | sudo tee /sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages
  ```

#### Prefill/decode disaggregation (1P1D, DEP2 + DEP4, NVIDIA GB200 / GB300)

A DEP2 prefill on one 4-GPU tray feeds a DEP4 decode on a second tray over
NIXL. Both roles run attention data parallel with the NVFP4 experts
on the DeepGEMM MegaMoE kernel over expert parallelism, the V2 model runner,
NUMA binding, and a seven-token DSpark draft on the FlashInfer PrimiTS
(`FLASHINFER_TS`) backend. The settings were tuned on GB300; GB200 uses the
same commands.

Prefill node:

```bash
VLLM_FLOAT32_MATMUL_PRECISION=high VLLM_USE_V2_MODEL_RUNNER=1 \
VLLM_ENGINE_READY_TIMEOUT_S=3600 VLLM_NIXL_SIDE_CHANNEL_HOST=<P_IP> \
vllm serve MiniMaxAI/MiniMax-M3.1-Flash \
  --data-parallel-size 2 \
  --enable-expert-parallel \
  --moe-backend deep_gemm_mega_moe \
  --numa-bind \
  --reasoning-parser minimax_m3 \
  --block-size 128 \
  --kv-cache-dtype nvfp4 \
  --attention-config '{"indexer_kv_dtype": "nvfp4", "use_prefill_query_quantization": true}' \
  --compilation-config '{"cudagraph_mode": "FULL_AND_PIECEWISE"}' \
  --speculative-config '{"method":"dspark","num_speculative_tokens":7,"attention_backend":"FLASHINFER_TS","kv_cache_dtype":"fp8","draft_sample_method":"probabilistic","rejection_sample_method":"block"}' \
  --max-num-seqs 64 \
  --max-num-batched-tokens 32768 \
  --long-prefill-token-threshold 8192 \
  --gpu-memory-utilization 0.9 \
  --enable-prefix-caching \
  --disable-hybrid-kv-cache-manager \
  --port 8100 \
  --kv-transfer-config '{"kv_connector":"NixlConnector","kv_role":"kv_producer","kv_load_failure_policy":"fail","kv_connector_extra_config":{"engine_ttl":0}}'
```

Decode node:

```bash
VLLM_FLOAT32_MATMUL_PRECISION=high VLLM_USE_V2_MODEL_RUNNER=1 \
VLLM_ENGINE_READY_TIMEOUT_S=3600 VLLM_NIXL_SIDE_CHANNEL_HOST=<D_IP> \
vllm serve MiniMaxAI/MiniMax-M3.1-Flash \
  --data-parallel-size 4 \
  --enable-expert-parallel \
  --moe-backend deep_gemm_mega_moe \
  --numa-bind \
  --reasoning-parser minimax_m3 \
  --block-size 128 \
  --kv-cache-dtype nvfp4 \
  --attention-config '{"indexer_kv_dtype": "nvfp4", "use_prefill_query_quantization": true}' \
  --compilation-config '{"cudagraph_mode": "FULL_DECODE_ONLY", "max_cudagraph_capture_size": 224}' \
  --speculative-config '{"method":"dspark","num_speculative_tokens":7,"attention_backend":"FLASHINFER_TS","kv_cache_dtype":"fp8","draft_sample_method":"probabilistic","rejection_sample_method":"block"}' \
  --max-num-seqs 28 \
  --max-num-batched-tokens 8192 \
  --gpu-memory-utilization 0.95 \
  --watermark 0.05 \
  --no-enable-prefix-caching \
  --disable-hybrid-kv-cache-manager \
  --port 8200 \
  --kv-transfer-config '{"kv_connector":"NixlConnector","kv_role":"kv_consumer","kv_load_failure_policy":"fail","kv_connector_extra_config":{"engine_ttl":0}}'
```

- `VLLM_ENGINE_READY_TIMEOUT_S=3600`: with data parallel, each API server
  waits this long for its engines to start (default 600 s). A cold prefill
  start (JIT builds, CUDA graph capture, FlashInfer autotune) takes longer
  than 10 minutes.
- `--max-num-seqs` is per DP rank. The decode CUDA graphs cover 28 requests
  of 1 + 7 tokens (224).
- `--watermark 0.05` keeps 5% of the decode KV cache free when admitting
  requests, so extra requests wait in the queue instead of preempting
  running ones. On GB300 (about 4.5M KV tokens per decode rank) at a
  200K-token mean context, expect about 19-21 running requests per rank.
- Keep the decode `--max-num-batched-tokens` at 8192: a preempted request
  recomputes its context in chunks of that size, and every DP rank runs
  eager steps until it finishes.
- `engine_ttl: 0` turns off NIXL's cleanup of idle remote engines; with the
  default one-hour TTL, a decode crashed an hour after its prefill went away.
- Prefix caching stays on the prefill node only. For multi-turn traffic, the
  prefill node can also offload KV to host memory, 180 GiB per rank:
  `--kv-transfer-config '{"kv_connector":"MultiConnector","kv_role":"kv_both","kv_load_failure_policy":"fail","kv_connector_extra_config":{"connectors":[{"kv_connector":"NixlConnector","kv_role":"kv_producer","kv_connector_extra_config":{"engine_ttl":0}},{"kv_connector":"SimpleCPUOffloadConnector","kv_role":"kv_both","kv_connector_extra_config":{"cpu_bytes_to_use_per_rank":193273528320,"lazy_offload":true}}]}}'`.

For a quick test, put the toy NIXL proxy from the vLLM repository in front of
the two nodes and send requests to port 8000:

```bash
python tests/v1/kv_connector/nixl_integration/toy_proxy_server.py --port 8000 \
  --prefiller-host <P_IP> --prefiller-port 8100 \
  --decoder-host <D_IP> --decoder-port 8200
```

### Client Usage

Recommended sampling parameters (from the model card): `temperature = 1.0`,
`top_p = 0.95`. Set the reasoning effort per request with
`chat_template_kwargs: {"reasoning_effort": "<level>"}`: `low`, `medium`,
`high`, `xhigh` or `max`.

```bash
curl http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MiniMaxAI/MiniMax-M3.1-Flash",
    "temperature": 1.0,
    "top_p": 0.95,
    "messages": [
      {"role": "user", "content": "Explain MSA sparse attention in 3 bullets."}
    ]
  }'
```

### Benchmarking

```bash
vllm bench serve \
  --backend vllm \
  --model MiniMaxAI/MiniMax-M3.1-Flash \
  --endpoint /v1/completions \
  --dataset-name random \
  --random-input 8192 \
  --random-output 1024 \
  --max-concurrency 32 \
  --num-prompts 320
```

### Troubleshooting

- **`--block-size` mismatch.** MSA's sparse block size is 128; the vLLM KV
  cache block size must match (otherwise `No common block size for 16`).
- **Parsers.** `--tool-call-parser` and `--reasoning-parser` both use
  `minimax_m3`.
- **HugeTLB pages (PD prefill node).** See the AMD PD section above.

### References

- [Model card](https://huggingface.co/MiniMaxAI/MiniMax-M3.1-Flash)
- [MiniMax-M3 recipe](https://recipes.vllm.ai/MiniMaxAI/MiniMax-M3)
- [MiniMax](https://www.minimax.io/)

#### Ascend deployment

MiniMax M3.1-Flash on Ascend runs from ModelScope builds of the
quantization-aware checkpoint: `Eco-Tech/Minimax-M3.1-Flash-w8a8` on Atlas
800I A3 (16 x Ascend 910C, 64 GB HBM per NPU) and
`Eco-Tech/Minimax-M3.1-Flash-w8a8-mxfp8` on Atlas 950DT (8 NPUs, 96 GB each).
The Hugging Face checkpoint `MiniMaxAI/MiniMax-M3.1-Flash` stores NVFP4
experts and does not run on NPU; both Ascend builds need
`--quantization ascend`. No model revision is pinned, matching the tutorial.

The two images are model-specific builds. Each Docker command starts the
container with `--network host --shm-size=100g`; the 950DT
container also needs `--ipc host`. The recipe sets the shared-memory size for
you.

| Lane | Preset |
| --- | --- |
| A3, 128K context, DP4 x TP4 / EP16, one host | `ascend_a3_w8a8_agg` |
| 950DT, 128K context, DP2 x TP4 / EP8, one host | `ascend_a5_w8a8_mxfp8_agg` |
| A3, 1P1D, prefill DP1 x TP4 x PP4 + decode DP8 x TP4 over two hosts | `ascend_a3_w8a8_pd` |
| 950DT, 1P1D, prefill DP1 x TP4 x PP2 + decode DP4 x TP4 over two hosts | `ascend_a5_w8a8_mxfp8_pd` |

Each PD preset is the default for the `pd_cluster` strategy on its hardware;
it needs three hosts and the Ascend Router. The single-node presets remain
the defaults for the single-node strategy.

**Placeholders in the generated commands.** The PD lanes carry six shell
variables; substitute them before launch:

- `$PREFILL_NODE_1` — the prefill host's address on the interface the decode
  hosts and the router can reach.
- `$DECODE_NODE_1` — the first decode host, and the address of the global DP
  group: both decode hosts pass it as `--data-parallel-address`, and the
  rank-0 child API server on D1 binds the DP coordination endpoint there.
  The supervisor process itself only serves the aggregated `/health`.
- `$DECODE_NODE_2` — the second decode host's own address, used for its
  `HCCL_IF_IP` and `VLLM_HOST_IP`. It is not the DP address: every decode
  host keeps `--data-parallel-address $DECODE_NODE_1`.
- `$DECODE_DP_RPC_PORT` — a free TCP port for the DP rendezvous, reachable
  from both decode hosts and not bound by any other pool (for example 16920
  on A3 and 6885 on 950DT, the values the tutorial uses).
- `$ROUTER_PORT` — the Ascend Router's listening port; the command builder
  supplies a default, and the tutorial's proxy uses 19080. Make sure it is
  free on the host that runs the router.
- `$IFACE_NAME` — the business NIC on that host, for `HCCL_SOCKET_IFNAME` and
  `GLOO_SOCKET_IFNAME`. The recipe leaves `HCCL_IF_IP`, `VLLM_HOST_IP`, and
  the socket variables explicit on every PD role because a multi-homed host
  needs them to agree; the single-node presets do not set them.

Every other port is literal: prefill HTTP 8001, decode `--port` 8002, KV
transfer 36000 (prefill) and 36100 (decode).

**Prefill.** One `vllm serve` process per role, TP4 with PP4 (A3) or PP2
(950DT) and expert parallelism across the node, `--language-model-only`,
eager main model, and a DSpark draft on both pools. The A3 role exports
`VLLM_PP_LAYER_PARTITION=15,15,15,15` (the model has 60 layers, so this is
also the even split) and `ASCEND_LOCAL_COMM_RES`; unset the partition
variable before starting any other lane on the same shell. Before launch,
run `unset HCCL_INTRA_ROCE_ENABLE` on the A3 PD hosts: the tutorial requires
it and it cannot be expressed as a recipe environment variable.

**A3 `ASCEND_LOCAL_COMM_RES`.** This variable selects the HIXL local
communication resource for the HCCS fabric and must be the JSON string
`{"version":"1.2"}`. The recipe renderer currently emits environment values
without shell quotes, so the copied A3 PD command passes `{version:1.2}`
and HIXL cannot parse it. Until the renderer is fixed, quote it by hand: in
the bare command, export `ASCEND_LOCAL_COMM_RES='{"version":"1.2"}'`; in
the Docker command, remove the generated `-e ASCEND_LOCAL_COMM_RES=...` and
pass `-e ASCEND_LOCAL_COMM_RES` after that export. The 950DT lanes do not
set this variable.

**Decode.** One `vllm serve` supervisor per decode host, not one process per
rank. Both PD presets use vLLM's multi-port external load balancer: the
supervisor starts one child API server per local DP rank, each child owning
TP4 worth of NPUs, and it assigns `--data-parallel-start-rank` 0 (A3 D1), 4
(A3 D2), 0 (950DT D1) and 2 (950DT D2). A3 therefore serves children on
8002-8005 per host and 950DT on 8002-8003; the supervisor publishes
aggregated `/health` on vLLM's default port 9256, and
`--data-parallel-supervisor-port` moves only that health port. Do not add
`--data-parallel-rank`, `--data-parallel-external-lb` or
`--data-parallel-hybrid-lb`: the supervisor assigns ranks to children and
rejects those flags. Both decode hosts serve HTTP, so do not make the second
one headless.

The decode graph capture sizes are not cosmetic: at 128 sequences and seven
draft tokens an A3 decode step holds 1024 tokens while that lane captures
512, and the 950DT lane captures 1024. With 64 sequences the default limit
is enough, which is why the 16K-input variant of the tutorial drops
`max_cudagraph_capture_size` instead of raising it.

**KV transfer.** Both pools use `MooncakeConnectorV2` (the catalog default
for `mooncake_ascend`) instead of the tutorial's `MooncakeConnectorV1`
config. The `kv_port` is the base side-channel port and the connector
derives the per-rank ports from the device index, so the tutorial's
`25000 + rank * 32` arithmetic is not needed. Keep
`kv_connector_extra_config` in sync with the tp/pp/dp flags if you change
the topology: the recipe fills the pool shapes from the rendered roles. A
tp or dp mismatch fails fast at startup with a `ValueError`; `pp` is not
part of that check, so a pp mismatch can surface later as a KV handshake
failure.

**Startup order.** Start prefill, D1 and D2 within a few seconds of each
other - a role started later blocks the distributed rendezvous, and the
roles started earlier fail when their ready timeout expires. On 950DT the
presets raise `VLLM_ENGINE_READY_TIMEOUT_S` to 1800 for the weight load and
multi-host rendezvous. Start the Ascend Router only after every host prints
`Application startup complete`, and point it at the prefill child (8001) and
at every decode child (8002-8005 or 8002-8003 on both decode hosts); a
single decode endpoint per host leaves the other local ranks idle.

**Features.** DSpark speculative decoding (seven tokens, eager draft, BF16
draft KV) is on in every lane. Tool calling is on for the A3 single-node and
950DT PD lanes and off for the A3 PD and 950DT single-node lanes, exactly as
in the tutorial; the MiniMax reasoning parser is on everywhere. Both PD
lanes load text only (`--language-model-only`). The A3 PD preset also passes
`--hf-overrides` with the sparse architecture its scripts use; the 950DT PD
scripts do not pass it, so that preset does not either.

**Not covered here.** The A2 two-node colocated layout (section 5.2), the KV
cache pool with `MultiConnector` (section 5.4), the 1M-token PD layout
(section 5.5) and the 16K-input decode variant (64 sequences, default graph
capture) stay in the tutorial. The per-rank `vllm serve` scripts of section
5.3 are replaced by the supervisor; the Python load-balance proxy is now
launched as the catalog's Ascend Router, which runs the same
`load_balance_proxy_server_example.py` from the image.
