Some tests of Bonsai 2 27B vs other quantizations
Machine and models #
- CPU: Intel Core Ultra X7 358H, 16 cores / 16 threads,AVX2 + AVX-VNNI, no AVX-512 (up to 4.7 GHz)
- RAM: 30.9 GiB;GPU: Intel Arc B390 (Vulkan, UMA)
- Engine: openset-llm (PrismML llama.cpp fork @
e3de715+ the repo's 10 patches), built native with-march=native - Models:
~/Code/llama.cpp/models/Ternary-Bonsai-2-27B-PTQ1_0.ggufβ 5.6 GB, 64 blocks, ternary PTQ1,no MTP head~/.openset-llm/models/bonsai-mtp.ggufβ same base + 266 MB grafted MTP head, 65 blocks,nextn_predict_layers=1~/Code/llama.cpp/models/Qwen3.8-27B-thinkingcap-abliterated-mtp-Q4_K_M.ggufβ 16 GB, Q4_K_M, own MTP head
Best option for this hardware #
Bonsai-2-27B with the grafted MTP head, speculative decoding on, 16 threads: 17.35 tok/s decode median (15.80β20.41), 31.7 tok/s prompt, 76 % of drafts accepted, ~6β7 GB RAM.
That is the only configuration that reaches the README's 17β20 tok/s range here β on an AVX2-only CPU, with a model small enough to leave most of the RAM free.
cd ~/Code/openset-llm
./install.sh # builds engine, downloads Bonsai + unsloth MTP sidecar, grafts model.gguf
./serve --threads 16 --spec # chat at http://127.0.0.1:8080, API at /v1
--spec is required: serve turns speculation off by default on CPUs without AVX-512 VNNI, even though the model has an MTP head. --threads 16 only makes the default (nproc) explicit on this 16-core machine.
If you already have the Bonsai base locally and want to reuse it instead of down again:
curl -fL -o /tmp/mtp-Qwen3.8-27B-Q4_0.gguf \
https://huggingface.co/unsloth/Qwen3.8-27B-GGUF/resolve/main/MTP/mtp-Qwen3.8-27B-Q4_0.gguf
python3 -I scripts/graft_mtp.py --gguf-py ~/.openset-llm/llama.cpp/gguf-py \
~/Code/llama.cpp/models/Ternary-Bonsai-2-27B-PTQ1_0.gguf \
/tmp/mtp-Qwen3.8-27B-Q4_0.gguf \
~/.openset-llm/models/bonsai-mtp.gguf
./serve --model ~/.openset-llm/models/bonsai-mtp.gguf --threads 16 --spec
No graft, no speculation: ./serve --model ~/Code/llama.cpp/models/Ternary-Bonsai-2-27B-PTQ1_0.gguf works too, but gives only ~10 tok/s.
Use it from pi
~/Code/llama.cpp/openset-start.sh starts the same config as a detached OpenAI-compatible API on port 8766
(the existing llama.cpp provider uses 8080, bmoe 8765):
~/Code/llama.cpp/openset-start.sh --start # --status / --stop also available
pi --model openset/bonsai-27b-mtp # or, in a session: /model openset/bonsai-27b-mtp
pi's provider openset is configured in ~/.pi/agent/models.json (baseUrl http://127.0.0.1:8766/v1, model id bonsai-27b-mtp, 32k context, text + image) and the model is enabled in ~/.pi/agent/settings.json. Backups of both
files were saved with the .bak.20261129-openset suffix.
Vision: the script attaches mmproj-Qwen3.8-27B-BF16.gguf, so images work via image_url data URLs (verified in pi
with @/path/to/image.jpg). Resume is off by default because the patched rsm_load_prefix aborts when re a
prefix state saved from a multimodal request; set OPENSET_RESUME=1 only for text-only use.
Why pi can feel slow: decode is ~17 tok/s, but pi's agent prompt is ~5,500 tokens and prompt evaluation is ~37β42
tok/s, so the first token takes ~140 s. A larger -ub did not help. Keep the system prompt/tools lean, and remember
that thinking on (default in the script unless OPENSET_THINK=0) spends tokens before the answer; pi sends enable_thinking: false when its thinking level is off.
Benchmarks #
Same 6 short prompts (QA / code / math) Γ 128 generated tokens, greedy, temperature=0, 4k context, 8 threads unless noted, one run per arm. Numbers are medians with minβmax in brackets.
1. Q4_K_M: openset-llm CPU vs llama.cpp Vulkan
| Engine / mode | Decode tok/s | Prompt tok/s | Drafts accepted |
|---|---|---|---|
| openset CPU, plain | 4.55 [4.48β4.58] | 10.3 | β |
| openset CPU, MTP spec | 6.74 [5.75β7.18] | 8.9 | 86 % |
llama.cpp Vulkan ( -ngl 99 ), plain |
6.35 [3.30β6.46] | 40.2 | β |
llama.cpp Vulkan ( -ngl 99 ), MTP spec |
14.31 [8.12β15.83] | 41.9 | 82 % |
Vulkan: llama.cpp 1.1.0-dev, build 1839, commit 115deee8e, Arc B390 via Vulkan (UMA), all layers offloaded.
2. Bonsai base (no MTP head) on openset CPU
| Model | Decode tok/s | Prompt tok/s | RAM (RSS) |
|---|---|---|---|
| Bonsai PTQ1_0, plain, 8 threads | 10.43 [10.17β10.60] | 28.7 | ~6.5 GB |
| Q4_K_M, plain, 8 threads | 4.55 [4.48β4.58] | 10.3 | ~23 GB |
Same engine: the ternary weights are ~2.3Γ faster to decode and ~2.8Γ faster to read, using a quarter of the memory.
3. Optimization sweep on Bonsai (bench/optimizations.sh)
| Arm | Decode tok/s | Prompt tok/s | Drafts accepted |
|---|---|---|---|
| plain, 6 threads | 9.34 [9.11β9.63] | 24.2 | β |
| plain, 8 threads | 10.07 [9.94β10.32] | 26.9 | β |
| plain, 12 threads | 11.26 [11.14β11.52] | 32.0 | β |
| plain, 16 threads | 11.56 [11.21β11.66] | 34.9 | β |
plain, 8 threads, --fl128 |
9.69 [9.65β9.80] | 25.6 | β |
| MTP spec, 8 threads | 13.97 [12.80β16.63] | 23.8 | 76 % |
| MTP spec, 16 threads | 17.35 [15.80β20.41] | 31.7 | 76 % |
MTP spec, 8 threads, --fl128 |
13.89 [12.67β16.51] | 23.6 | 76 % |
What this says:
- Threads matter on both paths: 16 beats 8 by ~15 % plain and ~24 % with speculation.
- The MTP graft is the big win: ~1.4Γ at 8 threads, ~1.5Γ at 16.
--fl128is aloss on plain decode and neutral with speculation β leave it off (it is also explicitly not bit-identical).- Draft acceptance is the same at 8 and 16 threads, so the extra speed is just more compute per verify step.
What not to bother with #
--fl128β slower here, and outputs are not guaranteed bit-identical.--kv8/--kv6/--kv5β these shrink the KV cache for long contexts; at 4k on a 31 GB box they buy nothing for decode.- Vulkan for Bonsai β upstream llama.cpp does not understand the fork's private PTQ1 ternary type, so Bonsai stays on CPU. Vulkan only applies to the ordinary Q4_K_M file, where it is faster than the CPU engine but still slower than Bonsai+CPU+MTP (14.3 vs 17.4 tok/s).
- Power tuning β already
performance(EPBperformance, max 4.7 GHz); no gain available there.
Reproduce #
cd ~/Code/openset-llm
./bench/optimizations.sh \
--model ~/Code/llama.cpp/models/Ternary-Bonsai-2-27B-PTQ1_0.gguf \
--mtp-model ~/.openset-llm/models/bonsai-mtp.gguf \
--prompts-file ~/kb/bonsai-short-prompts.jsonl
The prompt set used above (save as ~/kb/bonsai-short-prompts.jsonl):
{"id":"short-1","task":"qa","messages":[{"role":"user","content":"What is the capital of France? Answer in one sentence."}]}
{"id":"short-2","task":"qa","messages":[{"role":"user","content":"Explain in two sentences why the sky is blue."}]}
{"id":"code-1","task":"code","messages":[{"role":"user","content":"Write a Python function that returns the nth Fibonacci number. Give only the function."}]}
{"id":"code-2","task":"code","messages":[{"role":"user","content":"Write a one-line Python expression to reverse a string."}]}
{"id":"math-1","task":"math","messages":[{"role":"user","content":"Compute 17 times 23 and show the intermediate steps."}]}
{"id":"short-3","task":"qa","messages":[{"role":"user","content":"Name three planets in our solar system, separated by commas."}]}
For the stock 24-prompt harness, omit --prompts-file (it will take much longer; several stock prompts are thousands of characters).
Caveats #
- One run per arm, short prompts; speed varies with the text and with background load. The two Bonsai plain runs gave 10.43 and 10.07 tok/s at 8 threads β treat Β±0.5 tok/s as noise.
- Draft acceptance is prompt-dependent: the README reports ~1.2β1.4Γ on code/JSON/math and ~1.0Γ on prose with 2-token drafting on AVX2 CPUs. This prompt mix accepted 76 %.
--specwith a GGUF that hasno MTP head will fail;serveauto-detectsnextn_predict_layersfor--modelfiles and turns speculation off with a note, but--specforces it regardless.
Obviously the speed tok/s isn't everything, also the final result is important an the quality of the result among quants is huge.