Prism ML Website |
White Paper |
Demo & Examples |
Discord
Ternary-Bonsai-4B-gguf
Ternary (1.58-bit) language model in GGUF Q2_0 format for llama.cpp
Resources
- White Paper
- Demo repo — examples for serving, benchmarking, and integrating Bonsai
- Discord — community support and updates
- Kernels: Q2_0 is not yet in mainline
llama.cpp. Use our fork at PrismML-Eng/llama.cpp (prism branch, default) which adds Q2_0 support for CPU (NEON/generic) and Metal. Upstream PR coming soon.
Model Overview
Quantization Format: GGUF Q2_0 (g128)
Each weight takes a value from {-1, 0, +1}, with one shared FP16 scale per group of 128 weights:
Q2_0 encodes each weight as a 2-bit code q in {0, 1, 2, 3}, dequantized via w = (q - 1) * scale. One 128-element block is 34 bytes (2 bytes FP16 scale + 32 bytes of packed 2-bit codes) for an effective 2.125 bits/weight. The fourth code point (q = 3, reconstructing to +2 * scale) is reserved for future extensions; for ternary weights it is unused.
Memory
Files in this repo
Quickstart
Build from the Prism fork
llama.cpp CLI
llama.cpp server
Throughput (llama.cpp, Apple M4 Pro 48 GB)
Flags: -ngl 99 -fa 1 for Metal; -ngl 0 -fa 1 -t 10 for CPU.
Fidelity (Q2_0 vs FP16 baseline)
Q2_0 is effectively lossless for ternary weights — the ternary values land exactly on three of the four 2-bit code points, so quantize/dequantize is bit-exact in the absence of FP16 scale rounding.
Benchmarks
Evaluated with EvalScope v1.4.2 + vLLM 0.15.1 on NVIDIA H100. Full benchmark suite:
Intelligence Density
Citation
Contact
For questions, feedback, or collaboration inquiries: contact@prismml.com