Ternary Bonsai 2.5 27B: A 6GB Quantized Model Built for Agentic AI
5 min read

Quantization has become essential for deploying large language models in production environments where memory and compute are limited. Ternary Bonsai 2.5 27B represents a specific approach to this problem: using a ternary weight format (where each weight is −1, 0, or +1) to compress a 27-billion-parameter model to 5.93 GB while maintaining performance on agentic tasks like tool calling and code generation.
The model is built on Qwen3.8-27B, a hybrid-attention architecture with 262K token context length. It's distributed as GGUF files compatible with llama.cpp and other inference runtimes, making it accessible to developers without specialized hardware or frameworks.
Why it matters
Most quantized models trade capability for size. Ternary Bonsai 2.5 is designed to minimize that trade-off specifically for agentic workloads—tasks where a model must call tools, reason about their outputs, and generate code.
The benchmarks reported show:
- Tool calling: Across five benchmarks (τ²-Bench, τ³-Bench, BFCL v3, BFCL v4, AppWorld), the model averages 77.2 versus 77.7 for full-precision FP16—a difference of 0.5 points, described as "essentially indistinguishable."
- Coding: On agentic coding tasks (Terminal-Bench 2.1, SWE-bench Verified, DeepSWE), the model achieves 90% of FP16 performance, up from 63% in the previous Bonsai 2 release.
- General capability: Across 16 benchmarks spanning five categories, it scores 82.1 versus 84.3 for FP16—a 2.2-point gap.
The practical implication: developers can run a capable agentic model on a single consumer GPU or edge device, rather than requiring enterprise-grade hardware. At 5.93 GB, it fits on devices with 8–12 GB of VRAM, or can run on CPU with acceptable latency.
How it works
Ternary quantization with rotated basis
The core technique is ternary weight quantization: each weight in the model is reduced to one of three values (−1, 0, or +1). This is more aggressive than standard 2-bit or 4-bit quantization, but it requires careful handling to preserve accuracy.
The model uses a rotated weight basis to make ternary quantization work. Before assigning ternary values, each weight matrix is transformed blockwise using an orthogonal Hadamard rotation. This rotation spreads information more evenly across weights, making the ternary assignment less lossy. Critically, the rotation is folded into the stored weights offline—it costs no extra bits and no extra weight traffic at runtime.
Each group of 128 weights shares one FP16 scale factor, so the total overhead is minimal. The result: 1.76 bits per weight (since log₂3 ≈ 1.585 bits per ternary value).
Architecture and backends
The model retains Qwen3.8-27B's hybrid-attention design: approximately 75% linear attention and 25% full attention, with SwiGLU MLPs and RoPE positional embeddings. This architecture is key to its efficiency.
Three GGUF packings are provided:
- PTQ1_0: Dense ternary format (1.76 bits/weight, 5.93 GB). Runs on PrismML's llama.cpp fork (under upstream review) and Apple Metal. Fastest decode on NVIDIA GPUs.
- PQ2_0: Each ternary value stored in a 2-bit slot. Benchmarked on Apple Metal; source for MLX export.
- Q2_0: Standard llama.cpp 2-bit format. Runs on stock llama.cpp without custom kernels.
The model includes optional multi-token prediction (MTP) variants with a draft head for speculative decoding, reported to speed up decode by 1.5–1.8× on NVIDIA GPUs.
Inference speed
Reported decode speeds on NVIDIA GPUs with PTQ1_0:
- H200: ~300 tokens/s
- Speeds are 2.3–3.0× faster than Bonsai 2's release day on six of seven GPUs tested
Prefill performance varies by packing: PQ2_0 is faster on H200, H100, B200, and L40S; PTQ1_0 is slightly faster on others.
How to try it
For detailed setup instructions, the source of truth is the Bonsai demo repository, which includes tested setups for every backend, pinned binary releases, and run scripts for serving, tool calling, and speculative decoding.
The model card recommends these sampling parameters:
- Thinking mode: temperature=1.0, top_p=0.95, top_k=20, min_p=0.0, presence_penalty=0.0, repetition_penalty=1.0
- Instruct mode: temperature=0.7, top_p=0.80, top_k=20, min_p=0.0, presence_penalty=1.5, repetition_penalty=1.0
Note: llama.cpp applies min_p=0.05 by default, so pass --min-p 0 explicitly.
The model uses xhigh reasoning effort by default (most accurate); use medium for shorter responses and a balance of speed and accuracy.
Who it's for (and limits)
Best suited for:
- Developers building agentic systems (tool calling, code generation, long-horizon reasoning) on resource-constrained hardware
- Edge deployments where model size is a hard constraint
- Teams needing sub-10GB models without sacrificing tool-calling capability
- Researchers evaluating ternary quantization techniques
Limitations to consider:
- General capability (non-agentic tasks) is 2.2 points behind FP16 on average. If your use case is pure text generation or summarization, the gap may be more noticeable.
- Requires custom kernels (PrismML's llama.cpp fork) for optimal performance on NVIDIA GPUs; stock llama.cpp support is available via Q2_0 but with slower decode.
- The vision tower (for image input) ships separately as an optional file; text-only serving doesn't load it.
- Low reasoning effort is not supported; the model will behave close to xhigh if selected.
Links
- Model: https://huggingface.co/prism-ml/Ternary-Bonsai-2.5-27B-GGUF
- Demo & examples: https://github.com/PrismML-Eng/Bonsai-demo
- Whitepaper: https://github.com/PrismML-Eng/Bonsai-demo/blob/main/bonsai-2-5-27b-whitepaper.pdf
- Bonsai 2 whitepaper (ternary format details): https://github.com/PrismML-Eng/Bonsai-demo/blob/main/bonsai-2-27b-whitepaper.pdf
- Discord community: https://discord.gg/prismml
- Low-bit kernel forks: llama.cpp (CUDA + Metal), MLX (Apple Silicon), mlx-swift (iOS/macOS)
Also trending that day
The day's GitHub and Hugging Face picks side by side.
| Project | Source | ★ | Language / Type |
|---|---|---|---|
| elementalsouls/Claude-BugHunter | GitHub | 25,450 | Python |
| HKUDS/CLI-Anything | GitHub | 66,731 | Python |
| jingyaogong/minimind | GitHub | 72,059 | Python |
| openvinotoolkit/openvino | GitHub | 12,894 | C++ |
| cathrynlavery/diagram-design | GitHub | 74,239 | HTML |
| thinkingmachines/Inkling-2-Mini | Hugging Face | 6,375 | image-text-to-text |
| unsloth/Inkling-2-Mini-GGUF | Hugging Face | 1,543 | image-text-to-text |
| SulphurAI/Sulphur-3 | Hugging Face | 1,309 | — |
| AtomicChat/Inkling-2-Mini-Uncensored-GGUF | Hugging Face | 973 | image-text-to-text |
| prism-ml/Ternary-Bonsai-2.5-27B-GGUF | Hugging Face | 576 | text-generation |