Skip to content

MiniMax M3.1 ​

Serve MiniMaxAI/MiniMax-M3.1-Flash with TokenSpeed and its bundled DSpark draft for speculative decoding.

Prerequisites ​

Before you start, complete the following preparations:

  • Prepare four Blackwell GPUs for this example's --tensor-parallel-size 4 configuration.
  • Install TokenSpeed, the hf command, and curl. For TokenSpeed installation instructions, see Getting started.
  • Obtain access to the MiniMaxAI/MiniMax-M3.1-Flash checkpoint on Hugging Face.
  • Make TCP port 8000 available on the server host.
  • Review and trust the checkpoint's remote code. The server command passes --trust-remote-code.

For checkpoints that declare quant_method: mxfp8 with moe_quant_algo: NVFP4, TokenSpeed automatically selects mxfp8_nvfp4. Projections use MXFP8, and routed experts use NVFP4. This quantization requires Blackwell.

Start the server ​

  1. Download the target checkpoint and its bundled DSpark draft. This command stores the local checkpoint path in model_dir for the next step:

    bash
    model_dir=$(hf download MiniMaxAI/MiniMax-M3.1-Flash --quiet)

    The draft is in the dspark/ subdirectory and declares DSparkMiniMaxDraftModel.

  2. Start TokenSpeed with the target checkpoint and DSpark draft. This example uses seven draft steps and an eight-token verify window. If your DSpark checkpoint has a different block_size, adjust 7 and 8 as described in Configure DSpark widths:

    bash
    tokenspeed serve "$model_dir" \
        --tensor-parallel-size 4 \
        --max-model-len 1048576 \
        --gpu-memory-utilization 0.95 \
        --attention-backend trtllm \
        --kv-cache-dtype fp8 \
        --moe-backend flashinfer_trtllm \
        --speculative-algorithm DSPARK \
        --speculative-draft-model-path "$model_dir/dspark" \
        --speculative-num-steps 7 \
        --speculative-eagle-topk 1 \
        --speculative-num-draft-tokens 8 \
        --trust-remote-code \
        --host 0.0.0.0 \
        --port 8000
  3. From another terminal on the server host, query the readiness endpoint:

    bash
    curl --fail --silent --show-error \
      --output /dev/null --write-out '%{http_code}\n' \
      http://127.0.0.1:8000/readiness

    The command prints 200 when TokenSpeed is ready to accept requests.

Configure DSpark widths ​

Set --speculative-num-steps to the DSpark checkpoint's block_size, and set --speculative-num-draft-tokens to block_size + 1. For more information about the width conventions, see Speculative decoding.

Optional: Serve the target without DSpark ​

To serve the target alone, remove the --speculative-* options from the launch command.

TokenSpeed documentation