Ternary Bonsai 2: Qwen3.8-27B Compressed to 5.9GB at 98.2% Performance
PrismML's Ternary Bonsai 2 27B uses rotated weight basis and FP16 group-wise scaling to ternary-quantize Qwen3.8-27B to 1.76 bits (5.9GB), achieving 98.2% benchmark retention across coding, reasoning, and agent tasks, with custom CUDA/MLX kernels enabling fast inference on consumer GPUs and Apple Silicon.
Introduction
PrismML, a team from Caltech, released Ternary Bonsai 2 27B, a second-generation ternary-quantized model based on Qwen3.8-27B. The model compresses the original ~54GB full-precision weights to just 5.9GB (1.76 bits per weight) while claiming 98.2% overall benchmark retention. The first-generation Bonsai 27B achieved 95% retention; this version closes the gap to under 2% by upgrading the base model and refining the quantization pipeline.
Key Parameters
Base model: Qwen3.8 27B (native support for thinking/deep reasoning mode)
Core weights: Ternary quantization {-1, 0, +1} with FP16 group-wise scaling factors
Effective bit width: 1.76 bits per weight on average
Model size: 5.9GB (9.1× reduction from 54GB full precision)
Context window: Native 262K tokens
Modality: Supports image-text multimodal input (vision module decoupled as separate 0.63GB GGUF file)
License: Apache 2.0 (commercial use permitted)
Core Technical Breakdown
Traditional ultra-low-bit quantization fails because deep networks contain rare but critical outlier activations. Simply rounding to {-1, 0, +1} flattens these decisive values, corrupting deep attention matrices. Bonsai 2 addresses this with three innovations:
1. Rotated Weight Basis
Before quantization, an orthogonal transform projects weight matrices into a rotated basis space. This spreads concentrated extreme peaks uniformly across the feature space, mathematically eliminating the outliers that break quantization.
2. FP16 Group-Wise Scaling Ternary Mapping
After outlier removal, the bulk weights are end-to-end quantized to ternary values {-1, 0, +1}, paired with fine-grained FP16 group-wise scaling factors, achieving the extreme 1.76-bit average width.
3. Hardware-Specific Custom Kernels
PrismML hand-wrote low-bit GEMM kernels for NVIDIA CUDA and Apple Silicon MLX. These kernels operate directly on ternary bit-width without dequantizing back to high-precision floats, delivering hardware acceleration.
Benchmark Results
Official benchmarks compare Ternary Bonsai 2 27B (5.9GB) against full-precision Qwen3.8 27B and Qwen3.6 27B across six dimensions:
Agent & Tool Use (τ²-bench, BFCLv3): Ternary Bonsai 2 27B 77.57, Qwen3.8 27B (FP) 79.74, Qwen3.6 27B (FP) 80.05
Coding (HumanEval+, LiveCodeBench v6, MBPP+): Ternary Bonsai 2 27B 81.58, Qwen3.8 27B (FP) 82.17, Qwen3.6 27B (FP) 82.57
Instruction Following (IFBench, IFEval): Ternary Bonsai 2 27B 82.66, Qwen3.8 27B (FP) 81.25, Qwen3.6 27B (FP) 74.53
Knowledge & Reasoning (MMLU-Redux, GPQA Diamond, AA-LCR): Ternary Bonsai 2 27B 83.95, Qwen3.8 27B (FP) 86.66, Qwen3.6 27B (FP) 84.71
Math (AIME 2026, GSM8K, MATH-500): Ternary Bonsai 2 27B 96.57, Qwen3.8 27B (FP) 97.06, Qwen3.6 27B (FP) 94.64
Vision Multimodal (CharXiv, OmniDocBench, RealWorldQA): Ternary Bonsai 2 27B 78.59, Qwen3.8 27B (FP) 81.64, Qwen3.6 27B (FP) 79.82
Overall: Ternary Bonsai 2 27B 83.9, Qwen3.8 27B (FP) 85.4, Qwen3.6 27B (FP) 83.6
Notable gaps: coding -0.59, agent -2.17, instruction following +1.41 (surpasses full precision), math -0.49. Vision multimodal shows a larger -3.05 gap.
Comparison with Standard 2-bit Quantization
Community 2-bit quantizations (e.g., IQ2_XXS at ~9.4GB) appear normal in casual chat but collapse on hard reasoning: AIME26 drops from 97 to 57.5, LiveCodeBench from 82 to 56.4. Bonsai 2 at 1.72 bpw (5.9GB) scores 95.83 on AIME26 and 89.42 on coding, nearly matching full precision.
Intelligence Density per GB
When measuring "intelligence density per GB", Bonsai 2 27B outperforms all other 2-bit to 4-bit lightweight models, which typically suffer exponential error amplification in multi-step agent chains and code completion. Bonsai 2 is the first 27B model to stabilize agent logic chains at extreme compression.
Deployment Variants and Speed
Two GGUF variants target different hardware profiles:
PTQ1_0 (Compact Ternary, 1.75 bits/weight, 5.95GB): Ternary weights tightly packed, minimal VRAM, optimal on bandwidth-limited devices (RTX 4090, thin-and-light laptops, L4).
PQ2_0 (2-bit Slot, 2.13 bits/weight, 7.21GB): Slightly larger but lower unpacking overhead, maximizes throughput on high-end hardware (RTX 5090, H100, Blackwell).
Official speed benchmarks (custom llama.cpp/MLX kernels):
NVIDIA RTX 5090 (PQ2_0): 130 tokens/s decode, 3893 tokens/s prefill
NVIDIA RTX 4090 (PTQ1_0): 91.1 tokens/s
Apple M5 Max: 47.0 tokens/s
Apple M5 Pro: 28.1 tokens/s, GPU power 27.5W, total system 34.1W
NVIDIA L4 (72W): 32.1 tokens/s
Deployment Methods
1. llama.cpp / GGUF (Cross-Platform)
hf download prism-ml/Ternary-Bonsai-2-27B-gguf Ternary-Bonsai-2-27B-PQ2_0.gguf --local-dir .
./bin/llama-cli -m Ternary-Bonsai-2-27B-PQ2_0.gguf \
-ngl 99 -fa on -c 32768 \
--temp 1.0 --top-p 0.95 --top-k 20 \
-p 0 -n 512For multimodal, add the separate vision projector mmproj-model-Q8_0.gguf (0.63GB), loaded only when images are processed.
2. Mac (MLX)
pip install mlx-lm
python -m mlx_lm.generate --model PrismML/Ternary-Bonsai-2-27B-MLX --prompt 0Runs on 16GB unified memory MacBook Air.
3. NVIDIA GPU (Custom CUDA Kernels)
git clone https://github.com/PrismML/Bonsai-demo
cd Bonsai-demo
pip install -r requirements.txt
pip install .
python cli.py --model PrismML/Ternary-Bonsai-2-27BVRAM stays under 6GB.
Community Real-World Benchmarks
Consumer and Legacy GPUs
RTX 4070 Ti SUPER (16GB): 69.6 tokens/s (Windows CUDA), supports ultra-long context
RTX 5060 Ti (16GB): 44.4 tokens/s native
GTX 1080 Ti (11GB, 8-year-old card): 20.5 tokens/s (ternary), 28.3 tokens/s (1-bit variant)
Apple Silicon
M5 Max (48GB): 45.8 tokens/s (Metal), 63.9 tokens/s (1-bit mode)
M4 Pro (64GB): 24.8 tokens/s (MLX)
M4 base (24GB, fanless): 12.7 tokens/s (MLX 2-bit), exceeds human reading speed
DSpark Speculative Sampling Acceleration
Enable with BONSAI_SPECULATIVE=1. A tiny draft model proposes tokens; the 27B ternary model verifies in parallel batches, preserving 27B quality while boosting speed:
RTX 5060 Ti: 44.4 → ~79 tokens/s (1.78×)
NVIDIA L40S: 74.3 → ~150 tokens/s (2.06×, up to 2.4× on math)
DGX Spark (GB10): 29.2 → 70.0 tokens/s (2.45×)
M5 Pro (MLX + community dspark-mlx): 29.5 → 34–49 tokens/s
Author's Personal Test
On a 16GB Mac mini via LM Studio, the author observed ~15 tokens/s, below expectations; more complex skill execution was not tested.
Conclusion
The race for larger parameters is detaching from the reality of most developers and small teams. Packing top-tier intelligence density into accessible devices is the necessary path for ubiquitous AI. The journey remains long.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Old Zhang's AI Learning
AI practitioner specializing in large-model evaluation and on-premise deployment, agents, AI programming, Vibe Coding, general AI, and broader tech trends, with daily original technical articles.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
