Text Generation
Transformers
Safetensors
llama
eagle3
speculative-decoding
draft-model
gqa
vllm
nvfp4
quantized
text-generation-inference
modelopt
Instructions to use Inferact/MiniMax-M3-EAGLE3-GQA-NVFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Inferact/MiniMax-M3-EAGLE3-GQA-NVFP4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Inferact/MiniMax-M3-EAGLE3-GQA-NVFP4")# Load model directly from transformers import AutoTokenizer, LlamaForCausalLMEagle3 tokenizer = AutoTokenizer.from_pretrained("Inferact/MiniMax-M3-EAGLE3-GQA-NVFP4") model = LlamaForCausalLMEagle3.from_pretrained("Inferact/MiniMax-M3-EAGLE3-GQA-NVFP4", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Inferact/MiniMax-M3-EAGLE3-GQA-NVFP4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Inferact/MiniMax-M3-EAGLE3-GQA-NVFP4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Inferact/MiniMax-M3-EAGLE3-GQA-NVFP4", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Inferact/MiniMax-M3-EAGLE3-GQA-NVFP4
- SGLang
How to use Inferact/MiniMax-M3-EAGLE3-GQA-NVFP4 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 "Inferact/MiniMax-M3-EAGLE3-GQA-NVFP4" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Inferact/MiniMax-M3-EAGLE3-GQA-NVFP4", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "Inferact/MiniMax-M3-EAGLE3-GQA-NVFP4" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Inferact/MiniMax-M3-EAGLE3-GQA-NVFP4", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Inferact/MiniMax-M3-EAGLE3-GQA-NVFP4 with Docker Model Runner:
docker model run hf.co/Inferact/MiniMax-M3-EAGLE3-GQA-NVFP4
Simplify model card
Browse files
README.md
CHANGED
|
@@ -9,71 +9,10 @@ tags:
|
|
| 9 |
- draft-model
|
| 10 |
- gqa
|
| 11 |
- vllm
|
| 12 |
-
- torchspec
|
| 13 |
-
- minimax
|
| 14 |
- nvfp4
|
| 15 |
- quantized
|
| 16 |
---
|
| 17 |
|
| 18 |
-
# MiniMax-M3-EAGLE3-GQA-NVFP4
|
| 19 |
|
| 20 |
-
|
| 21 |
-
the 1-layer **grouped-query-attention (GQA)** EAGLE3 speculative-decoding draft for
|
| 22 |
-
[`MiniMaxAI/MiniMax-M3`](https://huggingface.co/MiniMaxAI/MiniMax-M3), served with
|
| 23 |
-
**[vLLM](https://github.com/vllm-project/vllm)** and trained with **[TorchSpec](https://github.com/lightseekorg/TorchSpec)**.
|
| 24 |
-
|
| 25 |
-
Only the draft's **MLP** (`layers.0.mlp.{gate,up,down}_proj`, `intermediate_size=18432`) is quantized —
|
| 26 |
-
**both weights and activations to FP4** (NVFP4, group size 16). Everything else (`embed_tokens`,
|
| 27 |
-
`lm_head`, `fc`, `self_attn`, all norms) stays bf16. Produced with NVIDIA TensorRT Model Optimizer
|
| 28 |
-
(`quant_method: modelopt`, `quant_algo: NVFP4`); W4A4 engages the Blackwell FP4 tensor cores.
|
| 29 |
-
|
| 30 |
-
The base draft is a 1-layer dense Llama (`LlamaForCausalLMEagle3`) on MiniMax-M3's `hidden_size=6144` /
|
| 31 |
-
`vocab_size=200064`; at serve time it shares the target's embedding and LM head (EAGLE3). See the
|
| 32 |
-
[base model card](https://huggingface.co/Inferact/MiniMax-M3-EAGLE3-GQA) for training data and bf16
|
| 33 |
-
acceptance numbers, and `config.json` here for the full architecture.
|
| 34 |
-
|
| 35 |
-
## Why MLP-only
|
| 36 |
-
|
| 37 |
-
Profiling the draft's decode path shows the MLP is the bulk of the draft's *compressible* compute; the
|
| 38 |
-
`lm_head` (full 200k vocab) and `self_attn` are the larger remaining bf16 ops. Quantizing the MLP
|
| 39 |
-
weights+activations to FP4 cuts its weight bandwidth ~4× and runs the GEMM on the FP4 tensor cores, while
|
| 40 |
-
keeping the output-distribution-sensitive `lm_head`/`fc`/attention in bf16 to preserve acceptance.
|
| 41 |
-
|
| 42 |
-
## Calibration
|
| 43 |
-
|
| 44 |
-
The activation `input_scale` for each MLP linear was calibrated by capturing `max|input|` on the **bf16**
|
| 45 |
-
draft while serving MiniMax-M3 (TP4 + EP, `num_speculative_tokens=3`, `--enforce-eager`) over a short
|
| 46 |
-
MT-Bench drive, aggregated by max across TP ranks. Calibration used the `MiniMaxAI/MiniMax-M3-MXFP8`
|
| 47 |
-
target (its hidden states are representative for capturing MLP-input amax). NVFP4 sets
|
| 48 |
-
`input_scale = amax / (fp4_max·fp8_e4m3_max) = amax / 2688`.
|
| 49 |
-
|
| 50 |
-
| MLP input | amax | input_scale |
|
| 51 |
-
|---|---|---|
|
| 52 |
-
| gate/up (post-attention-norm output) | 40.75 | 0.01515997 |
|
| 53 |
-
| down (SiLU(gate)·up) | 119.50 | 0.04445685 |
|
| 54 |
-
|
| 55 |
-
## Serving (vLLM)
|
| 56 |
-
|
| 57 |
-
```bash
|
| 58 |
-
vllm serve MiniMaxAI/MiniMax-M3 \
|
| 59 |
-
--speculative-config '{"method":"eagle3","model":"Inferact/MiniMax-M3-EAGLE3-GQA-NVFP4","num_speculative_tokens":3}'
|
| 60 |
-
```
|
| 61 |
-
|
| 62 |
-
> Serving a **quantized** EAGLE3 draft requires a vLLM whose eagle3 first layer constructs its `qkv_proj`
|
| 63 |
-
> under the real `self_attn.qkv_proj` module path, so the quant config's exclude-matching keeps the (bf16)
|
| 64 |
-
> attention out of quantization. Otherwise the excluded attention is wrongly quantized and the 2×hidden
|
| 65 |
-
> fused-QKV weight fails to load.
|
| 66 |
-
|
| 67 |
-
## Files
|
| 68 |
-
|
| 69 |
-
| File | Notes |
|
| 70 |
-
|---|---|
|
| 71 |
-
| `model.safetensors` | FP4-packed MLP (`weight` U8, `weight_scale` F8_E4M3 per-16-group, `weight_scale_2` F32, `input_scale` F32); bf16 elsewhere |
|
| 72 |
-
| `config.json` | Original EAGLE3 config + `quantization_config` (`quant_algo: NVFP4`, group 16) |
|
| 73 |
-
| `hf_quant_config.json` | ModelOpt quant metadata; `exclude_modules: [embed_tokens, fc, self_attn, lm_head]` |
|
| 74 |
-
|
| 75 |
-
## Status
|
| 76 |
-
|
| 77 |
-
Acceptance-rate and decode-latency evaluation vs the bf16 draft is **pending**. Prior W4A4 MLP
|
| 78 |
-
quantization of sibling MiniMax-M3 EAGLE3 GQA drafts was quality-neutral (acceptance / accuracy within
|
| 79 |
-
run-to-run noise), so no quality regression is expected.
|
|
|
|
| 9 |
- draft-model
|
| 10 |
- gqa
|
| 11 |
- vllm
|
|
|
|
|
|
|
| 12 |
- nvfp4
|
| 13 |
- quantized
|
| 14 |
---
|
| 15 |
|
| 16 |
+
# MiniMax-M3-EAGLE3-GQA-NVFP4
|
| 17 |
|
| 18 |
+
W4A4 NVFP4 MLP-quantized version of [`Inferact/MiniMax-M3-EAGLE3-GQA`](https://huggingface.co/Inferact/MiniMax-M3-EAGLE3-GQA).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|