whatisgithub

What is bonsai-demo?

prismml-eng/bonsai-demo — explained in plain English

Analysis updated 2026-05-18

1,941ShellAudience · developerComplexity · 3/5Setup · moderate

In one sentence

Bonsai Demo runs a family of extremely compressed 1-bit and 2-bit AI language models locally on Mac, Windows, Linux, or even a phone.

Mindmap

mindmap
  root((bonsai demo))
    What it does
      Runs compressed LLMs locally
      Vision language model
      Agentic tool calling
      Long context chat
    Tech stack
      llama.cpp
      MLX
      GGUF formats
      CUDA Metal Vulkan
    Use cases
      Local chat server
      Image and PDF Q and A
      Benchmark comparisons
    Model sizes
      27B vision model
      8B and 4B
      1.7B tiny model

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Run a large vision-capable language model locally on a Mac, PC, or CPU-only machine.

USE CASE 2

Chat with images, screenshots, or PDFs using the 27B vision-language model.

USE CASE 3

Compare speed benchmarks across the 1-bit Bonsai and 2-bit Ternary-Bonsai model families.

What is it built with?

Shellllama.cppMLXGGUFCUDA

How does it compare?

prismml-eng/bonsai-demogithub/hubot-sansruanyf/simple-bash-scripts
Stars1,9411,9511,919
LanguageShellShellShell
Last pushed2024-10-172025-01-15
MaintenanceStaleStale
Setup difficultymoderateeasyeasy
Complexity3/51/51/5
Audiencedeveloperdesignervibe coder

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

27B model downloads currently require a free Hugging Face token while its repos are private.

No license file referenced in the README excerpt.

So what is it?

Bonsai Demo is a repository that lets you run a family of extremely compressed AI language models on your own computer, whether that is a Mac, a Windows or Linux machine with a graphics card, or just a regular CPU. The models come in two flavors: a one bit family called Bonsai, and a slightly less compressed two bit family called Ternary-Bonsai, each available in several sizes from 1.7 billion up to 27 billion parameters. The newest and largest version, Bonsai 27B, is also the first in the family that can understand images. You can send it photos, screenshots, or PDF files and ask questions about them, not just plain text. It also supports agentic tool calling, meaning the model can request that external tools be run and receive their results back in the same conversation, and it works as a reasoning model where you can choose how much extra thinking effort it spends on a given request. It can also hold very long conversations, well beyond a quarter million tokens. What makes this project notable is how small the compressed models are. The one bit version of Bonsai 27B is squeezed down to a little over one bit per weight, small enough to run entirely on a modern iPhone without needing to swap data in and out of memory. The two bit Ternary version trades a bit of that compactness for higher quality, and is the version this demo downloads and runs by default. Getting started takes just two commands. Cloning the repository and running a single setup script downloads the necessary model files and supporting programs automatically, and a second script starts a local web server you can chat with, complete with support for images and tools, right in your browser. Environment variables let you pick a different model family or size before running the setup, and downloading the largest model currently requires a free Hugging Face account token since those particular files are not yet fully public. The underlying model formats are also being merged into the widely used llama.cpp project, with the one bit format already fully supported there and the two bit format working across several hardware backends. A folder of community submitted speed benchmarks is included so you can compare how the models perform on different machines.

Copy-paste prompts

Prompt 1
Walk me through running ./setup.sh to download and start Ternary-Bonsai-27B locally.
Prompt 2
Explain the difference between the 1-bit Bonsai and 2-bit Ternary-Bonsai model families.
Prompt 3
How do I switch BONSAI_FAMILY and BONSAI_MODEL to run the 4B model instead of 27B?
Prompt 4
Describe how Bonsai 27B handles image and PDF inputs alongside text in a chat.

Frequently asked questions

What is bonsai-demo?

Bonsai Demo runs a family of extremely compressed 1-bit and 2-bit AI language models locally on Mac, Windows, Linux, or even a phone.

What language is bonsai-demo written in?

Mainly Shell. The stack also includes Shell, llama.cpp, MLX.

What license does bonsai-demo use?

No license file referenced in the README excerpt.

How hard is bonsai-demo to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is bonsai-demo for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.