ruihe774

Bonsai Pot — AI skill for Claude Code

AI community

From-scratch, dependency-light LLM inference engines for the Bonsai model family, running on wgpu compute shaders.

How to install Bonsai Pot

This entry records only its repository, not the path inside it, so there is no exact command to give. Open ruihe774/bonsai-pot and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Bonsai Pot does

From-scratch, dependency-light LLM inference engines for the Bonsai model family, running on wgpu compute shaders.

Alternatives in AI

  • Inference Serving — ai-research-skills vLLM, SGLang, TensorRT-LLM, llama.cpp 5.4k ★
  • Deepreasoning — A high-performance LLM inference API and Chat UI that integrates DeepSeek R1's CoT reasoning traces with Anthr 5.4k ★
  • Vllm Mlx — High-performance OpenAI and Anthropic compatible LLM inference server for Apple Silicon 1.5k ★

README

bonsai-pot

From-scratch, dependency-light LLM inference engines for the **Bonsai** model family, running on **wgpu compute shaders**. This repository is a Cargo workspace with two independent crates, one per model generation:

Crate Models Quantization Backends Docs
`bonsai-pot` Bonsai 4B / 8B (Qwen3 architecture) Q1_0 (binary), Q2_0 (ternary), Q8_0 Vulkan, Metal README · CLAUDE.md
`bonsai2-pot` Ternary-Bonsai-2-27B (Qwen3.5 hybrid attention) PTQ1_0 (1.75 bits/weight) Vulkan README · CLAUDE.md

Pick the crate that matches your model; the two do not depend on each other and use different weight layouts, so a model directory produced for one is not valid for the other.

Highlights

  • Weights are never dequantized. Packed weights are consumed directly by the matvec/matmul kernels, with no intermediate FP16 weight tensor.
    • bonsai-pot: Q1_0 is one sign bit selecting +x / -x, Q2_0 a 2-bit ternary code, and Q8_0 an i8 fed to dot4I8Packed. One FP16 scale multiply closes each 128-weight block, so the inner loop has zero float multiplications per weight.
    • bonsai2-pot: PTQ1_0 packs five base-3 trits per byte. Decode matvec unpacks trits on the fly and uses dotPacked4x8EXT against Q8 activations. Prefill decodes each tile once into workgroup memory and multiplies with int8 cooperative matrices (WMMA), falling back to DP4a.
  • No llama.cpp, ggml or PyTorch on the hot path. Weights come from a flat-file layout produced from a GGUF by scripts/extract.py, every kernel is hand-rolled GLSL compiled to SPIR-V at build time, and the host side is plain Rust + wgpu.
  • Fast on consumer GPUs, with realistic numbers. End-to-end throughput includes stochastic sampling and encode pipelining, not just bare-forward microbenchmarks.
    • bonsai-pot on an RX 9070: Bonsai-