OpenBonsai
Research preview
Open research in ternary compression.
An open framework that compresses a dense language model, or your own fine-tune of one, to ternary weights in the Bonsai format. Qwen3.5-9B becomes a 2 GB file that runs in Prism's llama.cpp.
Explore on GitHub Qwen3.5-9B model on Hugging FaceHow it works
Four stages turn a BF16 model into ternary weights, then one export writes Prism's PTQ1_0 GGUF.
- Rotate. A signed Hadamard rotation in Prism's layout spreads large weights across each block, so three levels fit them better.
- Round. Sequential GPTQ rounds every large linear layer, the embedding and head included, to −1, 0 or +1 with one scale per 128 weights, on calibration data that includes the model's own answers.
- Refine. ScaleQ/CAT-Q refinement. Research only for now: it has not yet beaten GPTQ plus distillation, so the default pipeline skips it.
- Distill. The codes stay fixed while every scale is trained against the original model's predictions. On Qwen3.5-9B this closes more than half of the gap to the original on our small dev suite (dev NLL 3.48 → 2.89; original 2.42).
Measured end to end on Qwen3.5-9B with the research scripts the package ports, and reproduced by the package's own end-to-end run. Qwen3-8B has also been compressed and measured, through the generic dense adapter; other dense models (Llama, Mistral, Qwen2) have been tested only on tiny random models so far. Calibrated on its own answers to math and code training prompts, with extra code, the Qwen3.5-9B model on Hugging Face scores 65/100 on a GSM8K subset and 34/50 on HumanEval with thinking off, against 77/100 and 45/50 for Prism's Ternary Bonsai 2 9B (with thinking on, the chat template's default: 32/50 and 14/25, against 46/50 and 24/25). The HumanEval score is probably optimistic: the setting was picked from four runs scored on the same 50 problems, and its training prompts restate some of them in other words. All of these scores come from OpenBonsai's PyTorch harness, not Prism's runtime. It replaced the first release (69/100 and 19/50 with thinking off) on 29 October 2026. Code and non-English output are still the main weakness.
Use your own fine-tune
Prism publishes finished Bonsai models but not the pipeline that makes them, so community fine-tunes so far train on top of Bonsai, mostly as adapters. OpenBonsai compresses the fine-tune itself, with the fine-tune as the teacher: it answers prompts in its own chat template, and its answers become the calibration and distillation data. With a merged Qwen3.5-9B checkpoint and one 32 GB GPU:
openbonsai run --out runs/mine \
--model path/to/my-finetune \
--config examples/qwen3_5-9b-reasoning.yaml
This is the recipe behind the first published model, 4 to 4.5 hours
on one RTX 5090. The current one adds more code traces
(examples/qwen3_5-9b-reasoning-code.yaml, about
5 hours). To keep the skill your fine-tune added, add your
task's prompts as one more trace source, so the model answers them
itself. The tied sizes (0.8B, 2B, 4B) are not supported yet.
Background: how ScaleQ works
An illustrated introduction to ScaleQ-1.58 and its CAT-Q quantizer (Wang et al., Intel Labs China), the paper that started this project. The current pipeline uses its self-generated calibration data (AYOT); CAT-Q itself is still in research.
4 min · English · Captions included Read transcript