Instructions to use welcoma/Ternary-Bonsai-8B-bonsai_tq_f32-MLC with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLC-LLM
How to use welcoma/Ternary-Bonsai-8B-bonsai_tq_f32-MLC with MLC-LLM:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Add professional Ternary Bonsai 8B MLC model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: prism-ml/Ternary-Bonsai-8B-unpacked
|
| 4 |
+
library_name: mlc-llm
|
| 5 |
+
pipeline_tag: text-generation
|
| 6 |
+
tags:
|
| 7 |
+
- mlc-llm
|
| 8 |
+
- web-llm
|
| 9 |
+
- webgpu
|
| 10 |
+
- qwen3
|
| 11 |
+
- bonsai
|
| 12 |
+
- ternary
|
| 13 |
+
- prismml
|
| 14 |
+
- 2-bit
|
| 15 |
+
- quantized
|
| 16 |
+
- experimental
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
# Ternary-Bonsai-8B `bonsai_tq_f32` for MLC/WebLLM
|
| 20 |
+
|
| 21 |
+
This repository contains an experimental MLC/WebLLM conversion of
|
| 22 |
+
[`prism-ml/Ternary-Bonsai-8B-unpacked`](https://huggingface.co/prism-ml/Ternary-Bonsai-8B-unpacked).
|
| 23 |
+
It is a browser-runtime artifact, not a new model, fine-tune, GGUF, MLX, or ONNX
|
| 24 |
+
mirror.
|
| 25 |
+
|
| 26 |
+
The source checkpoint is Prism ML's unpacked FP16 Ternary Bonsai model. This
|
| 27 |
+
conversion uses a local MLC `bonsai_tq_f32` profile: symmetric 2-bit group
|
| 28 |
+
quantization with `uint32` storage, group size 128, and FP32 scales. The encoded
|
| 29 |
+
values represent the ternary lane `-scale`, `0`, and `+scale`.
|
| 30 |
+
|
| 31 |
+
## Artifact Summary
|
| 32 |
+
|
| 33 |
+
| Field | Value |
|
| 34 |
+
| --- | --- |
|
| 35 |
+
| Source checkpoint | `prism-ml/Ternary-Bonsai-8B-unpacked` |
|
| 36 |
+
| Architecture | Qwen3-shaped decoder |
|
| 37 |
+
| MLC model type | `qwen3` |
|
| 38 |
+
| Quantization | `bonsai_tq_f32` |
|
| 39 |
+
| Quantized storage | 2-bit symmetric group quantization in `uint32` |
|
| 40 |
+
| Conversation template | `qwen3_nothink` |
|
| 41 |
+
| Context window in config | `32768` |
|
| 42 |
+
| Prefill chunk in config | `2048` |
|
| 43 |
+
| Total parameters | 8,188,548,096 |
|
| 44 |
+
| Quantized parameter size | 2.146 GB |
|
| 45 |
+
| Bits per parameter | 2.251 |
|
| 46 |
+
| Parameter shards | 69 |
|
| 47 |
+
| Artifact size | about 2.1 GB |
|
| 48 |
+
| WebGPU library | `libs/ternary-bonsai-8b-bonsai_tq_f32-webgpu.wasm` |
|
| 49 |
+
|
| 50 |
+
## Runtime Requirement
|
| 51 |
+
|
| 52 |
+
This artifact requires an MLC/WebLLM runtime with the local `bonsai_tq_f32`
|
| 53 |
+
quantization profile registered. It is not expected to load in an unmodified
|
| 54 |
+
upstream WebLLM build until this profile is upstreamed or otherwise carried in
|
| 55 |
+
the runtime.
|
| 56 |
+
|
| 57 |
+
This first ternary path uses MLC's group-quantized graph path. It is a compact
|
| 58 |
+
WebGPU artifact and a correctness/release milestone, but it is not yet a custom
|
| 59 |
+
fused ternary matmul kernel. Benchmark it before making speed claims.
|
| 60 |
+
|
| 61 |
+
## WebLLM Configuration
|
| 62 |
+
|
| 63 |
+
```js
|
| 64 |
+
const appConfig = {
|
| 65 |
+
model_list: [
|
| 66 |
+
{
|
| 67 |
+
model: "https://huggingface.co/welcoma/Ternary-Bonsai-8B-bonsai_tq_f32-MLC/resolve/main/",
|
| 68 |
+
model_id: "Ternary-Bonsai-8B-tq-MLC",
|
| 69 |
+
model_lib:
|
| 70 |
+
"https://huggingface.co/welcoma/Ternary-Bonsai-8B-bonsai_tq_f32-MLC/resolve/main/libs/ternary-bonsai-8b-bonsai_tq_f32-webgpu.wasm",
|
| 71 |
+
overrides: {
|
| 72 |
+
context_window_size: 4096,
|
| 73 |
+
prefill_chunk_size: 512,
|
| 74 |
+
},
|
| 75 |
+
},
|
| 76 |
+
],
|
| 77 |
+
};
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
The smaller override values above are intended for local browser smoke tests.
|
| 81 |
+
Increase them only after measuring browser memory and cache behavior on the
|
| 82 |
+
target device. The 8B artifact is materially larger than the 1.7B and 4B
|
| 83 |
+
artifacts, so browser cache quota and GPU memory should be checked before using
|
| 84 |
+
larger context settings.
|
| 85 |
+
|
| 86 |
+
## Validation
|
| 87 |
+
|
| 88 |
+
The artifact was converted and WebGPU-compiled on the GCP MLC/WebLLM builder VM,
|
| 89 |
+
not on a local laptop.
|
| 90 |
+
|
| 91 |
+
- Source: `prism-ml/Ternary-Bonsai-8B-unpacked`
|
| 92 |
+
- Quantization: `bonsai_tq_f32`
|
| 93 |
+
- Quantization profile: `int2` values, `uint32` packed storage, FP32 scales
|
| 94 |
+
- Conversion peak RAM: 9.188 GB on CPU
|
| 95 |
+
- WebGPU compile completed successfully
|
| 96 |
+
- Compile estimate without KV cache: 3830.35 MB
|
| 97 |
+
- Compile estimate with 4K KV cache: 4982.35 MB
|
| 98 |
+
|
| 99 |
+
## Limitations
|
| 100 |
+
|
| 101 |
+
- This is an experimental runtime artifact, not a general `transformers` model
|
| 102 |
+
checkpoint.
|
| 103 |
+
- This repo does not claim the same runtime performance as Prism ML's native MLX
|
| 104 |
+
2-bit release.
|
| 105 |
+
- Quality evaluation is limited to conversion and WebGPU compile checks; no
|
| 106 |
+
benchmark score is claimed by this repository.
|
| 107 |
+
- Browser success depends on WebGPU support, available GPU memory, cache quota,
|
| 108 |
+
and a compatible patched WebLLM runtime.
|
| 109 |
+
|
| 110 |
+
## Provenance
|
| 111 |
+
|
| 112 |
+
Original model by Prism ML:
|
| 113 |
+
|
| 114 |
+
- [prism-ml/Ternary-Bonsai-8B-unpacked](https://huggingface.co/prism-ml/Ternary-Bonsai-8B-unpacked)
|
| 115 |
+
- [prismml.com](https://prismml.com/)
|
| 116 |
+
|
| 117 |
+
MLC/WebLLM conversion by `welcoma`.
|