Skip to content

model: add MiniMax-M3.1 - #31192

Open
danielhanchen wants to merge 1 commit into
ggml-org:masterfrom
danielhanchen:minimax-m31-upstream
Open

danielhanchen wants to merge 1 commit into
ggml-org:masterfrom
danielhanchen:minimax-m31-upstream

Conversation

@danielhanchen

Copy link
Copy Markdown
Contributor

Adds MiniMax-M3.1-Flash: https://huggingface.co/MiniMaxAI/MiniMax-M3.1-Flash

  • Older MiniMax models are not affected (this branch vs master, CPU, same inputs):
    • MiniMax-M3: the converter writes byte-identical GGUFs (f32 and bf16) on the real MiniMax-M3 config, logits are bitwise identical at 64, 600 and 3000 tokens (top-k block selection active at 3000) for batched and one-token decode, and the same layers run MSA (the dense-lead layers stay dense)
    • MiniMax-M2 / M2.5: byte-identical GGUFs and bitwise-identical logits; the only difference is tokenization of decomposed (non-NFC) text, which now matches HF
  • Converter for the mixed MXFP8 + NVFP4 checkpoint: routed experts stay native NVFP4 with a per-expert 1/global_scale tensor (or are dequantized exactly to BF16 / F16 / F32 / Q8_0 with --outtype, --fp8-as-q8 for Q8_0 dense weights); MXFP8 tensors decode exactly
  • Sparse attention (MSA) on every layer, including the dense-lead layers: a layer runs MSA iff it carries indexer tensors, so MiniMax-M3 GGUFs behave exactly as before
  • MSA batch path chunked over tokens so no intermediate reaches 2^31 elements (large prompts with a large -ub)
  • BPE tokenizer applies tokenizer.ggml.normalizer.nfc like the Unigram one already does (M3.1 declares an NFC normalizer); GGUFs without the key are unaffected (same change as unicode : extending opt-in NFC support beyond UGM #30708)
  • DSpark speculative drafter: DSparkMiniMaxDraftModel converter, swigluoai in dflash.cpp and per-layer target taps
  • Fix: the Gemma 1 + w norm add runs in F32, so F16 sources no longer lose the low bits of w

Tested against transformers in float64 with exact dequantization, on fixtures with the real tokenizer and storage formats: mean KL 5.8e-7 (BF16 source) and 5.6e-7 (NVFP4 + MXFP8), top-1 100%; the MiniMax-M3 layout gives 1.8e-6. The tokenizer matches HF on 3,221 documents and 605 rendered chats. On the real weights, the native NVFP4 GGUF agrees with a reference GPU implementation on 95.5% to 99.1% of top-1 tokens over its own greedy continuations (chat, math, code), and greedy decoding with the DSpark drafter is identical to plain greedy. GGUFs: https://huggingface.co/unsloth/MiniMax-M3.1-Flash-GGUF

Run with llama-server -m MiniMax-M3.1-Flash.gguf --jinja -fa on -np 1 (sparse attention needs one slot or --no-kv-unified); for DSpark add --spec-type draft-dspark -md MiniMax-M3.1-Flash-DSpark-BF16.gguf --spec-draft-p-min 0.

AI Usage

Used Claude and Local Models for testing, iteration and code design - manual verification of model / PR usage

- Converter for the mixed MXFP8 + NVFP4 checkpoint: routed experts stay native
  NVFP4 with a per-expert 1/global_scale tensor, or are dequantized exactly;
  MXFP8 tensors decode exactly
- Sparse attention (MSA) on every layer including the dense-lead layers: a
  layer runs MSA iff it carries indexer tensors, so MiniMax-M3 GGUFs behave as
  before
- MSA batch path chunked so no intermediate reaches 2^31 elements
- BPE tokenizer applies tokenizer.ggml.normalizer.nfc like the Unigram one
- DSpark drafter: DSparkMiniMaxDraftModel converter, swigluoai in dflash and
  per-layer target taps
- Gemma 1 + w norm add runs in F32
@danielhanchen
danielhanchen requested a review from CISC as a code owner October 26, 2026 12:21
@github-actions github-actions Bot added model Model specific conversion labels Oct 26, 2026
@CISC

CISC commented Oct 26, 2026

Copy link
Copy Markdown
Member

Please drop the dequant.

I understand it may be useful when there's no BF16 model, however it does not belong to model-specific conversion, please follow up with a generic conversion option instead (though this is low priority).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conversion model Model specific

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants