🟣 Patched-Metal / Specialized Runtime: Uses
decision_typeSystem-One readout head — requiresllama-clover(Metal 4) runtime.
☕ Support Local AI Development: Help me acquire a Mac mini 24GB/32GB to optimize and test local MoE models up to 80B parameters. Donate via Ko-fi →
[!TIP] Kenzan-Karpo-Decision-31B-AttnGrid — "31B Gemma-4 System-One Decision Engine in 12.09 GiB on 16 GB RAM." Shrunk from 58.29 GiB BF16 to 12.09 GiB with native 30-chunk
karpo_imatrixand Full-Attentionffn_downanchors (4k+5), paired withreadout.safetensors([255, 5376]) for ~1.1s single-pass routing andP = 1.0000order-invariant classification on Apple Mac mini M6.
Kenzan-Karpo-Decision-31B-AttnGrid-GGUF
Kenzan-Karpo-Decision-31B-AttnGrid (12.09 GiB / 12,383.76 MiB, 3.38 bpw) — Attention-aligned quantization of MachinePulseAI/karpo-decision-31B (Gemma4ForConditionalGeneration, 30.70B params, 60 layers = 50 Sliding Window Attention + 10 Full Attention), packaged together with readout.safetensors ([255, 5376], float32), decision_config.json, and a ready-to-run llama-server Python client for Apple Mac mini M6 (16 GB Unified Memory, Metal 4).
- 58.29 GiB → 12.09 GiB (
4.8×smaller) — fits comfortably inside Apple M6's15,032.39 MBMetal working set (50/60layers use Sliding Window Attention for minimal KV cache) - 204.35 ± 1.51 t/s prompt processing (
pp512, Metal 4,-fa 1 -ctk q4_0 -ctv q4_0) — ~1.05–1.17 s end-to-end single-pass routing decision latency - Full
readout.safetensorsfidelity: Verified order-invariant classification (P(A) = 1.0000/P(B) = 0.0000with13–17logit margin under option permutation)
1. AttnGrid Architecture & Sensitivity Analysis
karpo-decision-31B is a single-pass System-One decision model (<mask> hidden state → readout.safetensors [255, 5376]), not an autoregressive chat generator.
Computing a native 30-chunk karpo_imatrix.gguf directly from the Q8_0 conversion revealed strong sensitivity spikes at Full Attention boundaries (blk.5 = 6.32e5, blk.11 = 6.70e5, blk.29 = 3.24e5, blk.47 = 2.18e5) and blk.1/blk.58:
| Component / Layers | Quant Type | Role |
|---|---|---|
token_embd.weight | Q5_K | 262,144-token vocabulary precision |
output.weight | Q4_0 | Retained for GGUF compatibility |
attn_k, attn_v | Q6_K | Attention KV fidelity |
attn_q, attn_output | Q4_0 (Q5_K on blk.53–59) | Attention projections |
blk.(1,5,11,17,23,29,35,41,47,53,58,59).ffn_down | Q4_0 | All 10 Full-Attention + peak SWA ffn_down anchors |
Remaining 48 SWA ffn_down | IQ3_XXS | Eliminates 2-bit ffn_down bottleneck |
blk.(5,11,58,59).ffn_(up|gate) | IQ3_XXS | Peak & tail SwiGLU protection |
Remaining ffn_gate, ffn_up | IQ2_XXS | Calibrated with native 30-chunk karpo_imatrix.gguf |
2. Verified Benchmarks (Apple Mac mini M6, Metal 4)
Measured on llama.cpp (commit ed26f2f, -DGGML_METAL=ON, -ngl 99 -fa on -ctk q4_0 -ctv q4_0):
llama-bench(pp512): 204.35 ± 1.51 t/s (12.09 GiB,30.70 Bparams)- End-to-End
POST /embeddings+readout.safetensors(-np 1 -c 4096 --embeddings --pooling none --embd-normalize -1):Case 1 (A=Block+2FA, B=Allow):logits = [37.493, 24.532]→P(A) = 1.0000, P(B) = 0.0000Case 2 (A=Allow, B=Block+2FA):logits = [27.644, 44.994]→P(A) = 0.0000, P(B) = 1.0000
- Symmetric Readout Calibration (
karpo_calibration.json, 10 scenarios × 2 A/B permutations = 20 runs):- Accuracy: 100.0% (20 / 20)
- Positional Bias (
A - B):-0.5224logits - Temperature Scaling:
T_cal = 0.5124,Bias = [0.0128, -0.0095],NLL: 0.0002 → 0.0000
- Router Dispatch Latency (3-route classifier):
- Stateless (
POST /embeddingsdefault):1,054.5 – 1,718.2 ms - With Stateful LCP Prefix Caching (
server-task.hpatch,f_keep = 0.825–0.839):642–656 msserver-side (766.6–783.1 msend-to-end with HTTP + JSON parsing) and bitwise-identical probabilities ([0.0559, 0.9284, 0.0157]). Note: compacting the system prefix to ~35–45 tokens and returning binary float32 embeddings can push latency down to ~350–400 ms.
- Stateless (
3. Quick Start: Running with readout.safetensors
Important: Because
karpo-decision-31Buses an external linear readout head (readout.safetensors) instead of standard token generation, launchllama-serverwith--embeddings --pooling none --embd-normalize -1so it returns unnormalized last-layer hidden states[5376]for each token, then runexamples/karpo_decision_client.py.
huggingface-cli download kabcnd/Kenzan-Karpo-Decision-31B-AttnGrid-GGUF --local-dir ./karpo-31b
./llama-server \
-m ./karpo-31b/Kenzan-Karpo-Decision-31B-AttnGrid-IQ2_XXS-M6-16G.gguf \
--embeddings --pooling none --embd-normalize -1 \
--host 127.0.0.1 --port 11440 \
-ngl 99 -fa on -np 1 -c 4096 \
-ctk q4_0 -ctv q4_0 --cache-ram 2048
python3 ./karpo-31b/examples/karpo_decision_client.py
4. Acknowledgements & Inspiration
- Inspired by Bonsai-2 & Prism ML: Deep gratitude and inspiration go to the creators of Bonsai-2 at Prism ML (huggingface.co/prism-ml) for pioneering extreme low-bit quantization and proving that frontier-class models can thrive on consumer unified memory.
- Special Thanks to Misha: Sincere gratitude to Misha for unwavering support and financial assistance, which made the hardware testing, calibration runs, and open-weights releases in the Kenzan series possible.
- Upstream Creators:
MachinePulseAI/karpo-decision-31Bandgoogle/gemma-4-31B-it.
Support the Project & Funding Goals
All Kenzan weights, calibration recipes, and tooling are released openly and free of charge for the local AI community. If this model saved you cloud API costs or helped you run 31B+ models locally on a base Mac, please consider supporting future releases:
What Your Donations Directly Fund
- Upgrading to a Mac mini 24 GB / 32 GB (Apple Silicon): Breaking past the 16 GB ceiling to quantize, calibrate, and benchmark 70B–80B Pin-Grid MoE models at 70–100+ t/s.
- Cloud GPU Compute for I-Matrix & Calibration Sweeps: Covering cloud VRAM hours needed for full-precision importance-matrix (
imatrix) generation and layer sensitivity sweeps. - Open-Source Metal Kernels & Tooling: Funding continued optimization of
llama.cppMetal 4 kernels and local inference tooling for the entire community.