Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -19,64 +19,63 @@ 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
|
| 22 |
-
llama.cpp / transformers.
|
|
|
|
| 23 |
|
| 24 |
## Files
|
| 25 |
|
| 26 |
-
| File |
|
| 27 |
-
|------|---------------|------|--------|
|
| 28 |
-
| `MiniMax-M2.7.mq4` |
|
| 29 |
-
| `MiniMax-M2.7.mq3-lloyd` |
|
|
|
|
| 30 |
|
| 31 |
-
|
| 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 |
-
|
| 38 |
-
- **mq3-lloyd** experts: **0.9994**
|
| 39 |
-
- attention isolated **0.99990**; routing (sigmoid + bias top-8) matches exactly.
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
the
|
|
|
|
|
|
|
| 47 |
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
-
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
-
|
| 60 |
-
buffer routed-expert quantization error. Empirically:
|
| 61 |
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 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.
|
| 74 |
# or a single forward:
|
| 75 |
-
# examples/infer_minimax --model MiniMax-M2.7.
|
| 76 |
```
|
| 77 |
|
| 78 |
-
|
| 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).
|
|
|
|
| 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
|
| 22 |
+
llama.cpp / transformers. Attention, router, embedding, and lm_head are kept at
|
| 23 |
+
**Q8** throughout; only the routed-expert precision varies below.
|
| 24 |
|
| 25 |
## Files
|
| 26 |
|
| 27 |
+
| File | Routed experts (gate/up · down) | Size | Target |
|
| 28 |
+
|------|----------------------------------|------|--------|
|
| 29 |
+
| `MiniMax-M2.7.mq4` | MQ4 · MQ4 | 123.6 GB | best quality |
|
| 30 |
+
| `MiniMax-M2.7.mq3-lloyd` | MQ3-Lloyd · MQ3-Lloyd | 102.6 GB | high quality |
|
| 31 |
+
| `MiniMax-M2.7.mq2-lloyd` | MQ2-Lloyd+AWQ · **MQ4** | 86.2 GB | **smallest coherent — fits 128 GB unified (Strix Halo / gfx1151)** |
|
| 32 |
|
| 33 |
+
(More tiers may be added as the precision sweep completes.)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
+
## The down-projection is the precision-critical component
|
|
|
|
|
|
|
| 36 |
|
| 37 |
+
MiniMax-M2 has **no shared expert**, so routed-expert quantization error has no
|
| 38 |
+
high-precision path to hide behind. Pushing experts to a uniform 2-bit makes the
|
| 39 |
+
model collapse into repetition loops on instruction prompts. The cause is
|
| 40 |
+
specific and measurable: the **down projection's** input (the SwiGLU
|
| 41 |
+
intermediate) carries **~588× the activation energy** of the gate/up input, so a
|
| 42 |
+
2-bit error in `w2` is amplified ~24× more at the block output than the same
|
| 43 |
+
error in `w1/w3`. It behaves like the precision-critical conv1d in other
|
| 44 |
+
architectures — it doesn't degrade gracefully, it derails generation.
|
| 45 |
|
| 46 |
+
The fix in `mq2-lloyd` here: keep gate/up at 2-bit (MQ2-Lloyd + gate/up AWQ) but
|
| 47 |
+
promote **only the down projection to MQ4**. That restores coherence (correct
|
| 48 |
+
factual answers, working code, no loops) at 86 GB — smaller than the uniform
|
| 49 |
+
3-bit build. Per-expert promotion does **not** work: MiniMax's router is
|
| 50 |
+
load-balanced (no dominant experts to anchor), so the lever is the projection,
|
| 51 |
+
not the expert.
|
| 52 |
|
| 53 |
+
## Validation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
+
Forward pass validated against a PyTorch (`transformers` `MiniMaxM2`) reference
|
| 56 |
+
on a dimension-faithful tiny random-weight oracle (per-layer hidden-state cosine):
|
| 57 |
+
mq4 **0.9996**, mq3-lloyd **0.9994**; attention isolated **0.99990**; routing
|
| 58 |
+
(sigmoid + bias top-8) exact. Real 229B generation is coherent on all three files
|
| 59 |
+
(greedy): *"why is the sky blue"* → correct Rayleigh-scattering answer;
|
| 60 |
+
*"factorial of n"* → correct Python. (Greedy decode can show mild repetition on
|
| 61 |
+
open-ended prompts; use light sampling + a repeat penalty + the chat template for
|
| 62 |
+
production.)
|
| 63 |
|
| 64 |
+
## Quantization
|
|
|
|
| 65 |
|
| 66 |
+
Source: the official FP8 (E4M3 + F32 block-[128,128] `weight_scale_inv`)
|
| 67 |
+
checkpoint, dequantized to F32 then re-quantized. gate/up AWQ uses a shared
|
| 68 |
+
per-layer activation scale from an unsloth imatrix (math `W·s @ x/s = W·x` is
|
| 69 |
+
exact; redistributes quant difficulty to the salient input channels). The
|
| 70 |
+
MQ3-Lloyd indexed-decode MoE GEMV kernel and the per-projection mixed-dtype
|
| 71 |
+
dispatch were added to hipfire for this model.
|
|
|
|
| 72 |
|
| 73 |
## Usage (hipfire)
|
| 74 |
|
| 75 |
```
|
| 76 |
+
hipfire serve --model MiniMax-M2.7.mq2-lloyd
|
| 77 |
# or a single forward:
|
| 78 |
+
# examples/infer_minimax --model MiniMax-M2.7.mq2-lloyd --prompt "..."
|
| 79 |
```
|
| 80 |
|
| 81 |
+
arch_id 10 in the hipfire HFQ header.
|
|
|
|
|
|
|
|
|
|
|
|