schuttdev commited on
Commit
1cfc7db
·
verified ·
1 Parent(s): b96379f

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +42 -43
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 | 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).
 
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.