Ternary Bonsai 2.5 27B: A Real Coding Agent in 5.93 GB
PrismML's newest release keeps 90% of a 53.8 GB model's agentic coding ability in a file smaller than a phone game. Here is how ternary weights and a Hadamard rotation pull that off, where the numbers hold up, and the setup traps that will waste your evening.
- Published
- Read time
- 9 min read
- Written by
- Behzat Bilgin Erdem
PrismML released Ternary Bonsai 2.5 27B on November 24, 2026, under Apache 2.0. The headline number is easy to state and hard to believe: 27.36 billion parameters in a 5.93 GB file, against 53.8 GB for the FP16 model it is built from. That is a ninth of the size, and it fits in the VRAM of a card people already own.
The more interesting number is the other one. On the three agentic coding benchmarks, Bonsai 2.5 keeps 90% of the full-precision score. Its predecessor, Bonsai 2, kept 63% and did not solve a single DeepSWE task. Whatever happened between those two releases is the actual story here, because it is not a compression story. It is a story about which capabilities survive compression.
What Changed, and What Did Not
The architecture did not move. Bonsai 2.5 keeps the Qwen3.8-27B hybrid-attention design and the ternary weight format from Bonsai 2. The parameter budget breaks down as 24.35B language across 64 blocks, a 0.47B vision tower across 27 blocks, and 2.54B for the embedding and output head. Context is 262K tokens. Effective precision is 1.76 bits per weight.
What changed is behaviour under long, tool-driven work. PrismML describes this release as targeting long-horizon tasks, and the benchmarks back that up in a way that is unusual for a point release:
| Benchmark | Qwen3.8 27B (FP16) | Bonsai 2 27B | Bonsai 2.5 27B |
|---|---|---|---|
| SWE-bench Verified | 80.6 | 60.8 | 75.6 |
| DeepSWE v1.1 | 30.1 | 0.0 | 27.0 |
| Terminal-Bench 2.1 | 70.8 | 52.8 | 60.1 |
| AppWorld | 93.2 | 51.2 | 90.5 |
| τ²-Bench | 80.6 | — | 82.0 |
| τ³-Bench | 72.8 | 69.1 | 73.9 |
| BigCodeBench | 61.5 | 57.2 | 60.3 |
| LiveCodeBench v6 | 87.6 | 83.8 | 83.0 |
Read down that list and a pattern shows up. The gains are concentrated in benchmarks where the model has to act repeatedly and recover — SWE-bench, DeepSWE, AppWorld, the τ-Bench family. The gains are flat or slightly negative where the model has to produce one correct artifact — LiveCodeBench actually went down, from 83.8 to 83.0.
That is a meaningful trade, and I think it is the right one. Agentic work is not "write a correct function." It is "call twelve tools, read four error messages, revise your plan twice, and stop when the test suite is green." Single-shot quality is well-served by a bigger model on someone else's GPU. Multi-turn reliability is what makes a local agent worth running at all.
Averaged across five tool-calling benchmarks, Bonsai 2.5 scores 77.2 against 77.7 for FP16. That is not "close for a compressed model." That is indistinguishable, and it beats every conventional low-bit build PrismML compared against, including one 1.7× larger.
The Trick: Weights With Three Values
The reason a 27B model fits in under six gigabytes is that almost every weight is one of three numbers.
Ternary Bonsai uses a format PrismML calls Ternary g128. Each weight is drawn from the set of -1, 0 and +1, packed as dense trits, with an FP16 scale shared across groups of 128 weights. Two trits per weight plus the shared scale works out to 1.76 bits per weight.
Three-valued weights are not a new idea, and on their own they are not enough. The naive failure mode is obvious: real weight distributions have outliers, and a handful of very large weights in a row will all round to the same ternary value, destroying the direction that row encodes. The fix here is the part worth understanding.
Before the ternary assignment, each matrix is transformed blockwise by an orthogonal Hadamard rotation. A Hadamard rotation spreads energy evenly across a block, which flattens outliers and makes the remaining distribution far friendlier to a three-level quantizer. The rotation is folded into the stored weights offline, so it costs no extra bits and no extra weight traffic. At inference time the runtime applies the matching transform to the activations instead.
That last detail is the one that will bite you, so remember it: this is not a file format you can hand to an arbitrary runtime. The rotation has to be undone somewhere, and if the runtime does not know about it, you get a model that loads cleanly and produces noise.
The release ships three packings of the same weights:
- PTQ1_0 — 5.93 GB, dense trits. Fastest decode on every NVIDIA GPU measured. Requires the PrismML llama.cpp fork.
- PQ2_0 — the benchmark standard on Apple Metal, and the source for the MLX export. Also fork-only.
- Q2_0 — around 7.91 GB, standard llama.cpp 2-bit type. Runs on stock builds, which is the one you want if you use Ollama or LM Studio.
There are also -mtp.gguf variants carrying a multi-token prediction draft head: one extra layer that guesses the next few tokens, which the full model then verifies in a single pass. On NVIDIA GPUs that buys a 1.5–1.8× decode speedup. The measured mean KL divergence between drafting on and drafting off is 5.2 × 10⁻⁵ on an H200 — small enough that you are getting the same text faster, not different text. It does slow prefill by 9–23% unless you also have the newer kernels, which matters if your agent reads a lot and writes a little.
Running It: The Four Traps
The setup is straightforward if you read the model card and miserable if you do not. Four things specifically:
1. Stock llama.cpp needs b11556 or newer. That release added the Hadamard activation runtime these weights require. The failure mode is the worst kind: older builds load the Q2_0 file without any warning and produce garbage. Run llama-cli --version before you spend an hour concluding the model is bad. Anything that bundles its own llama.cpp — desktop apps, wrappers — needs an engine built from b11556 onward.
2. PTQ1_0 and PQ2_0 do not run on stock llama.cpp at all. Those need the PrismML fork, which carries the CUDA, Metal and SYCL kernels. The Hadamard support for Q2_0 is upstream and merged, but PTQ1_0 is still under review.
3. Do not cap your token budget low. The chat template defaults to xhigh reasoning effort, and low is not supported — if you select it, the model behaves close to xhigh anyway. A cap like 256 tokens ends generation mid-thought, before any answer is produced. You need something like -n 16384. This is the single most common reason people report "the model outputs nothing useful."
4. Limit server slots on small cards. With automatic parallelism, the server may start four slots sharing a unified KV cache. A community report on an RTX 3080 10 GB measured roughly 9.5 GB of total GPU memory use, and about 7.8 GB after adding -np 1.
A working invocation looks like this:
hf download prism-ml/Ternary-Bonsai-2.5-27B-GGUF \
Ternary-Bonsai-2.5-27B-PTQ1_0.gguf --local-dir .
./bin/llama-cli -m Ternary-Bonsai-2.5-27B-PTQ1_0.gguf \
-ngl 99 -fa on -c 32768 -n 16384 \
--temp 1.0 --top-p 0.95 --top-k 20 --min-p 0 \
-p "Refactor this module to remove the circular import."
The sampling parameters are not interchangeable between modes. Thinking mode wants temperature 1.0, top_p 0.95, top_k 20, min_p 0 and no penalties. Instruct mode wants temperature 0.7, top_p 0.80, top_k 20 and a presence penalty of 1.5. And pass --min-p 0 explicitly, because llama.cpp defaults to 0.05 and that quietly changes the output distribution.
If you would rather not think about any of this, Ollama works with the Q2_0 file:
ollama run hf.co/prism-ml/Ternary-Bonsai-2.5-27B-GGUF:Q2_0
Speed, and What It Is Actually For
Decode on an H200 with PTQ1_0 is 189 tokens/s plain, and the prefill numbers are the surprising ones — close to 3,000 tokens/s. PrismML reports 291 tokens/s generation with MTP on an H100 and 204 on an RTX 4090, both with prompt processing around 3,000 tokens/s or better. On an Apple M5 Pro, the MLX build prefills at 348 tokens/s and decodes at 21.7.
That prefill-to-decode ratio is why this model is interesting for agents specifically. Agent workloads are prefill-heavy. Every tool result, every file read, every test failure goes into the prompt. A model that ingests 3,000 tokens/s and emits 200 makes a twelve-turn agent loop feel responsive in a way that a slow-prefill model never will, regardless of how good its output quality is.
The use cases that follow from the numbers:
- Local coding and terminal agents. SWE-bench 75.6 and Terminal-Bench 60.1 from a file that fits in 8 GB of VRAM, with the 262K context still available for whole-repository reads.
- Tool-calling and customer-facing agents. FP16-level multi-turn tool use without a datacenter model behind it.
- Offline and on-device work. Laptops on Apple Silicon and Core Ultra run it, and prompts never leave the machine. That is a real property, not a marketing one — it is the difference between an agent you can point at proprietary code and an agent you cannot.
- Single-GPU agent serving. Roughly 300 tokens/s decode on H200 and B200 with the MTP head.
A phone path exists — a Galaxy S26 Ultra running the whole model on the Hexagon NPU has been measured — but it depends on a fix that has not shipped yet. Treat that as roadmap, not as something you can do this weekend.
The Honest Caveats
Compression still costs something, and it is worth naming where.
On BFCL v4, Bonsai 2.5 trails FP16 by 3.6 points and loses to a conventional IQ2_S build by 0.5. It is not uniformly better than everything smaller than itself.
On general capability, the average across five categories is 82.1 against 84.3 for FP16. If your workload is reasoning, math or long-form synthesis rather than tool use, you are giving up roughly two points to save 48 GB — a trade that may well not be worth it if you already own the GPU.
And the ecosystem dependency is real. A format that requires a specific fork for its fastest packing, an upstream build number for its portable one, and a matching activation transform at runtime is more fragile than a plain Q4 GGUF. That is the price of 1.76 bits per weight. The Q2_0 path being merged upstream is genuinely reassuring, but the PTQ1_0 and PQ2_0 kernels are not there yet.
Why This One Matters
Low-bit models have been around long enough that "small model runs on your laptop" is not news. What is new is the shape of the loss.
For most of the history of quantization, compression hurt hardest exactly where agents need it least to be hurt — multi-step reliability. One bad action derails a long episode, and errors compound across turns in a way they do not in single-shot generation. Bonsai 2 is the proof: 63% retained on agentic coding, zero DeepSWE tasks solved. A model like that is fine as a chatbot and useless as an agent.
Bonsai 2.5 inverts that. It is at parity with full precision on tool calling, above it on two of the τ-Bench variants, and at 90% on agentic coding. The capability it lost is the one you were least likely to be using locally anyway — raw single-shot benchmark strength, which is better served by calling an API.
Which means the practical question changed. It used to be "is a local model good enough to be worth the hassle?" For agent-shaped work under 10 GB, that question now has a defensible yes. The interesting follow-up is quieter: if a capable coding agent runs on a laptop you already own, offline, for free, under Apache 2.0 — what stops you from putting one in every tool you build?
Nothing, mostly. That is the part worth paying attention to.
Weights, benchmarks and the whitepaper are on the PrismML announcement and the Hugging Face model card. Numbers quoted here are PrismML's own, measured in thinking mode at xhigh reasoning effort against conventional low-bit builds of the same base model — which is the right comparison, but it is still a vendor comparison. Verify on your own workload before you commit.