Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -13,9 +13,9 @@ library_name: hipfire
|
|
| 13 |
|
| 14 |
[hipfire](https://github.com/Kaden-Schutt/hipfire)-native quantizations of
|
| 15 |
[MiniMax-M2.7](https://huggingface.co/MiniMaxAI/MiniMax-M2.7) — a 229B-parameter
|
| 16 |
-
(≈10B active)
|
| 17 |
-
|
| 18 |
-
|
| 19 |
|
| 20 |
These `.mq*` files run with the hipfire inference engine (HIP/ROCm-direct, no
|
| 21 |
Python in the hot path). They are **not** GGUF/safetensors and won't load in
|
|
@@ -25,44 +25,58 @@ llama.cpp / transformers.
|
|
| 25 |
|
| 26 |
| File | Expert format | Size | Target |
|
| 27 |
|------|---------------|------|--------|
|
| 28 |
-
| `MiniMax-M2.7.mq4` | MQ4G256 (4-bit FWHT) experts, Q8 attn/router/head | 123.6 GB |
|
| 29 |
-
| `MiniMax-M2.7.
|
| 30 |
|
| 31 |
## Validation
|
| 32 |
|
| 33 |
The hipfire MiniMax-M2 forward pass was validated against a PyTorch
|
| 34 |
-
(`transformers`) reference on a dimension-faithful tiny
|
| 35 |
-
(per-layer post-residual hidden
|
| 36 |
|
| 37 |
-
- **mq4
|
| 38 |
-
- **
|
|
|
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
on a single MI300X.
|
| 47 |
|
| 48 |
## Quantization
|
| 49 |
|
| 50 |
Source: the official FP8 (E4M3 + F32 block-[128,128] `weight_scale_inv`)
|
| 51 |
checkpoint, dequantized to F32 then re-quantized. Attention projections, router,
|
| 52 |
-
embedding, and lm_head are kept at Q8; routed experts are MQ4G256 (mq4) or
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
## Usage (hipfire)
|
| 56 |
|
| 57 |
```
|
| 58 |
-
hipfire serve --model MiniMax-M2.7.
|
| 59 |
# or a single forward:
|
| 60 |
-
# examples/infer_minimax --model MiniMax-M2.7.
|
| 61 |
```
|
| 62 |
|
| 63 |
## Notes
|
| 64 |
|
| 65 |
-
- MQ3 / MQ2 / MQ3-Lloyd expert variants are not yet published: hipfire does not
|
| 66 |
-
currently ship indexed-decode MoE GEMV kernels for those formats (only
|
| 67 |
-
MQ4G256, MQ6G256, and MQ2G256-Lloyd have complete decode+prefill MoE kernels).
|
| 68 |
- arch_id 10 in the hipfire HFQ header.
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
[hipfire](https://github.com/Kaden-Schutt/hipfire)-native quantizations of
|
| 15 |
[MiniMax-M2.7](https://huggingface.co/MiniMaxAI/MiniMax-M2.7) — a 229B-parameter
|
| 16 |
+
(≈10B active) MoE: GQA attention with per-layer QK-norm, partial rotate_half
|
| 17 |
+
RoPE, and a 256-expert top-8 sigmoid+bias router (DeepSeek-V3-style), SwiGLU
|
| 18 |
+
experts, **no shared expert**. 62 layers, hidden 3072, vocab 200064.
|
| 19 |
|
| 20 |
These `.mq*` files run with the hipfire inference engine (HIP/ROCm-direct, no
|
| 21 |
Python in the hot path). They are **not** GGUF/safetensors and won't load in
|
|
|
|
| 25 |
|
| 26 |
| File | Expert format | Size | Target |
|
| 27 |
|------|---------------|------|--------|
|
| 28 |
+
| `MiniMax-M2.7.mq4` | MQ4G256 (4-bit FWHT) experts, Q8 attn/router/head | 123.6 GB | best quality |
|
| 29 |
+
| `MiniMax-M2.7.mq3-lloyd` | MQ3G256-Lloyd (3-bit + 8-entry codebook) experts + gate-up AWQ, Q8 attn/router/head | 102.6 GB | **fits 128 GB unified (e.g. Strix Halo / gfx1151)** |
|
| 30 |
|
| 31 |
## Validation
|
| 32 |
|
| 33 |
The hipfire MiniMax-M2 forward pass was validated against a PyTorch
|
| 34 |
+
(`transformers` built-in `MiniMaxM2`) reference on a dimension-faithful tiny
|
| 35 |
+
random-weight oracle (per-layer post-residual hidden-state cosine):
|
| 36 |
|
| 37 |
+
- **mq4** experts: **0.9996** vs reference
|
| 38 |
+
- **mq3-lloyd** experts: **0.9994**
|
| 39 |
+
- attention isolated **0.99990**; routing (sigmoid + bias top-8) matches exactly.
|
| 40 |
|
| 41 |
+
Real 229B generation is coherent on both files (greedy): e.g. *"Explain why the
|
| 42 |
+
sky is blue"* → "shorter blue wavelengths of sunlight scatter more than other
|
| 43 |
+
colors … this scattered light reaches our eyes from every part of the sky";
|
| 44 |
+
*"factorial of n"* → correct Python with a docstring. (Greedy decode can show
|
| 45 |
+
mild repetition on open-ended prompts; use light sampling / a repeat penalty and
|
| 46 |
+
the chat template for production.)
|
|
|
|
| 47 |
|
| 48 |
## Quantization
|
| 49 |
|
| 50 |
Source: the official FP8 (E4M3 + F32 block-[128,128] `weight_scale_inv`)
|
| 51 |
checkpoint, dequantized to F32 then re-quantized. Attention projections, router,
|
| 52 |
+
embedding, and lm_head are kept at **Q8**; routed experts are MQ4G256 (mq4) or
|
| 53 |
+
MQ3G256-Lloyd (mq3-lloyd). The mq3-lloyd build bakes in **gate/up AWQ** (shared
|
| 54 |
+
per-layer activation scale from an unsloth imatrix; the math `W·s @ x/s = W·x`
|
| 55 |
+
is exact, redistributing quant difficulty toward the salient input channels).
|
| 56 |
+
|
| 57 |
+
## Why only two formats
|
| 58 |
+
|
| 59 |
+
MiniMax-M2 has **no shared expert**, so there is no higher-precision path to
|
| 60 |
+
buffer routed-expert quantization error. Empirically:
|
| 61 |
+
|
| 62 |
+
- **2-bit experts (mq2 / mq2-lloyd) are not shippable** — they stay grammatical
|
| 63 |
+
but collapse into repetition loops on instruction prompts (per-block 2-bit MoE
|
| 64 |
+
error reaches ~80–100% of the block's signal). AWQ alone does not rescue them.
|
| 65 |
+
- **MQ3-Lloyd (3-bit) is the floor for coherent MiniMax** — 3-bit cuts the
|
| 66 |
+
per-block error to ~40–50% and recovers near-mq4 fluency, at 102.6 GB.
|
| 67 |
+
- Plain (non-Lloyd) `mq3` / `mq2` are omitted because hipfire ships indexed-decode
|
| 68 |
+
MoE GEMV kernels only for MQ4G256, MQ6G256, MQ2G256-Lloyd, and MQ3G256-Lloyd.
|
| 69 |
|
| 70 |
## Usage (hipfire)
|
| 71 |
|
| 72 |
```
|
| 73 |
+
hipfire serve --model MiniMax-M2.7.mq3-lloyd
|
| 74 |
# or a single forward:
|
| 75 |
+
# examples/infer_minimax --model MiniMax-M2.7.mq3-lloyd --prompt "..."
|
| 76 |
```
|
| 77 |
|
| 78 |
## Notes
|
| 79 |
|
|
|
|
|
|
|
|
|
|
| 80 |
- arch_id 10 in the hipfire HFQ header.
|
| 81 |
+
- The MQ3G256-Lloyd indexed-decode MoE GEMV kernel was added in hipfire for this
|
| 82 |
+
model (first 3-bit-Lloyd MoE decode kernel in the engine).
|