Instructions to use MiniMaxAI/MiniMax-M3.1-Flash with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MiniMaxAI/MiniMax-M3.1-Flash with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="MiniMaxAI/MiniMax-M3.1-Flash", 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("MiniMaxAI/MiniMax-M3.1-Flash", trust_remote_code=True) model = AutoModelForMultimodalLM.from_pretrained("MiniMaxAI/MiniMax-M3.1-Flash", 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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use MiniMaxAI/MiniMax-M3.1-Flash with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MiniMaxAI/MiniMax-M3.1-Flash" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MiniMaxAI/MiniMax-M3.1-Flash", "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/MiniMaxAI/MiniMax-M3.1-Flash
- SGLang
How to use MiniMaxAI/MiniMax-M3.1-Flash 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 "MiniMaxAI/MiniMax-M3.1-Flash" \ --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": "MiniMaxAI/MiniMax-M3.1-Flash", "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 "MiniMaxAI/MiniMax-M3.1-Flash" \ --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": "MiniMaxAI/MiniMax-M3.1-Flash", "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 MiniMaxAI/MiniMax-M3.1-Flash with Docker Model Runner:
docker model run hf.co/MiniMaxAI/MiniMax-M3.1-Flash
MiniMax-M3.1-Flash, running locally in a C++/CUDA engine
We ported MiniMax's M3.1-Flash — a 428-billion-parameter mixture-of-experts
model with ~23 billion active parameters — into our own Blackwell inference
engine. It is the second member of the MiniMax family we run: M3.1 shares M3's
decoder geometry, so the work was to absorb what the new checkpoint changes,
not to write a new architecture.
Two changes matter for an inference engine. First, MiniMax Sparse Attention now
runs on every layer (M3 kept the first three layers dense), so the
Lightning-Indexer block selection is always live; our kernel already handled it
and the switch is entirely data-driven. Second, the release is
quantization-aware-trained and shipped pre-quantized: the dense
projections are MXFP8 (FP8 payload with one shared exponent per 32 columns) and
the routed experts are already NVIDIA NVFP4. The converter dequantizes the
dense side once and re-quantizes it to our uniform NVFP4 format, and copies the
expert records through verbatim — the expert bytes on disk are the bytes the
kernel reads, with no requantization pass.
The 236 GB release becomes a 227 GB tree. On a single 32 GB RTX 5090 the dense
graph is pinned in 10.5 GiB and the routed-expert set streams from disk through
an LRU of device slots. The model answers the canonical fact check correctly
and deterministically ("The capital of France is Paris."), passes our three
structured-answer parity suites, and calls tools with the checkpoint's native
XML format.
What the checkpoint forced into the engine
- Sparse attention on all 60 layers. The indexer weights exist on layers
0-2 (they did not in M3), and its key history must be cached on those layers
too. The loader is now dispatch-driven and each model member cross-checks
the dispatch arrays against its own frozen passport, so an M3 tree and an
M3.1 tree cannot be loaded as each other. - RoPE theta 1e7 (M3: 5e6), including the indexer's RoPE. The same
passport check pins it. - A pre-quantized source. Dense projections arrive as FP8 with a
per-32-column power-of-two exponent; routed experts arrive as NVFP4 with a
per-16 FP8 block scale and a per-tensor divisor. The converter feeds the
dense pair to the engine's existing MXFP8-aware quantizer and inverts the
expert divisor to our multiply convention — the same rule we already used for
another vendor's NVFP4 release. - Fixed adaptive thinking. The new chat template removes the thinking-mode
switch: the model decides for itself whether to reason, and the generation
prompt no longer carries the "answer directly" marker. In practice the model
opens a short<mm:think>block and then answers; a parity probe that only
looks at the first handful of tokens would miss the answer, so the check
window is adapted. - A new system prompt and role mapping. The default system message names
the model version and appends an opaque<model_id>line, mid-conversation
system turns render asdeveloper, and consecutive tool results share one
message block. All three are reproduced by a per-checkpoint render policy, so
the M3 template remains untouched. - Same vocabulary. The tokenizer files are byte-identical to M3's, so the
already-verified pre-tokenizer policy transfers unchanged.