Tom Turney commited on
Commit
648505c
·
verified ·
1 Parent(s): 9b5afe9

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +146 -0
README.md ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: MiniMaxAI/MiniMax-M2.7
3
+ language:
4
+ - en
5
+ license: other
6
+ license_name: minimax-m2.7-non-commercial
7
+ license_link: https://huggingface.co/MiniMaxAI/MiniMax-M2.7/blob/main/LICENSE
8
+ pipeline_tag: text-generation
9
+ tags:
10
+ - mlx
11
+ - turboquant
12
+ - turboquant-plus
13
+ - config-i
14
+ - moe
15
+ - apple-silicon
16
+ quantized_by: pidtom
17
+ inference: false
18
+ ---
19
+
20
+ # MiniMax-M2.7 — TurboQuant+ Config-I (MLX)
21
+
22
+ **93.5% MMLU at 87 GB. 61 tok/s decode. PPL 4.604.** 228B-parameter MoE compressed 62% with Config-I mixed-precision quantization. Standard MLX format — works with stock `mlx_lm` and `mlx-swift-lm`. No custom loaders required.
23
+
24
+ Config-I quantization of [MiniMaxAI/MiniMax-M2.7](https://huggingface.co/MiniMaxAI/MiniMax-M2.7) (228.7B total, ~1.4B active per token). The policy applies aggressive 2-bit compression to expert MLPs (where MoE is most tolerant), protects attention at 4-bit, and shields boundary layers and routing at full precision. See the [Config-I paper](https://github.com/TheTom/turboquant_plus/blob/main/docs/papers/weight-compression-tq4.md) for the policy derivation.
25
+
26
+ ## Compression
27
+
28
+ | | Size |
29
+ |---|---|
30
+ | FP8 source | 230 GB |
31
+ | **Config-I (3.25 bpw)** | **87 GB** |
32
+ | **Reduction** | **62%** |
33
+
34
+ ## Quality
35
+
36
+ **Perplexity:** 4.604 ± 0.042 (wikitext, 50 samples, 2048 seq length)
37
+
38
+ **MMLU (200q, single-pass, reasoning ON):**
39
+
40
+ | Subject | Score |
41
+ |---|---|
42
+ | Abstract Algebra | 18/20 |
43
+ | Anatomy | 19/20 |
44
+ | Astronomy | 19/20 |
45
+ | College CS | 18/20 |
46
+ | College Physics | 19/20 |
47
+ | HS Biology | 20/20 |
48
+ | HS Chemistry | 17/20 |
49
+ | HS Math | 20/20 |
50
+ | Logical Fallacies | 19/20 |
51
+ | World Religions | 18/20 |
52
+ | **TOTAL** | **187/200 (93.5%)** |
53
+
54
+ Methodology: single-pass, 200 questions (10 MMLU subjects x 20), reasoning enabled, no retries, no few-shot, evaluated with `mlx_lm` on Apple M5 Max 128 GB.
55
+
56
+ ## Speed (Apple M5 Max 128 GB, mlx-swift-lm)
57
+
58
+ Speed benchmarks measured with [ekryski/mlx-swift-lm](https://github.com/ekryski/mlx-swift-lm) (`consolidated` branch), which provides ~2.5x faster decode than Python `mlx_lm`.
59
+
60
+ | Context | Prefill (t/s) | Decode (tok/s) |
61
+ |---------|---------------|----------------|
62
+ | 128 | 186 | 61.4 |
63
+ | 256 | 268 | 60.4 |
64
+ | 512 | 254 | 59.4 |
65
+ | 1024 | 292 | 57.7 |
66
+ | 2048 | 312 | 55.7 |
67
+ | 4096 | 318 | 52.0 |
68
+ | 8192 | 303 | 46.2 |
69
+ | 16384 | 271 | 38.7 |
70
+
71
+ ## TurboQuant KV Cache Compression (mlx-swift-lm)
72
+
73
+ KV cache compression via [ekryski/mlx-swift-lm](https://github.com/ekryski/mlx-swift-lm) (`consolidated` branch). Stacks on top of Config-I weight compression for additional memory savings at long context.
74
+
75
+ | | bf16 | turbo4 | turbo2 |
76
+ |---|---|---|---|
77
+ | Per token | 248 KB | 62 KB | 31 KB |
78
+ | Compression | 1x | 4x (75% saved) | 8x (88% saved) |
79
+ | 8K context | 1.94 GB | 0.48 GB | 0.24 GB |
80
+ | 16K context | 3.88 GB | 0.97 GB | 0.48 GB |
81
+ | 32K context | 7.75 GB | 1.94 GB | 0.97 GB |
82
+ | 64K context | 15.50 GB | 3.88 GB | 1.94 GB |
83
+ | 128K context | 31.00 GB | 7.75 GB | 3.88 GB |
84
+
85
+ **Max context on 128 GB M5 Max** (87 GB model, ~36 GB free):
86
+ - bf16 KV: **149K tokens**
87
+ - turbo4 KV: **595K tokens** (4x more context)
88
+ - turbo2 KV: **1.2M tokens** (8x more context)
89
+
90
+ PPL and NIAH results for KV compression coming soon.
91
+
92
+ ## Config-I Policy (MiniMax M2.7 Adaptation)
93
+
94
+ | Component | Bits | Layers | Rationale |
95
+ |-----------|------|--------|-----------|
96
+ | Expert MLP gate/up | **2-bit** | middle 58 | 98%+ of params, MoE-tolerant |
97
+ | Expert MLP down | **3-bit** | middle 58 | Write-back sensitivity (Config-I finding) |
98
+ | Attention Q/K/V/O | **4-bit** | middle 58 | Uniform per layer |
99
+ | Boundary (all tensors) | **8-bit** | first 2 + last 2 | Boundary layer protection |
100
+ | MoE router | **f16** | all | Routing precision critical |
101
+ | Embeddings + lm_head | **8-bit** | — | Protected |
102
+
103
+ Uniform MLX quantization produces broken output (~25% MMLU, random guessing) on MiniMax at all bit levels because it compresses attention and routing to the same bits as expert MLPs. Config-I solves this by protecting the components that control coherence while compressing the 98% of parameters that tolerate it.
104
+
105
+ ## Compatibility
106
+
107
+ | Field | Value |
108
+ |-------|-------|
109
+ | Format | MLX safetensors (standard) |
110
+ | Avg bits | 3.249 bpw |
111
+ | Runtime | `mlx_lm` (Python), `mlx-swift-lm` (Swift, 2.5x faster decode) |
112
+ | Platform | Apple Silicon (recommended M-series Pro/Max/Ultra with 96GB+) |
113
+ | Quantized on | 2026-04-12 |
114
+
115
+ **No custom loader needed.** This is standard MLX per-layer quantization. Any tool that reads MLX safetensors with `config.json` quantization metadata will work.
116
+
117
+ ## How to Run
118
+
119
+ ```bash
120
+ # Python (mlx_lm)
121
+ pip install mlx-lm
122
+ python -m mlx_lm.generate --model pidtom/MiniMax-M2.7-ConfigI-MLX --prompt "Hello"
123
+
124
+ # Or load in code
125
+ from mlx_lm import load, generate
126
+ model, tokenizer = load("pidtom/MiniMax-M2.7-ConfigI-MLX")
127
+ print(generate(model, tokenizer, prompt="Hello", max_tokens=256, temp=1.0, top_p=0.95))
128
+ ```
129
+
130
+ > **Important:** MiniMax M2.7 is an always-reasoning model. Use `temp=1.0` — greedy/temp=0 causes infinite thinking loops.
131
+
132
+ ## What is Config-I?
133
+
134
+ Config-I is a tensor-role-aware weight compression policy from TurboQuant+. Through systematic A/B isolation, it was discovered that attention tensors, FFN read projections (gate/up), FFN write-back projections (down), and boundary layers have dramatically different compression sensitivity. The key insight: **compression policy matters more than compression math** — which tensors to compress, which to protect, and how aggressively.
135
+
136
+ Config-I achieves 27-38% size reduction at +1.0-3.9% PPL across Qwen and Phi model families (1.5B to 72B), validated by [independent third-party implementations](https://github.com/dhawalc/turboQuantDC).
137
+
138
+ For MoE models like MiniMax M2.7, expert MLPs dominate parameter count but tolerate aggressive compression because only 8 of 256 experts are active per token. Config-I exploits this by compressing expert MLPs to 2-3 bit while protecting attention and routing at higher precision.
139
+
140
+ - [Config-I Paper](https://github.com/TheTom/turboquant_plus/blob/main/docs/papers/weight-compression-tq4.md)
141
+ - [Getting Started Guide](https://github.com/TheTom/turboquant_plus/blob/main/docs/getting-started.md)
142
+ - [TurboQuant+ Repository](https://github.com/TheTom/turboquant_plus)
143
+
144
+ ---
145
+
146
+ Quantized by [@pidtom](https://huggingface.co/pidtom) | [GitHub](https://github.com/TheTom) | [X](https://x.com/no_stp_on_snek) | [Sponsor](https://github.com/sponsors/TheTom)