← Back to Leaderboard
BPrismML-Eng

PrismML-Eng/Bonsai-demo

Quantized Bonsai LLMs for local inference with llama.cpp and MLX

Open-Weight ModelQuickstart ↓
Engineering Health (Methodology)
A · 85/100
Maintenance Activity
● Updated 2d ago
Latest Release
Rolling commits (main)
Commercial License Check
Apache-2.0 · Commercial Friendly

Automated SPDX check for reference only — not legal advice. Disclaimer

Maintenance35/35
Fork Adoption19/25
Release Cadence11/20
License Clarity20/20
Local AIGPUCLI
Total Stars
★ 3,723
24h Growth
+5
7d Growth
+98
Forks
439

GitHub Star History

Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.

PrismML-Eng/Bonsai-demo Star History (2026-03-25 - 2026-12-04) ALL-TIME STAR HISTORY (2026-03 – 2026-12) +3.7k in 254d · avg +15/day 3.9k 2k 0 2026-03-25: ★ 12026-04-11: ★ 4512026-05-02: ★ 7482026-05-23: ★ 7992026-06-13: ★ 8462026-07-04: ★ 8622026-07-25: ★ 2,0032026-08-15: ★ 2,1862026-09-05: ★ 2,2402026-09-26: ★ 3,1082026-10-17: ★ 3,3752026-11-02: ★ 3,4692026-11-18: ★ 3,5272026-12-04: ★ 3,723 ★ 3.7k 2026-03 2026-07 2026-12

Evidence-Backed Technical Brief

AI Deep Review

Architecture & Core Mechanics

Bonsai-demo is a setup and launch layer for quantized model checkpoints, not an inference engine. setup.sh and setup.ps1 prepare the environment, fetch checkpoints from Hugging Face, and install a matching llama.cpp runtime. The scripts in scripts/ expose both one-shot CLI inference and a persistent local server. On Apple Silicon, the Bonsai 2 MLX path uses the native loader in mlx-vlm==0.7.8, with mlx-lm==0.32.0 pinned alongside it; the tested mlx-lm version does not load the current prism_hadamard_qwen35 checkpoints directly.

The Python project declares no packages of its own. Its Python 3.11–3.12 environment uses huggingface-hub, certifi, cmake, ninja, and setuptools for setup and build tooling. At the application boundary, the model returns structured OpenAI-style tool_calls; the client or UI runs the tool and passes the result back. The demo UIs support MCP, while the optional Open WebUI integration pins 0.10.2 for its tool-call iteration cap. The full UI stack is not required for CLI or server inference.

Key Capabilities & Differentiators

The default is Bonsai 2.5 27B; Bonsai 2 offers 2B, 4B, 9B, and 27B checkpoints in GGUF and MLX. The GGUF route covers Metal on Mac, CUDA/Vulkan/ROCm on supported Linux and Windows configurations, and CPU execution. Bonsai 2.5 retains vision, thinking, native tool calls, and a 262K-token context ceiling. Its MLX pack is text-only, so use llama.cpp for Bonsai 2.5 image input, or Bonsai 2 if vision must run on MLX.

On the PrismML llama.cpp path, the default Bonsai 2.5 download has a built-in multi-token-prediction (MTP) draft head. The runtime enables drafting automatically on CUDA-class GPUs and Metal; the reported NVIDIA gain is 1.5–1.8× in decoding, not end-to-end request latency. The 27B thinking profile defaults to xhigh; medium is the shorter option. Bonsai 2 2B/4B/9B use a distinct sampling profile with min_p=0 and a 64-token presence-penalty window, so clients should not copy the Bonsai 2 27B settings across sizes.

Trade-offs & Limitations

Choose stock llama.cpp b11556 or newer with official Q2_0 when upstream compatibility matters more than access to PrismML-specific formats and drafting. Older engines can recognize the format without implementing the required Hadamard transforms. The fork supports PTQ1_0 and PQ2_0; for Bonsai 2 27B, PQ2_0 trades about 1.3 GB of additional storage for faster prompt processing. A desktop frontend that imports GGUF is not necessarily compatible: it depends on the engine and loader it bundles.

Local inference removes the hosted model API dependency, but the operator still owns GPU memory, context sizing, and concurrency. Checkpoint and download sizes are not peak VRAM figures. Start with one request slot (-np 1) on a tight GPU budget, then measure with representative context lengths before increasing parallelism. BONSAI_CTX and optional 4-bit KV cache are separate memory controls; the 262K model ceiling is not a sensible default for every machine. The repo's Apache-2.0 license covers demo code; assess model and dependency terms separately.

Hardware & Deployment Guide

Use ./setup.sh on macOS/Linux or setup.ps1 on Windows. The shell setup uses uv and Python 3.11–3.12; it checks macOS Xcode Command Line Tools or Linux build prerequisites and fetches model files and pinned PrismML binaries (prism-b12220-41c86f7), with a source-build option. For Bonsai 2.5 27B, plan for about 7.6 GB for the PQ2_0 setup download on most backends, including the draft head and vision projector, or about 6.4 GB for the CUDA-class PTQ1_0 path. Open WebUI and the interpreter add several GB; set BONSAI_OPENWEBUI=0 and BONSAI_CODE_INTERPRETER=0 before setup to omit them.

