# Running a 27B Local LLM on M4 Mac mini (16GB): +57.4% Speed & -90.1% Heap

> Source: <https://dev.to/autotoollab/running-a-27b-local-llm-on-m4-mac-mini-16gb-574-speed-901-heap-25kd>
> Published: 2026-11-29 05:07:08+00:00

**Recommendation:** Enable draft-mtp speculative decoding and disable server features like --cache-ram, --webui and slots to cut heap and boost decode on memory-constrained local LLM hosts.
More in the playbook "Inference and self-hosting": <https://wpnews.pro/playbooks/inference-serving>

Cloud AI coding agents and automated daily pipelines burn through weekly quotas fast when every extraction and classification call goes to a frontier API.

On a base **Apple M4 Mac mini (16GB unified memory, macOS 27.2.1)**, we benchmarked `Ternary-Bonsai-2.5-27B-Q2_0-mtp.gguf` (7.37 GiB) under deterministic settings (`temperature=0.0`, `seed=42`, `cache_prompt=false`) to see how far a $0-marginal-cost local node can carry daily workloads before escalating hard tasks to cloud APIs.

| Configuration | Prefill (Medium) | Decode (Medium) | Physical Footprint | Dirty Malloc Heap | Swap Delta | 
|---|---|---|---|---|---|
| Before (Default `llama-server` ) | 54.55 tok/s | 10.30 tok/s | 2.840 GB | 2,374 MB | +2,621.2 MB | 
| After 1 (Stock Binary Tuned) | 52.80 tok/s | **15.53 tok/s (+50.8%)** | 1.437 GB (-49.4%) | **213 MB (-91.0%)** | +115.3 MB | 
| **After 2 (M4 Custom Build)** | **55.02 tok/s (+0.9%)** | **16.21 tok/s (+57.4%)** | **0.897 GB (-68.4%)** | **236 MB (-90.1%)** | **-122.8 MB** | 

`--spec-type draft-mtp --spec-draft-n-max 4 --spec-draft-p-min 0.3` achieved a 65.0% acceptance rate and roughly 1.5x faster medium-length decoding without hurting deterministic JSON structure (`q_ok=True`).`--cache-ram 0 --no-webui --no-slots -sm none --no-repack --no-host` eliminated over 2 GB of Dirty Malloc heap and stopped swap growth.`--load-mode none` ballooned physical footprint to 11.0 GB; `GGML_METAL_TENSOR_ENABLE=1` dropped prefill by -17% (46.32 tok/s); `--spec-type ngram-mod` dropped long-context decode to 8.55 tok/s.

```
caffeinate -s llama-server \
  -m /path/to/Ternary-Bonsai-2.5-27B-Q2_0-mtp.gguf \
  --offline --alias bonsai-2.5-27b --no-mmproj --jinja \
  -ngl 99 -fa on -c 12288 -np 1 -ctk q4_0 -ctv q4_0 \
  --spec-type draft-mtp --spec-draft-n-max 4 --spec-draft-p-min 0.3 \
  --no-repack --no-host --no-webui --no-slots --cache-ram 0 -sm none \
  --host 127.0.0.1 --port 8080
```

On a 16GB M4 Mac mini, `recommendedMaxWorkingSetSize` is **12.42 GiB**. Models in the 7–9 GB range (`Gemma 4 12B` at 7.1 GB or `27B Q2_0` at 7.37 GiB) run smoothly, while 30B–35B models (`13.9–19.6 GB`), `Strata Q2_0` (46 GB / 64 GB recommended), `Qwen3.8 Flash Next` (70.1 GB+), and `DeepSeek V4.1 Flash` (259 GB+) exceed 16GB capacity. Offload high-volume extraction locally and route final synthesis to cloud models.
