The model was quantized from
MiniMaxAI/MiniMax-M3 using
AMD-Quark. The weights are quantized to MXFP4 and activations are quantized to MXFP4.
1from quark.torch import LLMTemplate, ModelQuantizer
2
3# --- Register template ---
4minimax_m3_vl_template = LLMTemplate(
5 model_type="minimax_m3_vl",
6 kv_layers_name=["*language_model.*k_proj", "*language_model.*v_proj"],
7 q_layer_name="*language_model.*q_proj",
8 exclude_layers_name=[
9 "*lm_head",
10 "*vision_tower*",
11 "*multi_modal_projector*",
12 "*patch_merge_mlp*",
13 "*block_sparse_moe.gate",
14 "*self_attn*",
15 ],
16)
17LLMTemplate.register_template(minimax_m3_vl_template)
18print(f"[INFO]: Registered template '{minimax_m3_vl_template.model_type}'")
19
20# --- Configuration ---
21model_dir = "MiniMaxAI/MiniMax-M3"
22output_dir = "amd/MiniMax-M3-MXFP4"
23quant_scheme = "mxfp4"
24exclude_layers = [
25 "*lm_head",
26 "*vision_tower*",
27 "*multi_modal_projector*",
28 "*patch_merge_mlp*",
29 "*block_sparse_moe.gate",
30 "*self_attn*",
31 "*mlp.gate_proj",
32 "*mlp.up_proj",
33 "*mlp.down_proj",
34]
35
36# --- Build quant config from template ---
37template = LLMTemplate.get("minimax_m3_vl")
38quant_config = template.get_config(scheme=quant_scheme, exclude_layers=exclude_layers)
39
40# --- File-to-file quantization (memory-efficient, no full model loading) ---
41quantizer = ModelQuantizer(quant_config)
42quantizer.direct_quantize_checkpoint(
43 pretrained_model_path=model_dir,
44 save_path=output_dir,
45)
46print(f"[INFO]: Quantization complete. Output saved to {output_dir}")
The model was evaluated on gsm8k benchmarks using the vllm framework.
The GSM8K results were obtained using the lm-eval framework, based on the
Docker image
rocm/pytorch-private:vllm-hy-mm-06112026. The vLLM shipped in
that image was used as-is, with the patch from this PR (
#45794) applied on top.
1pip install transformers==5.12.0
2pip install "lm-eval[api]"
1vllm serve /mnt/amd/MiniMax-M3-MXFP4 \
2 --trust-remote-code \
3 --block-size 128 \
4 --tensor-parallel-size 8 \
5 --attention-backend TRITON_ATTN \
6 --mm-encoder-tp-mode data \
7 --mm-encoder-attn-backend ROCM_AITER_FA \
8 --tool-call-parser minimax_m3 \
9 --enable-auto-tool-choice \
10 --reasoning-parser minimax_m3 \
11 --moe-backend emulation
1lm_eval \
2 --model local-chat-completions \
3 --model_args "model=/mnt/amd/MiniMax-M3-MXFP4,base_url=http://127.0.0.1:8000/v1/chat/completions,num_concurrent=32,max_gen_toks=16384" \
4 --tasks gsm8k \
5 --num_fewshot 5 \
6 --batch_size 1 \
7 --apply_chat_template \
8 --fewshot_as_multiturn