--- license: apache-2.0 base_model: MiniMaxAI/MiniMax-M2 tags: - mixture-of-experts - expert-pruning - gguf - agentic - coding-agent - swe-bench library_name: gguf --- # MiniMax-M2 — Expert-Pruned (keep-192/256), GGUF A research artifact on **structurally compressing a 230B Mixture-of-Experts coding agent** (MiniMax-M2: 256 experts/layer, top-8) by **pruning experts** — keeping it a *working agent* in a real tool-using loop, not just a fluent generator. This is the **keep-192** point: 192 of 256 experts kept (top-K by measured code/agentic activation), **~30% smaller, still solves real SWE tasks.** 👉 Full field report: [`ARTICLE.md`](./ARTICLE.md). ## The headline: capability scales smoothly with the expert budget Evaluated as a **real coding agent** (a harness driving the model through a Dockerized repo: read, edit, run tests) on a 6-instance SWE-bench Verified probe set (the exact instances the un-pruned model resolves 6/6), served via Ollama: | Variant | Size (GGUF) | Experts kept | SWE resolved | |---|---|---|---| | Full M2 (IQ2_M) | 78 GB | 256 / 256 | 6 / 6 | | **keep-192 (this repo)** | **~55 GB** | **192 / 256** | **3 / 6** | | keep-160 | 46 GB | 160 / 256 | 1 / 6 | | IQ1 (all experts, 1.8-bit) | 48 GB | 256 / 256 | 0 / 6 | Two findings worth taking away: 1. **No cliff** — agentic capability degrades *smoothly* as you remove experts (6 → 3 → 1), it doesn't collapse. You can drop a quarter of the experts and keep half the solving. 2. **At a fixed size, prune > uniform-extreme-quant** — keep-160 (46 GB, 160 experts at ~2.7-bit) resolves where IQ1 (48 GB, all 256 at 1.8-bit) resolves nothing. Concentrating the bit budget on fewer experts beats spreading it thin. These models are **untrained** (pure pruned quant, no fine-tune) — so the resolves are genuine compressed-M2 capability, not memorization. ## Use it ```bash # Ollama (the GGUF is in this repo): ollama create m2-pruned192 -f Modelfile ollama run m2-pruned192 ``` Or point any llama.cpp/GGUF runtime at `M2-pruned192-IQ2.gguf`. Use a generous context for agent loops (the M2 chat template + stop tokens are baked into the `Modelfile`). ## Reproduce ```bash # Prune the kept experts out of an IQ2_M GGUF of MiniMax-M2 (clean slice, no re-quant): python prune_gguf_experts.py \ --in MiniMax-M2-IQ2_M.gguf --out M2-pruned192.gguf \ --keep 192 --strategy file --keep-file keep192_experts.json ``` `keep192_experts.json` is the per-layer expert keep-set (top-K by measured activation on a code/agentic calibration corpus). ## Limitations - Research artifact, not a production release. At ~55 GB it solves **3/6** of this probe set; the full 78 GB quant solves 6/6 — pruning trades size for capability along the curve above. - Untrained. A recovery fine-tune ("heal") on top should push it further up the curve (separate work). - Honest framing: this is **not** "better than the full model" — it's a smaller point on a clean size↔capability curve, and at a fixed budget it beats a same-size uniform low-bit quant. ## License Apache-2.0, inheriting MiniMax-M2's terms. This repo adds a pruning recipe + a pruned GGUF derived from a quantized MiniMax-M2.