Skip to main content
llama.cpp is the reference runtime for Bonsai 2 GGUF weights. It runs on CPU and every major GPU backend (CUDA, Metal, Vulkan, ROCm, SYCL).
Bonsai 2 support is merged in upstream llama.cpp: builds from b11555 onward run the Q2_0 packing. The PQ2_0 and PTQ1_0 packings and the MTP and DFlash2 drafters need the PrismML binaries, which are upstream plus those kernels. Builds older than b11555 load Q2_0 and output gibberish. See Formats & runtime support.

Get a binary

The demo repo’s setup.sh downloads a tested PrismML build into bin/. To grab one yourself, pick your platform’s archive from the latest PrismML release; the variant list is in Formats & runtime support. For Q2_0 files only, any upstream release from b11555 works too.

Run a chat

  • Always pass an explicit -c. Bare -c 0 uses the model’s full training context (262K) regardless of available memory and can exhaust it; the demo scripts pick a RAM-tiered default instead. The FP16 KV cache costs 64 KiB per token on the 27B.
  • The sampling flags are each model’s recommended thinking-mode settings. The small models want a presence penalty; the 27B does not. The non-thinking sets are on the model pages (27B, 9B).
  • -n 16384 leaves room for the thinking trace. A small cap ends generation mid-thought, before any answer.
  • -ngl 99 offloads all layers to the GPU; 0 is CPU-only. The demo scripts set this automatically.
  • --mmproj enables image input, and --jinja enables native OpenAI-style tool_calls on the server. The demo’s server launcher passes both.
The demo repo wraps all of this:

Start a server

This is the OpenAI-compatible endpoint described in Run the server, which also documents the demo launcher’s flags. To serve without thinking, start with the non-thinking sampling and send "chat_template_kwargs": {"enable_thinking": false} with each request.

Speculative decoding

The 9B and 4B GGUF repos ship two optional drafters; both need the PrismML binaries. MTP is the recommended one: *-PQ2_0-MTP-Q8_0.gguf is the PQ2_0 model with its multi-token-prediction head built in. Load it instead of the plain file, with draft depth 2:
DFlash2 (*-DFlash2-*.gguf, passed with -md <file> -ngld 99 --spec-type draft-dflash) helps on copy-heavy work such as code edits and is slower than plain decoding on general chat. The 2B ships no drafter: at that size plain decoding is already faster. Details, including the CUDA KV-cache caveat, are on each model page (9B, 4B) and in SPECULATIVE.md.

Build from source

If the pre-built binaries don’t cover your platform or you want a specific backend:
The demo repo also has ready-made build scripts: scripts/build_mac.sh, scripts/build_cpu_linux.sh, scripts/build_cuda_linux.sh, and scripts/build_cuda_windows.ps1.
Building with CUDA is memory-hungry. The build scripts cap parallelism at -j 2 when they detect less than 16 GB of GPU VRAM. Building by hand on a low-VRAM machine, reduce -j yourself.