--- license: apache-2.0 tags: - imatrix - quantization - mlx - moe - inkling2 - looped-transformor pretty_name: Inkling 2 Mini imatrix --- # Inkling-2-Mini imatrix Activation-importance matrix (`in_sum2` / `counts`) for [thinkingmachines/Inkling-2-Mini](https://huggingface.co/thinkingmachines/Inkling-2-Mini), captured for `rco-mlx` mixed-precision quantization. ## File | file | size | contents | | --- | --- | --- | | `imatrix_inkling2.npz` | 2.8 MB | 369 tensors × (`.in_sum2`, `.counts`) | ## Capture | | | | --- | --- | | Source checkpoint | `thinkingmachines/Inkling-2-Mini` (native NVFP4 + MXFP8) | | Calibration | WikiText-2, 24 rows × 2048 tokens = **49,152 tokens** | | Corpus | `calib_wikitext_128x2048.npy` | | Routed expert slots | **37,748,736** | | Capture driver | `rco-mlx` `scripts/capture_imatrix_inkling2.py` | Captured on the **native** checkpoint as the primary source: the published experts are NVFP4/MXFP8, and the native forward pass is the function the quant has to reproduce. (The BF16 reconstruction is 52.8 GB and thrashes a 64 GB machine during capture.) A second capture was run on the dequantised BF16 source to cross-check. It completed and produced a **byte-identical** file (MD5 `176f39b7…`), which independently confirms that the numpy NVFP4/MXFP8 dequantisation reproduces the published checkpoint's forward pass exactly. ## Coverage | class | tensors | | --- | --- | | Routed experts (stacked `gate_up_proj` / `down_proj`) | 48 | | Attention projections | 168 | | Other linears (vision tower, mergers, message gates) | 153 | Per-tensor routed-slot counts follow the loop structure exactly — core layers 6–17 (run 3× per token) accumulate 3× the slots of the non-core layers, and every expert tensor carries `tokens × top_k × visits` slots. Mean is ≈ 3,072 slots per expert per layer; no expert is unrouted at this corpus size. ## Key format Keys are MLX module paths **without** `.weight`, matching the tensor names in the RCO artifacts: ``` model.language_model.layers.0.mlp.experts.gate_up_proj model.language_model.layers.0.mlp.experts.down_proj model.language_model.layers.0.self_attn.q_proj ``` Routed experts are stored **aggregated per stacked tensor** (one row per (layer, projection)) rather than per expert index, because the RCO artifacts keep each layer's 128 experts in a single pre-stacked tensor — one group, one imatrix row. `counts` is the total routed-slot count for that tensor. Verified against both published artifacts: **224 / 224 quantized tensors mapped (100 %)** for `hermitdave/Inkling-2-Mini-MLX-RCO-4.5bpw` and `hermitdave/Inkling-2-Mini-MLX-RCO-3.5bpw`. ## Use ```bash python examples/moe_pipeline.py \ --source --output \ --model-type inkling2_loop --target-bpw 4.25 --group-size 64 \ --bits 3,4,6,8 --expert-allocation per-projection \ --imatrix imatrix_inkling2.npz --per-group-clip ``` `--per-group-clip` is where the imatrix pays: it picks a clip ratio per (row, group) by the imatrix-weighted MSE. Weighting the allocation alone was measured **not** to help at tight budgets; an unweighted per-group search is worse than the per-tensor clip it replaces. ## Attribution Captured by **Hermes Agent** with [`hermitdave/rco-mlx`](https://github.com/hermitdave/rco-mlx). Model by [Thinking Machines Lab](https://thinkingmachines.ai), Apache 2.0.