Ternary Bonsai 2.5 27B: 1.76-Bit Local Agent Architecture & Benchmarks

Ternary Bonsai 2.5 27B compresses the 53.8 GB Qwen3.8-27B hybrid-attention architecture into a 5.93 GB Apache-2.0 GGUF at 1.76 bits per weight while matching FP16 tool calling (77.2 vs 77.7) and retaining 90% of FP16 agentic coding performance. Paired with Multi-Token Prediction (MTP) draft heads and Smoke Monkey Harness, it serves autonomous workflows at up to 312 tok/s on single consumer and datacenter GPUs.
Ternary Bonsai 2.5 27B: 1.76-Bit Local Agent Architecture & Benchmarks: Ternary Bonsai 2.5 27B compresses the 53.8 GB Qwen3.8-27B hybrid-attention architecture into a 5.93 GB Apache-2.0 GGUF at 1.76 bits per weight while matching FP16 tool calling (77.2 vs 77.7) and retaining 90% of FP16 agentic coding performance. Paired with Multi-Token Prediction (MTP) draft heads and Smoke Monkey Harness, it serves autonomous workflows at up to 312 tok/s on single consumer and datacenter GPUs. Designed as a zero-dependency, open-source TypeScript architecture under the MIT License with native Model Context Protocol (MCP) support and deterministic phase state machines.
- Sub-6 GB 27B Footprint: PTQ1_0 stores {-1, 0, +1} trits with g128 FP16 scales in 1.76 bpw (5.93 GB / 5.58 GiB vs 53.8 GB FP16), leaving room for 262K context on single GPUs.
- FP16 Tool-Calling Parity: Averages 77.2 across tau2-Bench (82.0), tau3-Bench (73.9), BFCL v3 (72.6), BFCL v4 (67.2), and AppWorld (90.5) versus 77.7 for full-precision Qwen3.8-27B.
- 90% Agentic Coding Retention: Jumps from 63% (Bonsai 2) to 90% of FP16—reaching 75.6 on SWE-bench Verified, 60.1 on Terminal-Bench 2.1, and 27.0 on DeepSWE.
- 1.5x–1.83x MTP Speculative Speedup: Bundled Multi-Token Prediction draft heads drive ~306 tok/s on H200 (KL divergence 5.2e-5), 312 tok/s on RTX 5090, and 29.2 tok/s on Apple M4 Pro.
- Deterministic Smoke Monkey Control: Binds llama-server OpenAI endpoints directly to @smoke-monkey/harness with permission-gated terminal/MCP execution and local state persistence.
import { createAgent } from '@smoke-monkey/harness';// Connect Smoke Monkey Harness to a local PrismML llama-server serving Ternary Bonsai 2.5 27Bconst agent = createAgent({provider: 'openai',baseUrl: process.env.BONSAI_BASE_URL ?? 'http://127.0.0.1:8080/v1',apiKey: process.env.BONSAI_API_KEY ?? 'local-bonsai',model: 'Ternary-Bonsai-2.5-27B-PTQ1_0-mtp',agentId: 'build',workspacePath: process.cwd(),tools: ['filesystem', 'terminal', 'search', 'git', 'agent'],permission: 'ask-default',mcp: [{id: 'github',name: 'GitHub MCP',description: 'Inspect repository pull requests, CI checks, and issues',command: 'npx',args: ['-y', '@modelcontextprotocol/server-github'],enabled: true,},],});// Gate mutating commands while auto-allowing read-only inspection and test verificationagent.on('permission.required', (event) => {const safeTools = ['read_file', 'grep', 'glob', 'git_diff', 'git_status', 'run_test'];const decision = safeTools.includes(event.data.toolName) ? 'allow' : 'deny';agent.resolvePermission(event.data.toolCallId, decision);});agent.on('phase.changed', (event) => {console.log(`[Bonsai-2.5-27B] Phase -> ${event.data.phase}`);});async function main() {const result = await agent.run('Profile src/runtime/scheduler.ts for lock contention, apply a minimal patch, and verify with npm test.');console.log('Status:', result.status, 'Session:', result.sessionId);}main().catch(console.error);
Watch: Related Video Guides
Ternary Bonsai 2.5 IS HERE! 27B AI Model Under 9GB – Tested Locally on M5! Prism ML
Bonsai 2.5 First Look. Strong quant; not up to the hype.
What Is Ternary Bonsai 2.5 27B? Architecture & Rotated g128 Format
Ternary Bonsai 2.5 27B is an Apache-2.0 agentic release from PrismML built on Qwen3.8-27B that constrains every linear weight to {-1, 0, +1} trits in a blockwise Hadamard-rotated basis. At 1.76 bits per weight and 5.93 GB (5.58 GiB in PTQ1_0), it reduces FP16 storage by ~9x while preserving 262,144-token context and FP16-level tool calling.
Unlike Bonsai 2, which kept only 63% of FP16 agentic coding performance and scored 0.0 on DeepSWE, Bonsai 2.5 targets multi-turn, long-horizon agent trajectories. Total parameter distribution across the underlying Qwen3.8-27B hybrid-attention graph remains unchanged (27.36B total): 24.35B language parameters across 64 decoder blocks (~75% linear attention and ~25% full attention with SwiGLU MLP, RoPE, and RMSNorm), 0.47B across a 27-block vision tower, and 2.54B in embeddings and the output head.
Ternary g128 Weight Math & Hadamard Rotation
Each ternary weight carries theoretical log2(3) ≈ 1.585 bits of entropy. PrismML groups 128 weights (g128) under a single shared FP16 scale factor, bringing packed overhead to 1.76 bits per weight in PTQ1_0. To suppress outlier distortion before quantization, every matrix undergoes an offline blockwise orthogonal Hadamard rotation folded directly into the stored trits—costing zero extra storage bits—while the inference engine applies the matching Fast Walsh-Hadamard Transform (FWHT) to activations on the fly.
| Packing Format | File Size (Base / +MTP) | Bits/Weight | Runtime Support & Primary Hardware Target |
|---|---|---|---|
| `PTQ1_0` | 5.58 GiB (5.93 GB) / 5.80 GiB | 1.76 bpw | PrismML llama.cpp fork (upstream PRs #29672, #29676); fastest decode on all NVIDIA GPUs |
| `PQ2_0` | 6.76 GiB / 6.98 GiB | ~2.00 bpw | PrismML llama.cpp fork; benchmarked packing for Apple Silicon Metal and MLX export |
| `Q2_0` | 7.15 GiB / 7.37 GiB | ~2.00 bpw | Stock upstream llama.cpp b11556+ (#29600); also tested on Hexagon NPU |
| `mmproj-BF16` / `Q8_0` | 0.87 GiB / 0.59 GiB | 16 / 8 bpw | Optional decoupled vision projector; omitted for text-only serving to save VRAM |
Stock llama.cpp Build Requirement for Q2_0
Q2_0 weights require upstream llama.cpp release b11556 or newer (which merged the FWHT activation runtime). Older stock builds load Q2_0 silently without errors and emit corrupted tokens. PTQ1_0 and PQ2_0 require binaries from the PrismML-Eng/llama.cpp fork.
Agentic Tool Calling, Coding & General Capability Benchmarks
Evaluated in thinking mode at default xhigh reasoning effort (temperature=1.0, top_p=0.95, top_k=20, min_p=0.0), Ternary Bonsai 2.5 27B averages 77.2 across five tool-calling benchmarks versus 77.7 for 53.8 GB Qwen3.8 FP16, and recovers 90% of FP16 agentic coding capability across Terminal-Bench 2.1, SWE-bench Verified, and DeepSWE.
Conventional sub-3-bit GGUF baselines suffer catastrophic trajectory collapse on multi-step APIs even when single-turn benchmarks look acceptable. For example, GSQ-RCO IQ2_XS (8.4 GB, 1.4x larger than Bonsai 2.5) scores 79.5 on tau2-Bench yet crashes to 46.5 on AppWorld because it frequently fabricates long scripts guessing API calls without waiting for tool output. Bonsai 2.5 eliminates that failure mode, finishing complete AppWorld scenarios 89.3% of the time (versus 80.4% for 10.1 GB IQ3_XXS and 75.0% for IQ2_S).
Agentic Tool Calling & Coding Comparison (Under 10.1 GB)
| Benchmark Suite | Qwen3.8 FP16 (53.8 GB) | GSQ-RCO IQ3_XXS (10.1 GB) | GSQ-RCO IQ2_S (9.3 GB) | Unsloth UD-IQ2_XS (7.6 GB) | Bonsai 2 27B (5.93 GB) | Bonsai 2.5 27B (5.93 GB) |
|---|---|---|---|---|---|---|
| tau2-Bench | 80.6 | 77.7 | 78.8 | 82.0 | 80.2 | 82.0 |
| tau3-Bench | 72.8 | 70.7 | 69.6 | 67.2 | 69.1 | 73.9 |
| BFCL v3 (native) | 71.2 | 71.6 | 71.8 | 71.5 | 70.3 | 72.6 |
| BFCL v4 | 70.8 | 70.6 | 67.7 | 66.2 | 64.4 | 67.2 |
| AppWorld | 93.2 | 86.1 | 82.8 | 89.6 | 51.2 | 90.5 |
| Tool Calling Avg (5) | 77.7 | 75.3 | 74.1 | 75.3 | 67.0 | 77.2 |
| Terminal-Bench 2.1 | 70.8 | 66.3 | 59.6 | 53.9 | 52.8 | 60.1 |
| SWE-bench Verified | 80.6 | 73.2 | 75.4 | 71.8 | 60.8 | 75.6 |
| DeepSWE | 30.1 | 27.0 | 22.6 | 17.7 | 0.0 | 27.0 |
| Agentic Coding Avg (3) | 60.5 | 55.5 | 52.5 | 47.8 | 37.9 | 54.2 |
General Capability Retention (16 Benchmarks Across 5 Categories)
Across 16 non-agentic evaluations in thinking mode, Bonsai 2.5 averages 82.12 against 84.32 for FP16—outperforming IQ3_XXS (81.72), IQ2_S (80.58), UD-IQ2_XS (77.45), and Bonsai 2 (81.55):
- Knowledge & Reasoning (`84.27` vs `86.67` FP16): MMLU-Redux
89.1, GPQA Diamond87.7, AA-LCR76.0. - Math (`90.10` vs `93.15` FP16): AIME26
94.2, HMMT2686.0—ahead of every conventional compressed build. - Single-Turn Coding (`71.65` vs `74.55` FP16): LiveCodeBench v6
83.0, BigCodeBench60.3. - Instruction Following (`80.90` vs `81.15` FP16): IFBench
71.0, IFEval90.8. - Multimodal Vision (`83.66` vs `86.07` FP16): OmniDocBench v1.6
90.1, A-OKVQA88.6, MathVision84.5, RealWorldQA81.7, CharXiv81.6, HallusionBench81.5, MMMU-Pro77.6.
MTP Speculative Decoding, Kernel Throughput & Hardware Benchmarks
Ternary Bonsai 2.5 -mtp.gguf checkpoints bundle a lightweight single-layer Multi-Token Prediction (MTP) draft head that predicts 1–3 candidate tokens per step and verifies them in one target forward pass. Across 36 real-world agent, code, and reasoning prompts in llama-server, MTP delivers a 1.5x to 1.83x decode speedup on NVIDIA GPUs (up to 312 tok/s on RTX 5090 and 309 tok/s on B200) and 1.1x to 2.21x on Apple Silicon and laptop GPUs.
Because speculative verification accepts only tokens the target model would have sampled natively, output distributions remain mathematically aligned: on an NVIDIA H200 running PTQ1_0 with MTP (3, 0.1), mean KL divergence against un-drafted decoding measured just 5.2 × 10^-5. While the draft head adds a 9%–23% prefill pass overhead on stock release binaries, PrismML’s testing kernels eliminate that penalty and push 2K-prompt prefill rates above plain decoding on every NVIDIA GPU.
Plain Decoding vs MTP Speculative Throughput (Tokens/s)
| Device / Accelerator | Packing | Plain Decode (tg128) | MTP Decode (Release / +Kernels) | MTP Settings (n_max, p_min) | Speedup vs Bonsai 2 Launch |
|---|---|---|---|---|---|
| NVIDIA B200 | PTQ1_0 | 192 tok/s | 296 / 309 tok/s | 3, 0.1 | 2.98x (104 -> 309) |
| NVIDIA H200 | PTQ1_0 | 189 tok/s | 296 / 306 tok/s | 3, 0.1 | 2.69x (114 -> 306) |
| NVIDIA H100 | PTQ1_0 | 186 tok/s | 282 / 291 tok/s | 3, 0.1 | 2.60x (112 -> 291) |
| NVIDIA RTX 5090 | PTQ1_0 | 163 tok/s | 305 / 312 tok/s | 3, 0.1 | 2.31x (135 -> 312) |
| NVIDIA RTX PRO 6000 | PTQ1_0 | 158 tok/s | 277 / 283 tok/s | 3, 0.1 | 2.36x (120 -> 283) |
| NVIDIA RTX 4090 | PTQ1_0 | 112 tok/s | 204 / 204 tok/s | 3, 0.0 | 1.92x (106 -> 204) |
| NVIDIA A100 | PTQ1_0 | 107 tok/s | 171 / 175 tok/s | 3, 0.1 | 2.39x (73 -> 175) |
| Apple M5 Pro / M4 Pro | PQ2_0 | 30.2 (M5 Pro) | 25.3 / 29.2 tok/s (M4 Pro) | 1, 0.6 | 1.44x (20.3 -> 29.2) |
| Core Ultra Laptop (SYCL) | PTQ1_0 | – | 23.1 / 24.5 tok/s | 8, 0.6 | 2.00x (11.5 -> 22.9) |
| Galaxy S26 Ultra (NPU) | Q2_0 | – | 8.79 tok/s (unreleased fix) | 1, 0.0 | Edge NPU baseline |
On Apple Silicon, PQ2_0 on the PrismML llama.cpp Metal fork (30.2 tok/s decode, 416 tok/s pp512 prefill on M5 Pro) also outpaces the exported 2-bit MLX build (Ternary-Bonsai-2.5-27B-mlx-2bit at 21.7 tok/s decode and 348 tok/s prefill).
Local Serving Commands, VRAM Slot Tuning & Sampling Controls
Deploying Ternary Bonsai 2.5 27B locally requires matching the GGUF packing to your accelerator (PTQ1_0 for NVIDIA CUDA, PQ2_0 for Apple Metal, Q2_0 for upstream llama.cpp b11556+), passing --min-p 0 explicitly, and setting -np 1 on 8 GB–12 GB GPUs to prevent multi-slot KV cache OOM.
Memory & Parallelism Trap on 10 GB GPUs
By default, llama-server auto-allocates four request slots sharing a unified KV cache. On a 10 GB NVIDIA RTX 3080 running desktop compositing, automatic parallelism pushes total GPU memory consumption to 9.5 GB, risking out-of-memory eviction during multi-turn tool trajectories. Passing -np 1 locks the server to a single slot and drops total GPU memory usage to 7.8 GB.
Sampling & Reasoning Effort Configuration
- Thinking Mode (Default for Coding & Tool Agents): Use
temperature=1.0,top_p=0.95,top_k=20,min_p=0.0,presence_penalty=0.0,repetition_penalty=1.0. Pass--min-p 0explicitly becausellama.cppdefaults tomin_p=0.05. Allocate-n 16384and-c 32768(up to262144) soxhighreasoning traces do not truncate mid-thought. - Instruct / Non-Thinking Mode: For fast deterministic routing subagents, set
temperature=0.7,top_p=0.80,top_k=20,min_p=0.0,presence_penalty=1.5. - Reasoning Effort Granularity: Defaults to
xhighfor peak coding accuracy; setmediumto shorten traces. Note thatlowreasoning effort is not supported and falls back nearxhighbehavior.
Reproducible Serving Commands (CUDA, Apple Metal & Upstream Q2_0)
# 1. Download NVIDIA PTQ1_0 + MTP checkpoint and CUDA preset
hf download prism-ml/Ternary-Bonsai-2.5-27B-GGUF \
Ternary-Bonsai-2.5-27B-PTQ1_0-mtp.gguf \
presets/llama.cpp/mtp-cuda.json --local-dir .
# Inspect verified profile flags for datacenter / RTX 5090 GPUs
jq -r '.profiles[] | select(.id == "cuda-datacenter-and-blackwell") | .released_build.command' presets/llama.cpp/mtp-cuda.json
# 2. Launch PrismML llama-server on CUDA with MTP speculative decoding & single-slot VRAM cap
./bin/llama-server -m Ternary-Bonsai-2.5-27B-PTQ1_0-mtp.gguf \
-ngl 99 -fa on -c 32768 -np 1 --jinja \
--spec-type draft-mtp --spec-draft-n-min 0 --spec-draft-n-max 3 --spec-draft-p-min 0.1 \
--temp 1.0 --top-p 0.95 --top-k 20 --min-p 0 --port 8080
# 3. Apple Silicon Metal alternative (PQ2_0 + MTP)
hf download prism-ml/Ternary-Bonsai-2.5-27B-GGUF Ternary-Bonsai-2.5-27B-PQ2_0-mtp.gguf --local-dir .
./bin/llama-server -m Ternary-Bonsai-2.5-27B-PQ2_0-mtp.gguf \
-ngl 99 -fa on -c 32768 -np 1 --jinja \
--spec-type draft-mtp --spec-draft-n-min 0 --spec-draft-n-max 1 --spec-draft-p-min 0.6 \
--temp 1.0 --top-p 0.95 --top-k 20 --min-p 0 --port 8080
# 4. Stock upstream llama.cpp (requires release b11556+ for FWHT kernels)
llama-cli --version
llama-server -hf prism-ml/Ternary-Bonsai-2.5-27B-GGUF:Q2_0 \
-ngl 99 -fa on -c 32768 -np 1 --jinja \
--temp 1.0 --top-p 0.95 --top-k 20 --min-p 0 --port 8080CUDA Toolkit Requirement for Blackwell GPUs
PrismML released CUDA 12.4 binaries for Hopper/Ampere/Ada GPUs, whereas Blackwell GPUs (NVIDIA B200, RTX PRO 6000, and RTX 5090) require the PrismML llama.cpp release compiled with CUDA 12.8.
Orchestrating Ternary Bonsai 2.5 Agents in Smoke Monkey Harness & Canvas
Smoke Monkey Harness connects directly to llama-server on http://127.0.0.1:8080/v1, pairing Ternary Bonsai 2.5 27B’s 77.2 tool-calling fidelity and 262K context with a deterministic 6-phase engineering state machine (Explore -> Plan -> Edit -> Verify -> Recover -> Complete) and zero-cloud-lock-in MCP execution.
Because sub-6 GB weights leave ample headroom on 16 GB–24 GB developer workstations or M4/M5 MacBooks, teams can run autonomous multi-agent loops entirely offline without leaking repository ASTs or credentials to external APIs:
- Permission-Gated Tool Groups: Configure
@smoke-monkey/harnesswithpermission: "ask-default"so read-onlyfilesystem,search, andgitinspection tools run autonomously while mutating shell commands pause atpermission.requiredfor operator approval. - Visual Multi-Agent Routing on Canvas: Launch
npx @smoke-monkey/canvas startto pair abuildagent backed byPTQ1_0-mtpon a local GPU node with specialized MCP servers (GitHub, Postgres, Playwright) and live phase telemetry. - Context Compaction Across Long Horizons: With native 262K context support and automatic token-budget compaction inside
@smoke-monkey/harness, agents sustain 100+ tool-call debugging episodes without losing session state.
Frequently Asked Questions
Q:Can I run Ternary Bonsai 2.5 27B on stock upstream llama.cpp?
Yes, using the Ternary-Bonsai-2.5-27B-Q2_0.gguf (or -mtp) file on upstream llama.cpp release b11556 or newer, which merged PR #29600 and the blockwise Fast Walsh-Hadamard (FWHT) kernels. Older stock builds load Q2_0 silently and produce garbage output. The smaller 5.93 GB PTQ1_0 and Apple Metal PQ2_0 packings currently require the PrismML-Eng/llama.cpp fork.
Q:Which packing should I pick: PTQ1_0, PQ2_0, or Q2_0?
Pick PTQ1_0 (5.58 GiB / 1.76 bpw) for NVIDIA CUDA GPUs, where it achieves the fastest decode across H200, H100, B200, RTX 5090, and RTX 4090. Pick PQ2_0 (6.76 GiB) on Apple Silicon Metal, where it hits 30.2 tok/s on M5 Pro and 29.2 tok/s with MTP on M4 Pro. Pick Q2_0 (7.15 GiB) only when you must run unmodified upstream llama.cpp b11556+.
Q:Why does llama-server use 9.5 GB VRAM on a 10 GB GPU and how do I fix it?
In automatic mode, llama-server initializes four parallel request slots sharing a unified KV cache, pushing total GPU memory on a 10 GB RTX 3080 to ~9.5 GB. Adding -np 1 restricts the server to one request slot and lowers total VRAM usage to ~7.8 GB including desktop display overhead.
Q:How fast is MTP speculative decoding on Ternary Bonsai 2.5 27B?
The -mtp.gguf variants include a Multi-Token Prediction draft head that accelerates real-prompt decode by 1.5x–1.83x on NVIDIA GPUs (reaching 312 tok/s on RTX 5090, 309 tok/s on B200, and 306 tok/s on H200 with 5.2e-5 KL divergence) and 1.27x on Apple M4 Pro (29.2 tok/s).
Q:How does Ternary Bonsai 2.5 27B compare to Bonsai 2 and IQ2/IQ3 GGUFs?
While keeping the exact 5.93 GB size of Bonsai 2, Bonsai 2.5 raises average tool-calling score from 67.0 to 77.2 (virtually matching 53.8 GB FP16 at 77.7) and agentic coding average from 37.9 to 54.2 (90% of FP16), jumping from 0.0 to 27.0 on DeepSWE and 51.2 to 90.5 on AppWorld while beating larger IQ2_S and IQ3_XXS builds on tool use.
Q:How do I wire Ternary Bonsai 2.5 27B into Smoke Monkey Harness?
Start llama-server with --jinja, --min-p 0, and your hardware MTP flags on port 8080, then initialize createAgent from @smoke-monkey/harness with provider: "openai", baseUrl: "http://127.0.0.1:8080/v1", model: "Ternary-Bonsai-2.5-27B-PTQ1_0-mtp", and your workspacePath and MCP server configurations.
Related Alternatives & Comparisons
Claude Code Runtime Alternative: Open Source Stdio MCP Agent Harness
Openai Codex Alternative Open Source: Free Open Source AI Agent & Runtime (2026)
9 Best Free Open Source ChatGPT Alternatives in 2026 (Self-Hosted & Local)
LangChain TypeScript Alternative: Zero Dependencies & Deterministic Loops
Related Architecture Guides
View all guidesBest Open Source Coding Agents in 2026: Free, Local & Fully Hackable Harnesses
MCP Server Security Best Practices: Hardening Model Context Protocol Agents in 2026
Open Source Coding Agent Harness: Build a Forkable, Local AI Engineering Runtime
Build with Smoke Monkey Harness
Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.