Doubling llama.cpp generation speed on an M6 Mac mini
There’s an ongoing trend with optimising llama.cpp binaries for the hardware you’re running it on. Here’s my attempt for my mac mini using Claude Opus 5.5. My takeaway from this is to ensure the full extent of the model is used (in this case Qwen’s MTP, multi-token-prediction) before considering code changes.
- Using stock llama.cpp (
115deee8e), it ran Qwen3.8-27B (IQ4_XS[1]) at about 8.7 tokens/s on my 24 GB M6 Mac mini. This is quite close to the ~10 tokens/s ceiling set by reading 14.4 GiB of weights per token at ~154 GB/s. - The big win for me was the model’s built-in MTP layer used via llama.cpp’s speculative draft feature (
--spec-type draft-mtp --spec-draft-n-max 4). It guesses a few tokens ahead, taking the average to 17.8 tokens/s. - I also registered the M6 in llama.cpp’s Metal backend and tuned its flash-attention kernel using the tuning scripts, which made attention over a q8_0 KV cache 1.6-1.7x faster with no measurable quality loss that I could see (KL divergence[2] 0.000018 vs f16).
- Changing some compiler flags (
-mcpu=apple-m6instead ofnative, which clang reads as an M4, plus LTO[3]) were worth doing, because the GPU does almost all the work so no serious loss or noise. - I had to cap context at 48K with
-ngl all, because beyond that llama.cpp quietly moves layers to the CPU and the speedup disappears.


Is it worth doing? Yes! You might have missed a crucial setting that further increases t/s.
- IQ4_XS: a llama.cpp quantisation format that stores each weight in about 4.25 bits instead of the original 16. It uses an importance matrix and a non-linear set of values to keep quality high. The file I used averages about 4.4 bits. It’s an important optimisation that makes it feasible to run models locally.
- KL (Kullback-Leibler) divergence: a measure of how different two probability distributions are. Here it compares the model’s next-token probabilities with and without a change, and 0 means identical.
- LTO (link-time optimisation): the compiler optimises the whole program when it is linked, instead of one source file at a time. This lets it inline and simplify code across files.