After downloads, local inference runs without a hosted model API. Start ./scripts/start_llama_server.sh for the loopback service at http://localhost:8080, use ./scripts/run_llama.sh for a one-shot prompt, or use ./scripts/start_mlx_server.sh for the MLX server. Keep the default 127.0.0.1 binding unless remote access is intentional and protected. The concrete upstream compatibility milestone is llama.cpp b11556, which merged the model and Hadamard integration for Q2_0; it is not a release of Bonsai-demo itself.

Model selection: Bonsai 2.5 27B is the setup default; BONSAI_MODEL selects Bonsai 2 at 2B, 4B, or 9B, and BONSAI_FAMILY=bonsai2 selects the earlier 27B.
Engine compatibility: Official Q2_0 needs upstream llama.cpp b11556 or newer; PQ2_0, PTQ1_0, and built-in Bonsai 2.5 MTP use the PrismML fork.
Speculative decoding: Setup fetches a *-mtp.gguf build; drafting is enabled by default on CUDA-class GPUs and Metal and can be disabled with BONSAI_SPECULATIVE=0.
Vision support: Bonsai 2.5 takes images through llama.cpp, but its MLX pack is text-only; Bonsai 2 provides an MLX vision path.
Memory controls: BONSAI_CTX sets context length, BONSAI_KV4=1 enables a 4-bit KV cache, and -np 1 limits llama-server to one request slot.
Integration: The local server supports OpenAI-style tool_calls; the demo UIs support MCP, and the optional Open WebUI integration is pinned to 0.10.2.
Best For

Teams evaluating local text, image, or tool-calling workflows that want a CLI and a loopback API, with the option to start at 2B/4B/9B before sizing a 27B deployment.

Skip If

You need a managed concurrency SLA, must use an older bundled engine, or require image input specifically from Bonsai 2.5 on MLX.

Reviewed on 2026-12-02 · Grounded in GitHub README, root file tree & releasesMethodology

Quick Start & Installation

Local AIGPUCLI
export BONSAI_MODEL=4B    # 2B, 4B, or 9B (Bonsai 2); add BONSAI_FAMILY=bonsai2 for its 27B
./setup.sh
./scripts/start_llama_server.sh

AI Context Briefing (for Claude / Cursor / Windsurf)

Standardized architecture summary & quickstart commands ready to paste into coding agents.

Raw .md ↗
curl -sL https://repoforai.com/repo/PrismML-Eng/Bonsai-demo.md

Embed Star History Chart & Badges in README.md

Full-history Star History SVGs and velocity cards on GitHub Camo: drop-in replacement for OSSInsight and Star History widgets.

PrismML-Eng/Bonsai-demo Star History on RepoForAI

Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).

Frequently Asked Questions about Bonsai-demo

How should an application integrate with Bonsai?

Use the local llama.cpp server when a client needs chat, vision, or OpenAI-style tool calls. A custom client must execute the requested tool and send its result back to the model. Do not assume server flags and API fields match across backends: MLX uses thinking_budget, whereas llama-server uses thinking_budget_tokens.

Does the smaller CUDA download mean Bonsai 2.5 fits in 8 GB of VRAM?

No. The roughly 6.4 GB CUDA-class setup download is not a VRAM requirement. Budget separately for weight offload, runtime buffers, and the KV cache; context length and concurrent requests affect the working set. One RTX 3080 10 GB user reported total GPU use falling from about 9.5 GB to 7.8 GB with -np 1, including desktop usage. Treat that as one configuration, not a minimum or guarantee.

Can we self-host or redistribute the stack commercially?

The demo repository is Apache-2.0, which permits commercial use of the repository code subject to the license terms. Verify the terms of the exact Hugging Face checkpoint, runtime binaries, and optional components separately before commercial use or redistribution. Self-hosting also does not keep tool traffic local if a configured MCP server or other tool sends data elsewhere.

When is stock llama.cpp preferable to the demo's default runtime?

Choose stock llama.cpp b11556 or newer with Q2_0 if you already maintain an upstream deployment and do not need PrismML's drafting path. Use the PrismML fork for PQ2_0, PTQ1_0, or the built-in Bonsai 2.5 MTP head. In a desktop app, verify the bundled engine and loader version; a GGUF import option by itself is not enough.

Upstream README & Documentation

This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.

Maintaining PrismML-Eng/Bonsai-demo? Pin to Homepage + competitor /alternatives pages with a custom Cloud/Demo CTA.Feature PrismML-Eng/Bonsai-demo on Homepage & Alternatives ($19)
WEEKLY BREAKOUT DIGEST

Top 10 Breakout Open-Source AI Repos, Every Thursday

Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.

Zero spam · 1-click unsubscribe · Privacy Policy

Saved in your browser · Export Markdown RFC tables or jump into /vs compare