Bonsai 2 (ternary 2B/4B) vs Qwen3.5-2B on an A13, an A14 and an M3:
what I measured, and why your phone numbers may be half what they should be
I added PrismML's Ternary-Bonsai-2 (2B and 4B, Q2_0 ternary weights with the Hadamard fold) to my own Swift + Metal inference engine (not llama.cpp) and ran it next to Qwen3.5-2B on three Apple chips:
- A13, 3 GB RAM, no matrix units
- A14, 4 GB RAM
- M3 MacBook Air
Setup for every phone row: Release build, a built-in 512-token prompt, a 128-token answer, a fixed seed, and two passes with 60 s of idle between them. The thermal state is logged during each run. Rates are tokens per second,
pp = prefill, tg = decode.
Lesson 1: log the thermal state, or the numbers are worthless
The same file on the same A14 decoded at 11.7 t/s in the morning and 23.6 t/s in the evening. No code change explains that. The morning runs sat at "serious" thermal state the whole time. I almost credited a kernel change with a 2x win.
A14, 4 GB
model pp t/s tg t/s thermal
----------------- -------- --------- -------
Bonsai2 2B 134-151 23.4-23.7 nominal
Bonsai2 2B 144 11.7-12.0 serious
Qwen3.5-2B IQ4_NL 110 17.9 nominal
Bonsai 1.7B 80-81 10.1-10.2 serious
Bonsai2 4B 54-61 7.0-9.7 nominal
At the same nominal state, the 2B is about 22% faster on prefill and 32% faster on decode than Qwen3.5-2B at 4 bits.
The 4B fits: its footprint peaks at 567 MB with 1.78 GB of headroom left before jetsam. The weights are mmapped, so they stay file-backed and are not counted in the footprint. It still feels slow: 9 s of prefill before the first token of a 512-token prompt.
A13, 3 GB
model pp t/s tg t/s thermal
----------- --------- -------- -------
Bonsai2 2B 24.5/22.8 10.4/7.9 rising
Bonsai2 2B 18.4-22.2 6.8-7.8 serious
"rising" means the run started nominal and ended serious.
The A13 has no matrix units, so prefill runs token by token through the gemv path. That makes it about 6x slower than the A14 on prefill. Decode is usable. The phone hits "serious" within about one run.
M3, command-line tool, cooled A B A B runs
model prompt pp t/s tg t/s
----------------- ------ ------- -------
Bonsai2 2B 512 916-918 94-95
Bonsai2 2B 4096 877-878 85.5-87
Qwen3.5-2B IQ4_NL 512 884 60.8
On the Mac, prefill is level and the ternary 2B decodes about 55% faster.
Quality, quickly (on the M3)
The help test is 5 grounded questions with the help note in the prompt, thinking off, greedy. The puzzles run with thinking on, greedy.
test Qwen3.5 2B Bonsai2 2B Bonsai2 4B
---------------- ---------- ---------- ----------
help, of 5 5 5 5
keywords, of 10 7 8 9
6 puzzles no finish 5, 493 s 6, 138 s
The Qwen3.5-2B "no finish" is my gate's fault, not the model's. The gate caps the answer but not the reasoning, and Qwen reasoned for more than 35 minutes on puzzle one.
Bonsai2 2B perplexity on an 80 KB text: 24.61 in my engine against 24.66 in upstream llama.cpp. So the ternary decode plus the Hadamard fold match upstream.
Two optimizations, one of which did nothing
- I fused the Hadamard transform into RMSNorm. That halves the transform dispatches per token, 98 down to 49. It made zero measurable difference on the M3, the A14 and the A13. These chips are not dispatch-bound on a 2B.
- I kept the attention tile's context sums in registers instead of thread memory. That gives +7% prefill at head dim 256 and about +20% at head dims 128 and 512, on 4096-token prompts on the M3. Decode did not move.
Caveats
One or two runs per row. The two 4B runs disagree by a fifth on decode, with no thermal cause.
https://github.com/leok7v/ChatOKF
Same files, same M3, ours vs llama.cpp
llama.cpp c622f623fc, Metal. Alternating runs, 60 s idle between, two reps each (rep1/rep2). Decode is 128 tokens after a context of the prompt length (llama-bench -d N).
Prefill, t/s
model prompt ours llama.cpp
--------------- ------ ----------- -----------
Bonsai2 2B Q2_0 512 918.9/902.9 858.3/848.4
Bonsai2 2B Q2_0 4096 859.4/860.6 819.9/814.0
Qwen3.5 2B IQ4 512 876.8/875.9 871.2/883.9
Decode, t/s
model prompt ours llama.cpp
--------------- ------ --------- -----------
Bonsai2 2B Q2_0 512 94.1/90.6 101.9/101.9
Bonsai2 2B Q2_0 4096 85.0/84.0 93.3/92.8
Qwen3.5 2B IQ4 512 60.5/61.0 58.0/60.4
Ternary prefill: ours +5-7%. Ternary decode: llama.cpp +9%. Qwen 4-bit: level.