Prism-ML Bonsai Qwen 3.6 27B
Summary
Prism ML released Ternary-Bonsai-27B, a ternary-quantized version of Qwen3.6-27B that retains 95% of FP16 intelligence at a ~7.2 GB footprint, enabling full 27B-class reasoning on laptops and single GPUs with speeds up to 26 tok/s on Apple M5 Pro.
View Cached Full Text
Cached at: 07/14/26, 06:28 PM
prism-ml/Ternary-Bonsai-27B-gguf · Hugging Face
Source: https://huggingface.co/prism-ml/Ternary-Bonsai-27B-gguf
Prism ML Website|Whitepaper|Demo & Examples|Discord
Full 27B-class reasoning in ternary transformer weights, for llama.cpp (CUDA, Metal, CPU)
~9.4xsmaller than FP16 (ideal) |95%of FP16 intelligence retained |~26 tok/son an Apple M5 Pro laptop
https://huggingface.co/prism-ml/Ternary-Bonsai-27B-gguf#highlightsHighlights
- ~7.2 GBdeployed footprint (down from ~54 GB FP16) — full 27B-class reasoning on a standard laptop or a single GPU
- 95% of FP16 intelligence retained: 80.49 average across 15 thinking-mode benchmarks — ahigherscore than the conventional IQ2_XXS build (72.73) at less than two-thirds of its footprint
- Retains thinking, reasoning, and agentic behaviordeep in the sub-4-bit regime, where conventional low-bit representations collapse: math within two points of full precision (93.40), coding at 85.96, agentic tool use at 74.01
- End-to-end ternary language weightsacross embeddings, attention projections, MLP projections, and LM head, at atrue1.71 bits per weight — no high-precision escape hatches behind a low-bit label; the vision tower ships in compact 4-bit HQQ
- 262K-token contexton-device, kept practical by the Qwen3.6-27B hybrid-attention backbone (~75% linear attention) and 4-bit KV-cache quantization
- GGUF Q2_0_g128format with custom 2-bit hybrid-attention kernels for llama.cpp (CUDA, Metal) — packed weights are consumed directly, never expanded back to FP16
- Ships with a DSpark speculative-decoding drafter layertrained against the Bonsai 27B target — a lossless1.34xdecode speedup on the CUDA serving path
- MLX companion: also available asTernary-Bonsai-27B-mlx-2bitfor native Apple Silicon inference
- 1-bit companion: the phone-class operating point (~3.9 GB) that fits an iPhone 17 Pro Max, published in GGUF asBonsai-27B-gguf
https://huggingface.co/prism-ml/Ternary-Bonsai-27B-gguf#resourcesResources
- Whitepaper— full methodology, benchmarks, and measurement notes
- Demo & examples— serving, benchmarking, and integrating Bonsai
- Low-bit kernels:llama.cpp fork(CUDA + Metal) ·MLX fork(Apple Silicon) ·mlx-swift fork(iOS/macOS)
- Discord— join the community for support, discussion, and updates
https://huggingface.co/prism-ml/Ternary-Bonsai-27B-gguf#model-overviewModel Overview
ItemSpecificationBase modelDerived from Qwen3.6-27B, a 27B hybrid-attention causal language model (architecture unchanged)Parameters~27.3B ternary language weights (~24.8B backbone across 64 blocks + ~2.5B embedding/LM head) + ~0.46B vision tower (27 blocks)ArchitectureHybrid attention (~75% linear / ~25% full attention), SwiGLU MLP, RoPE, RMSNormContext length262K tokens (full-context capable on-device, enabled by the predominantly linear-attention backbone)KV cacheNear-lossless 4-bit KV quantization; the hybrid backbone grows a full-attention cache on only 16 of 64 layers (~4.3 GB at the full 262K window)Weight formatGGUF Q2_0_g128: {−1, 0, +1} weights in 2-bit slots with FP16 group-wise scalingLow-bit coverageEmbeddings, attention projections, MLP projections, LM headVision towerHQQ 4-bit; optional ~0.63 GB mmproj pack (Q8_0 container), loaded only for image inputDeployed size**~7.2 GB**(5.9 GB ideal at 1.71 bits/weight; see below)AccelerationDSpark speculative-decoding drafter layer providedBackendsllama.cpp (CUDA, Metal, CPU)LicenseApache 2.0
https://huggingface.co/prism-ml/Ternary-Bonsai-27B-gguf#weight-representation-q2_0_g128Weight Representation: Q2_0_g128
Each weight takes a value from {−1, 0, +1}, with one shared FP16 scale factor for every group of 128 weights. A ternary value carries log₂3 ≈ 1.585 bits of information, so the effective storage cost is**~1.71 bits/weight**(ternary code + 16-bit scale amortized over 128 weights) — an idealized ~9.4x reduction vs FP16.
Relative to the binary format, the extra zero state gives a more expressive weight alphabet and recovers more of the full-precision model’s behavior, which makes ternary thequality-oriented operating pointof the Bonsai 27B family.
https://huggingface.co/prism-ml/Ternary-Bonsai-27B-gguf#memory-requirementMemory Requirement
FormatTrue bits/weightIdeal sizeDeployed sizeReduction (ideal)FP16 (baseline)16.0~54 GB—1.0xGGUF Q2_0_g1281.715.9 GB****~7.2 GB****~9.4x Today’s kernels store each ternary value in a 2-bit slot (2.125 bits/weight deployed), so the deployed footprint sits above the representation’s information-theoretic minimum until native ternary kernels close the gap. The deployed figure describes the language model alone — the only component that must stay resident for text inference; a negligible tail of normalization and scale parameters remains in higher precision.
Unlike conventional low-bit builds — whose advertised labels understate their true average bit-width (a widely-used “2-bit” build of Qwen3.6-27B is really 2.8 bits/weight at 9.4 GB) — the Bonsai representation carries a bit-width that matches its name.
https://huggingface.co/prism-ml/Ternary-Bonsai-27B-gguf#shipped-componentsShipped Components
Two optional components ship alongside the language model (on-disk sizes):
ComponentPackSizeResidencyLanguage model2-bit g128 slots (Q2_0)7.17 GBresidentDSpark drafterQ4_1 (default)1.95 GBoptional — speculative decodingDSpark drafterbf16 (reference)7.29 GBoptionalVision towermmproj HQQ 4-bit (Q8_0 container)0.63 GBoptional — multimodal input onlyVision towermmproj BF16 (reference)0.93 GBoptional The vision tower is usually offloaded: it sits outside the accelerator’s resident budget and is loaded only when an image actually arrives, so text-only serving never pays for it. A group-64 ternary pack (7.59 GB) is also published, matching the 64-value-group Q2_0 packing in llama.cpp — the same native g128 representation with each scale repeated per 64-value block.
https://huggingface.co/prism-ml/Ternary-Bonsai-27B-gguf#peak-memory-at-contextPeak Memory at Context
What a device must actually accommodate ispeakmemory — weights plus KV cache plus activations and runtime buffers (~1.3 GB across backends). Measured, language model only, no KV-cache compression (sizes in decimal GB; the Q4_K_XL row is derived from its weight footprint plus the same measured cache-and-overhead build-up, all other rows directly measured):
BuildWeights4K ctx10K ctx100K ctxTernary Bonsai (llama.cpp Q2_0)7.158.48.714.7Qwen3.6-27B “4-bit” (Q4_K_XL)17.619.219.625.627B 16-bit (GGUF bf16)51.2552.653.359.3 The ternary build holds a100K-token context at 14.7 GB without any KV-cache compression— a budget that fits mainstream laptops outright; the conventional Q4_K_XL build needs ~25.6 GB before the first long document is loaded. These peaks are the conservative case, with the cache left at FP16. Enabling the 4-bit KV cache shrinks the context-dependent term ~4x: the 100K peak drops to ~10.1 GB, and the full 262K window fits in ~12.8 GB peak.
https://huggingface.co/prism-ml/Ternary-Bonsai-27B-gguf#best-practicesBest Practices
https://huggingface.co/prism-ml/Ternary-Bonsai-27B-gguf#generation-parametersGeneration Parameters
ParameterSuggestedTemperature0.7Top-p0.95Top-k20 These are the settings used for all reported benchmark results (thinking mode).
https://huggingface.co/prism-ml/Ternary-Bonsai-27B-gguf#system-promptSystem Prompt
You can use a simple system prompt such as:
You are a helpful assistant
https://huggingface.co/prism-ml/Ternary-Bonsai-27B-gguf#quickstartQuickstart
https://huggingface.co/prism-ml/Ternary-Bonsai-27B-gguf#llamacpp-cudallama.cpp (CUDA)
# Clone the PrismML fork of llama.cpp (includes the Q2_0_g128 hybrid-attention kernels)
git clone https://github.com/PrismML-Eng/llama.cpp
cd llama.cpp
# Build with CUDA support
cmake -B build -DGGML_CUDA=ON && cmake --build build -j
# Download the 2-bit GGUF weights
hf download prism-ml/Ternary-Bonsai-27B-gguf Ternary-Bonsai-27B-Q2_0.gguf --local-dir .
# Run inference
./build/bin/llama-cli \
-m Ternary-Bonsai-27B-Q2_0.gguf \
-p "Explain quantum computing in simple terms." \
-n 256 \
--temp 0.7 --top-p 0.95 --top-k 20 \
-ngl 99
https://huggingface.co/prism-ml/Ternary-Bonsai-27B-gguf#llamacpp-metal–macosllama.cpp (Metal / macOS)
# Build with Metal support (default on macOS)
cmake -B build && cmake --build build -j
# Run inference
./build/bin/llama-cli \
-m Ternary-Bonsai-27B-Q2_0.gguf \
-p "Explain quantum computing in simple terms." \
-n 256 \
--temp 0.7 --top-p 0.95 --top-k 20 \
-ngl 99
https://huggingface.co/prism-ml/Ternary-Bonsai-27B-gguf#llamacpp-serverllama.cpp Server
./build/bin/llama-server \
-m Ternary-Bonsai-27B-Q2_0.gguf \
--host 0.0.0.0 --port 8080 -ngl 99
Open the web UI athttp://127.0.0.1:8080, or see ourllama.cpp forkfor more examples.
**Deploying to a phone?**The ternary build (~7.2 GB) exceeds the ~6 GB per-app iOS memory budget and is laptop/GPU-only. Use the 1-bit companion (~3.9 GB), which fits an iPhone 17 Pro Max viaMLX Swift.
https://huggingface.co/prism-ml/Ternary-Bonsai-27B-gguf#cross-platform-throughputCross-Platform Throughput
tg128is token-generation throughput over 128 generated tokens (the memory-bandwidth-bound, interactive phase);pp512is prompt-processing throughput over 512 input tokens (the compute-bound phase). Both in tokens/s, measured withllama\-benchon this GGUF pack (custom low-bit kernels).
PlatformFootprintTG128 (tok/s)PP512 (tok/s)Laptop (Apple M5 Max, Metal)7.2 GB44.0830Laptop (Apple M5 Pro, Metal)7.2 GB26.2393Laptop (Apple M4 Pro, Metal)7.2 GB18.0125Single GPU (H100, CUDA)7.2 GB98.02596 On the laptop, the FP16 baseline (~54 GB) and even conventional “4-bit” builds (17.6 GB) do not fit at all — the meaningful statement is not a speedup ratio but that a 27B model runs interactively on an everyday laptop. The measured decode streams ~186 GB/s of weights on the M5 Pro, confirming the memory-bandwidth-dominated profile that the low-bit representation is built to exploit. The H100 row is the exception that proves the rule: at batch size 1 a datacenter GPU is limited by kernel-launch and synchronization latency rather than weight bandwidth, so the ternary and binary variants converge there (98 vs 104.8 tok/s) despite their ~1.9x difference in bytes per step.
https://huggingface.co/prism-ml/Ternary-Bonsai-27B-gguf#speculative-decoding-dsparkSpeculative Decoding: DSpark
Ternary Bonsai 27B ships with aDSparkdrafter layer trained against the low-bit target — a semi-autoregressive drafter with confidence-scheduled verification. Speculative decoding is lossless: verification preserves the target distribution exactly, so accepted tokens are indistinguishable from ordinary generation.
The drafter is a compactsix-layer block-parallel transformerconditioned on hidden states tapped from five evenly spaced layers of the target; its drafter-unique weights add roughly0.5 GB at serving precision(embeddings and output head are shared with the resident target). It follows the DSpark recipe with a diffusion-flavored block-denoising objective, survival-probability-weighted distillation, per-source-normalized hidden-state taps, and a draft block size chosen from a measured verify-cost model of the serving stack. The drafter ships 4-bit quantized — the ~1.95 GB Q4_1 pack is the default; it drafts faster than the bf16 reference at essentially unchanged draft quality, and because verification preserves the target distribution exactly, drafter precision affects only speed, never output quality.
On the CUDA serving path the drafter is a measured net win — an accepted length of τ ≈ 3.7 at draft depth k = 4 turns into a1.34xend-to-end decode speedup on H100 (98 → 131.8 tok/s). On Apple Silicon the batch-1 verification pass does not yet amortize, so the drafter layer is not enabled by default on-device.
https://huggingface.co/prism-ml/Ternary-Bonsai-27B-gguf#benchmarksBenchmarks
Evaluated with EvalScope + vLLM on NVIDIA H100 under identical infrastructure, decoding, and scoring, inthinking mode— where the model’s full reasoning is exercised and the sub-4-bit collapse of conventional methods is most visible. 15 benchmarks across six skill categories. For cross-family context the table also includes Gemma-4-31B, a model of the same capability tier, with its conventional low-bit builds — the collapse below 4 bits is a property of the methods, not of one base model. Bit-widths are true averages; “vs FP16” is relative to the Qwen3.6-27B FP16 reference.
VariantTrue bpwFootprintThinking avgvs FP16Qwen3.6-27B FP1616.054 GB85.07100%Qwen3.6-27B Q4_K_XL (“4-bit”)5.217.6 GB84.9999.9%Qwen3.6-27B IQ2_XXS (“2-bit”)2.89.4 GB72.7385.5%Gemma-4-31B FP1616.061.5 GB84.5899.4%Gemma-4-31B QAT (“4-bit”)6.023.3 GB83.4198.0%Gemma-4-31B Q2_K_XL (“2-bit”)3.011.8 GB73.3186.2%**Ternary Bonsai 27B1.715.9 GB80.4994.6%**1-bit Bonsai 27B1.1253.9 GB76.1189.5% At 5.9 GB, Ternary Bonsai 27B outscores both sub-4-bit conventional builds by more than seven points at one-half to two-thirds of their size.
The aggregate gap also understateshowthe conventional builds fail: their degradation is selective, concentrated on the benchmarks that demand sustained chains of reasoning. IQ2_XXS falls to 57.5 on AIME26 and 56.4 on LiveCodeBench while still scoring 88.93 on MMLU-Redux — which is why casual testing misses the collapse. Ternary Bonsai holds exactly these benchmarks, keeping AIME at 87.5–90.8 and LiveCodeBench at 82.8.
https://huggingface.co/prism-ml/Ternary-Bonsai-27B-gguf#by-skill-categoryBy Skill Category
CategoryBenchmarksFP16Ternary 27BKnowledge & reasoningMMLU-Redux, MuSR83.1576.96MathGSM8K, MATH-500, AIME25, AIME2695.3393.40CodingHumanEval+, MBPP+, LiveCodeBench88.7485.96Instruction followingIFEval, IFBench78.4771.77Agentic / tool callingBFCL v3, τ²-Bench80.0074.01VisionMMMU-Pro, OCR Bench v272.6165.19Overall (15)85.0780.49 The reasoning backbone comes through intact: math stays within two points of full precision (93.40), coding at 85.96, and the ternary model spends its extra footprint to hold the most demanding categories — agentic tool use at 74.01 and vision at 65.19 — the behaviors that conventional sub-4-bit representations lose first.
https://huggingface.co/prism-ml/Ternary-Bonsai-27B-gguf#full-per-benchmark-resultsFull Per-Benchmark Results
Expand full per-benchmark results (thinking mode)BenchmarkFP16Ternary 27BMMLU-Redux93.4288.05MuSR72.8865.87GSM8K95.3096.06MATH-50099.4099.20AIME2593.2990.84AIME2693.3387.50HumanEval+95.1293.90MBPP+83.3381.22LiveCodeBench87.7782.75IFEval88.9185.03IFBench (prompt-loose)68.0358.50BFCL v377.1074.41τ²-Bench82.9073.61MMMU-Pro79.9468.96OCR Bench v265.2861.42Average (15)85.0780.49
https://huggingface.co/prism-ml/Ternary-Bonsai-27B-gguf#intelligence-densityIntelligence Density
Intelligence density captures the ratio of a model’s capability to its deployed size:
D = -log2(1 - score/100) / size_GB
VariantSize (GB)Benchmark avgIntelligence Density (1/GB)1-bit Bonsai 27B3.976.110.530Ternary Bonsai 27B****5.980.490.400Qwen3.6-27B IQ2_XXS9.472.730.199Gemma-4-31B Q2_K_XL11.873.310.162Qwen3.6-27B Q4_K_XL17.684.990.155Gemma-4-31B QAT23.383.410.111Qwen3.6-27B FP165485.070.051Gemma-4-31B FP1661.584.580.044 Ternary Bonsai 27B delivers2xthe density of the densest conventional build (IQ2_XXS at 0.199) and nearly8xFP16 — no conventional build of Qwen3.6-27B or Gemma-4-31B exceeds 0.2. Each stored gigabyte is translated into far more usable intelligence.
https://huggingface.co/prism-ml/Ternary-Bonsai-27B-gguf#use-casesUse Cases
- Laptop-local 27B agents: full 27B reasoning and tool use on a standard laptop at ~26 tok/s, with the 262K context available for long-document analysis, full-repository code work, and other tasks that depend on holding a large working set in context
- Privacy-sensitive and offline settings: on-device execution keeps prompts and data on the device by construction, and works with intermittent or no connectivity
- Single-GPU and commodity-GPU serving: 27B-class quality from a single consumer or entry-level datacenter GPU, with headroom for larger batches, longer contexts, or co-resident models — combined with the KV-cache quantization, high-throughput serving and long-context document analysis become practical on a single 24 GB GPU
- Quality-first low-bit deployment: when the deployment target has laptop-class memory or better, ternary is the operating point that retains the most of the full-precision model’s behavior
https://huggingface.co/prism-ml/Ternary-Bonsai-27B-gguf#limitationsLimitations
- The quality–footprint trade-off: the ternary model retains 94.6% of the full-precision average, and the gap is modest and predictable — the reasoning core (math, coding) stays within a few points of baseline, with the difference concentrated in the most demanding categories
- Does not fit a phone: at ~7.2 GB the ternary build exceeds the ~6 GB per-app iOS memory budget; use the 1-bit companion viaMLX Swiftfor phone deployment
- Served in 2-bit slots today: the deployed footprint (~7.2 GB) sits above the representation’s ~5.9 GB native target; native ternary kernels are an active engineering target and would return the remaining bandwidth and footprint advantage directly as latency and energy improvements
- Agentic coding(long-horizon, multi-file, run-test-and-repair workflows) is not yet a strong target of this release; a Bonsai 27B variant tuned for agentic coding is next on the roadmap
- KV compression headroom: this release standardizes on a 4-bit KV cache; early results show the key cache can be pushed toward the sub-2-bit regime — a path to still longer contexts within a fixed device-memory budget
https://huggingface.co/prism-ml/Ternary-Bonsai-27B-gguf#citationCitation
If you use Ternary Bonsai 27B, please cite:
@techreport{bonsai27b,
title = {Bonsai 27B: Full 27B-Class Reasoning in Binary and Ternary
Transformer Weights --- on Laptops and Phones},
author = {Prism ML},
year = {2026},
month = {July},
url = {https://prismml.com}
}
https://huggingface.co/prism-ml/Ternary-Bonsai-27B-gguf#contactContact
For questions, feedback, or collaboration inquiries:[email protected]
Similar Articles
prism-ml/Bonsai-27B-gguf
Prism ML releases Bonsai-27B-gguf, a 27-billion parameter language model with binary (1.125-bit) weights, achieving a ~14x size reduction while retaining ~90% of FP16 reasoning performance. It runs on consumer hardware with high throughput.
Bonsai 27B (1-bit LLM): The First 27B-Class Model to Run on a Phone
PrismML announces Bonsai 27B, a 1-bit and ternary quantized version of Qwen3.6 27B that runs on phones and laptops, retaining 90-95% of baseline performance with a 3.9GB footprint, enabling agentic and multimodal on-device AI.
prism-ml/bonsai-image-ternary-4B-gemlite-2bit
Prism ML releases Bonsai Image, a 1.21 GB text-to-image diffusion transformer using ternary weights (1.58-bit) for NVIDIA GPUs, offering 4.5s / 1024² on RTX 3080 and much smaller than FP16.
For those with 12GB GPUs, you can now run QWEN 3.6 27B wth little loss via the new Ternary version.
A new ternary quantized version of Qwen3.6 27B, called Bonsai 27B, allows running the model on 12GB GPUs with 10x less memory and 95% of original performance, making it accessible for local deployment.
@populartourist: I can run a 27B instead of a 9B on my budget laptop. That's mind blowing.
PrismML announces Bonsai 27B, a multimodal model based on Qwen3.6 27B that can run on a phone, enabling local multi-step reasoning, tool use, and long-context workflows.