Instructions to use Model-SafeTensors/MiniMax-M3-MoE-FP8-128x128 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Model-SafeTensors/MiniMax-M3-MoE-FP8-128x128 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Model-SafeTensors/MiniMax-M3-MoE-FP8-128x128", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("Model-SafeTensors/MiniMax-M3-MoE-FP8-128x128", trust_remote_code=True) model = AutoModelForMultimodalLM.from_pretrained("Model-SafeTensors/MiniMax-M3-MoE-FP8-128x128", trust_remote_code=True, device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Model-SafeTensors/MiniMax-M3-MoE-FP8-128x128 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Model-SafeTensors/MiniMax-M3-MoE-FP8-128x128" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Model-SafeTensors/MiniMax-M3-MoE-FP8-128x128", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/Model-SafeTensors/MiniMax-M3-MoE-FP8-128x128
- SGLang
How to use Model-SafeTensors/MiniMax-M3-MoE-FP8-128x128 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Model-SafeTensors/MiniMax-M3-MoE-FP8-128x128" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Model-SafeTensors/MiniMax-M3-MoE-FP8-128x128", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Model-SafeTensors/MiniMax-M3-MoE-FP8-128x128" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Model-SafeTensors/MiniMax-M3-MoE-FP8-128x128", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use Model-SafeTensors/MiniMax-M3-MoE-FP8-128x128 with Docker Model Runner:
docker model run hf.co/Model-SafeTensors/MiniMax-M3-MoE-FP8-128x128
MiniMax-M3 — MoE-only block-FP8 (128×128)
Block-FP8 quantization of MiniMaxAI/MiniMax-M3 applied only to the MoE expert weights. Everything else stays BF16.
- 408 GB vs 796 GiB for the BF16 original (~102 GB/GPU at TP4, vs 199 GB)
- Quantized directly from BF16 in a single rounding step
- Vision tower intact — still the full multimodal
MiniMaxM3SparseForConditionalGeneration
What is and isn't quantized
| Quantized (block-FP8 128×128) | Left in BF16 / FP32 |
|---|---|
routed experts w1 / w2 / w3 |
all attention, incl. index_q_proj / index_k_proj (sparse indexer) |
shared experts gate/up/down_proj |
router gate (FP32 — precision-critical for expert selection) |
| dense MLP layers 0–2 | |
vision tower, lm_head, embed_tokens |
Routed experts are ~96.6% of the parameters, so MoE-only quantization captures essentially all of the memory saving while leaving the accuracy-sensitive and long-context-critical paths untouched. Shared experts are included because they run for every token (unlike top-4-of-128 routed experts) and account for ~1/5 of MoE decode traffic.
22,059 tensors were quantized (21,888 routed = 57 layers × 128 experts × 3, plus 171 shared = 57 × 3).
Format
weight_scale_inv follows the DeepSeek-V3 block-FP8 contract — despite the name
it is a multiplier:
dequantized = fp8_weight * weight_scale_inv
Weights are float8_e4m3fn; scales are FP32 with shape
[ceil(N/128), ceil(K/128)]. Activations are quantized dynamically in 1×128
groups (per token, along K) — hence activation_scheme: dynamic, since
block-wise FP8 cannot use static activation scales.
Mean round-trip error vs the original BF16 is ~2.4%.
Usage (SGLang)
python -m sglang.launch_server \
--model-path Model-SafeTensors/MiniMax-M3-MoE-FP8-128x128 \
--trust-remote-code \
--tp-size 4 \
--moe-runner-backend triton \
--context-length 98304
Requires an SGLang build with MiniMax-M3 support (merged 2026-07-11).
⚠️ Known serving issues on AMD / ROCm
Both are properties of the serving stack, not of these weights. Both produce fluent-looking garbage with no error, so smoke-test before trusting output.
Do not use
--moe-runner-backend aiterwith MiniMax-M3. M3's MoE uses a clamped SwiGLU (gemm1_alpha=1.702,gemm1_clamp_limit=7.0):gate = gate.clamp(max=limit); up = up.clamp(-limit, limit) out = gate * sigmoid(gate * alpha) * (up + 1)aiter's
fused_moehas no alpha argument and itsActivationTypeoffers only{No, Gelu, Silu, Swiglu}, so the runner silently computes a plain SiLU. This affects BF16 too, not just FP8.SGLANG_USE_AITER=1together with--moe-runner-backend tritoncan corrupt output. On builds where the block-FP8 post-load path gates its aiter(16,16)weight pre-shuffle on theSGLANG_USE_AITERenv var rather than on the selected MoE runner, weights are shuffled for aiter and then consumed un-shuffled by triton. Workaround: setSGLANG_USE_AITER=0, or use a build whose plain-FP8 branch gates the shuffle on the runner (themxfp8 → block-fp8branch already does).
Why MoE-only, and why 128×128
- 128×128 blocks are the granularity that reaches the optimized block-FP8 kernels (DeepSeek-V3 style), rather than per-tensor or per-channel scaling.
- Single rounding. An MXFP8 checkpoint served on gfx942 (CDNA3, which has no MX matmul hardware) is converted to block-FP8 at load — a dequant→requant round trip that drops from 1×32 scales to 128×128, a 512× reduction in scale count, on top of already-quantized values. Quantizing straight from BF16 avoids that second rounding.
- BF16 attention keeps the sparse-attention indexer exact, which matters most at long context where attention dominates the decode step.
Provenance
Quantized from the official BF16 release using the DeepSeek-V3 block-FP8 formula
(amax/448 per 128×128 tile, clamp(min=1e-4)), verified bit-identical to
SGLang's own bf16_to_block_fp8_128 reference implementation.
Evaluation
Not formally evaluated. Validated by generation smoke tests and the ~2.4% weight round-trip error only — no GSM8K / MMLU / perplexity numbers were produced. Benchmark before production use.
License
Inherits the MiniMax Model License from the base model. See LICENSE.
- Downloads last month
- -
Model tree for Model-SafeTensors/MiniMax-M3-MoE-FP8-128x128
Base model
MiniMaxAI/MiniMax-M3