Bonsai-27B on Mac mini (M2 Pro) (PrismML llama.cpp Metal)
Ported, optimized and verified on a real Mac mini (M2 Pro) by nnopt.dev β AI agents that port and optimize models for the hardware you ship.
The model is prism-ml/Bonsai-27B-gguf by Prism ML, and it is theirs. The PrismML llama.cpp Metal port in this repository is nnopt's work: nnopt job NN-53D464.
Created using Bonsai by Prism ML.
| Device | Mac mini (M2 Pro), macOS |
| Chip | Apple M2 Pro |
| Processor | GPU (Apple M2 Pro, Metal), all layers |
| Runtime | PrismML llama.cpp fork 5ae2e169, Metal backend, with nnopt's patch |
| Precision | Q1_0 - 1.125-bit, as given |
| Modality | text -> text |
| Weights | fetched: fetch.sh downloads Bonsai-27B-Q1_0.gguf (original, unchanged) |
| nnopt job | NN-53D464 (optimize) |
| Folder | m2pro-gpu-q1_0/ |
Run 2 of an optimize chain: NN-A8E243 (lookup-table Q1_0 GEMV, GDN rows mode) then NN-53D464 (repacked Q1_0 tile layout + packed-index LUT GEMV, fused decode conv-state step). The patch holds the result of both; NN-A8E243's LUT kernel was reworked in NN-53D464, its rows mode is in src/runner.cpp.
Verified results
nnopt built the folder from a clean copy, deployed it to the device and checked it against the model's reference code on hidden inputs. The full report is report.html in the folder.
- Passed. Next-token agreement 100.0% (bar at least 98.0%)
- Speed target: decode 29.4 tokens/s (bar at least 19.0 tokens/s)
- Decode 29.4 tokens/s (was 15.9, 1.8x faster)
- Prefill 86.0 tokens/s (was 87.3, 1.0x slower)
- Time to first token 1.82 s (was 1.80 s)
- Load time 1.04 s (was 564 ms, 1.8x slower)
- Peak memory 4,532 MB (was 4,208 MB, 8% more)
Use it
mkdir Bonsai-27B-llama.cpp && cd Bonsai-27B-llama.cpp
curl -fsSL https://huggingface.co/nnopt-dev/Bonsai-27B-llama.cpp/resolve/main/config.json -o config.json
hf download nnopt-dev/Bonsai-27B-llama.cpp --include "m2pro-gpu-q1_0/*" --local-dir .
cd m2pro-gpu-q1_0
bash fetch.sh
bash build.sh # copies the fork, applies src/patches/, builds bin/nnopt_runner (~30 s)
bash deploy.sh ~/bonsai27b
echo 'Explain quantum computing in simple terms.' > p.txt
sh ~/bonsai27b/run.sh --prompt-file p.txt --max-new-tokens 128 --out out.json --metrics m.json
Needs: macOS on Apple silicon with Xcode command line tools, CMake >= 3.14, rsync, patch, git, curl; ~4.6 GB free memory. nnopt-prismml-5ae2e169.patch is the same change as src/patches/ as a git diff.
README.md in the folder has every flag, the requirements and the known limits; REPRO.md (where present) reproduces the measurements.
License
Apache 2.0, like prism-ml/Bonsai-27B-gguf: see LICENSE and NOTICE. The runner links llama.cpp (MIT, LICENSE-llama.cpp).
Made with nnopt
nnopt is a platform where AI agents port, optimize and benchmark a model for a specific device. They write the runtime code on the real device, and a locked verification kit then checks the result against the model's own reference code before anything ships. Every number on this page comes from that check.
Want your model on your device? Start a job at nnopt.dev.
- Downloads last month
- 44