talxcc commited on
Commit
aeb4de2
Β·
verified Β·
1 Parent(s): 52a282c

Add Tals-coder-01 Model Card with Ternary Bonsai PQ2 lineage & custom quant documentation

Browse files
Files changed (1) hide show
  1. README.md +167 -0
README.md ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ - multilingual
5
+ tags:
6
+ - ternary
7
+ - speculative-decoding
8
+ - mtp
9
+ - vision
10
+ - multimodal
11
+ - gguf
12
+ - custom-quant
13
+ - qwen35
14
+ - code
15
+ - reasoning
16
+ - agentic
17
+ base_model:
18
+ - ukisai/Swift-Bonsai-2-GGUF
19
+ - killy369/Ternary-Bonsai-2-27B-MTP-drafter-GGUF
20
+ license: apache-2.0
21
+ pipeline_tag: text-generation
22
+ ---
23
+
24
+ # ⚑ Tals-coder-01 (Custom GGUF Quant: Ternary Bonsai 2 + Grafted Native MTP)
25
+
26
+ **Tals-coder-01** is a custom GGUF quantization and architectural graft of **Ternary Bonsai 2 (27B)**. Engineered specifically for consumer 16GB VRAM GPUs (RTX 4060 Ti 16GB, RTX 4070 Ti Super, RTX 4080/4090), it delivers **55–60 tokens/second** on a budget 128-bit memory bus (288 GB/s), scaling to **120–150+ tokens/second** on high-bandwidth hardware (RTX 3090, 4090, A100).
27
+
28
+ ---
29
+
30
+ ## 🧬 Architectural Pedigree & Custom GGUF Quantization
31
+
32
+ This model is a custom GGUF quant built upon and fused from:
33
+ 1. **Base Model:** Based on **[Swift-Bonsai-2-PQ2_0.gguf](https://huggingface.co/ukisai/Swift-Bonsai-2-GGUF)** by Ukisai β€” a 27B parameter Ternary model using Walsh-Hadamard rotation representation (`PQ2_0` 142 quantization).
34
+ 2. **Native MTP Drafter:** Integrated with weights from **[Ternary-Bonsai-2-27B-MTP-drafter-GGUF](https://huggingface.co/killy369/Ternary-Bonsai-2-27B-MTP-drafter-GGUF)** by killy369 β€” featuring a 1-layer native Multi-Token Prediction (MTP) draft head with a 64k pruned vocabulary.
35
+ 3. **The Custom Graft:** Rather than requiring users to configure and orchestrate separate target and draft models (`-m` and `-md`), **Tals-coder-01 grafts the 65th MTP layer and unrotated token embeddings directly into the core GGUF file** (`Tals-coder-01.gguf`), producing an all-in-one standalone model.
36
+ 4. **Multimodal Vision:** Paired with **`Tals-coder-01-mmproj.gguf`** (0.63 GB CLIP Q8_0 vision tower) for full image comprehension, UI analysis, and diagram inspection.
37
+
38
+ ---
39
+
40
+ ## 🌟 Why Tals-coder-01?
41
+
42
+ * **All-in-One Model File:** The native MTP draft head is built directly into `Tals-coder-01.gguf` (`qwen35.nextn_predict_layers = 1`, `qwen35.block_count = 65`).
43
+ * **Pruned Reasoning (No Overthinking):** Unlike verbose models that get trapped in endless monologue loops, Tals-coder-01 outputs direct, clean, and immediately functional code.
44
+ * **55–60 tok/s on Budget 16GB Cards:** Breaks through the theoretical memory bandwidth barrier with verified **68%–85% MTP speculative draft acceptance**.
45
+ * **100% VRAM Execution:** Runs 27B parameters, 128k context, and vision completely on GPU (~13.8–14.1 GB / 16.0 GB total) with **zero CPU/PCIe RAM spillover**.
46
+ * **Massive Context Scaling on 16GB VRAM:**
47
+ * **64k Context:** Full FP16 KV Cache (`-ctk f16 -ctv f16`) for zero precision degradation.
48
+ * **128k Context:** Balanced Hybrid KV Cache (`-ctk q8_0 -ctv q4_0`) at ~14.1 GB total VRAM.
49
+ * **262k Full Native Context:** Ultra-long context with Q4_0 KV Cache (`-ctk q4_0 -ctv q4_0`) fitting 100% in VRAM!
50
+
51
+ ---
52
+
53
+ ## πŸ“Š Benchmark & Performance
54
+
55
+ Tested locally on **NVIDIA GeForce RTX 4060 Ti 16GB** (PCIe 4.0 x8, 288 GB/s bandwidth, WDDM):
56
+
57
+ | Configuration | Speculative Acceptance | Generation Speed | Context Window |
58
+ | :--- | :---: | :---: | :---: |
59
+ | **Base Model Only** (No MTP) | N/A (0%) | 24.8 – 25.8 tok/s | Up to 262k |
60
+ | **Tals-coder-01 (MTP `n_max=1`)** | 77.8% | 40.7 – 42.5 tok/s | Up to 262k |
61
+ | **Tals-coder-01 (MTP `n_max=2`)** *(Optimal)* | **68.9% – 74.2%** | **55.0 – 60.5 tok/s** | Up to 262k |
62
+ | **Boilerplate / Code Bursts** | **85.2%** | **Up to 76.7 tok/s** | Up to 262k |
63
+ | *Estimated RTX 4090 / 3090 (1,008 GB/s)* | *75% – 85%* | **120 – 155 tok/s** | *Full 262k* |
64
+
65
+ ---
66
+
67
+ ## πŸ“¦ Model Files in Repository
68
+
69
+ | Filename | Size | Description |
70
+ | :--- | :---: | :--- |
71
+ | `Tals-coder-01.gguf` | 8.25 GB | **Unified 27B Custom GGUF Quant** with Grafted Native MTP Head (All 65 layers). |
72
+ | `Tals-coder-01-mmproj.gguf` | 0.63 GB | High-fidelity CLIP Q8_0 multimodal vision projector. |
73
+ | `bonsai2-pascal.patch` | 259 KB | Source patch for custom Hadamard kernels & MTP timing. |
74
+
75
+ ---
76
+
77
+ ## πŸ› οΈ Optimal llama.cpp Runtime Setup
78
+
79
+ Because this model uses ternary quantization in a Hadamard-rotated basis, use the optimized `llama.cpp` build with Hadamard kernel support (Prism ML / Pascal branch, or apply `bonsai2-pascal.patch`).
80
+
81
+ ### Critical Environment Variables (Mandatory)
82
+ Before starting the server, set these environment variables to enable Pascal CUDA kernels and prevent CPU busy-polling:
83
+
84
+ #### Windows (PowerShell / CMD):
85
+ ```bat
86
+ set GGML_CUDA_ROWLANE=1
87
+ set GGML_CUDA_RL_N4_LONG=1
88
+ set CUDA_DEVICE_SCHEDULE=BLOCKING_SYNC
89
+ ```
90
+
91
+ #### Linux (Bash):
92
+ ```bash
93
+ export GGML_CUDA_ROWLANE=1
94
+ export GGML_CUDA_RL_N4_LONG=1
95
+ export CUDA_DEVICE_SCHEDULE=BLOCKING_SYNC
96
+ ```
97
+
98
+ ---
99
+
100
+ ## ⚑ Recommended Run Configurations
101
+
102
+ ### 1. Default Production Mode (128k Context + Grafted MTP + Vision)
103
+ Run the single unified model with vision on a 16GB GPU:
104
+ ```bash
105
+ ./llama-server \
106
+ -m "Tals-coder-01.gguf" \
107
+ --mmproj "Tals-coder-01-mmproj.gguf" \
108
+ --mmproj-offload \
109
+ --image-min-tokens 1024 \
110
+ -ngl 99 \
111
+ -c 128000 \
112
+ -ctk q8_0 -ctv q4_0 \
113
+ -fa on -np 1 -t 4 -tb 4 --poll 0 \
114
+ --load-mode mmap --reasoning-preserve \
115
+ --spec-type draft-mtp --spec-draft-n-max 2 --spec-draft-p-min 0.2 \
116
+ --backend-sampling --jinja \
117
+ --host 127.0.0.1 --port 8080
118
+ ```
119
+
120
+ ### 2. High-Precision Coding Mode (64k Context + FP16 KV Cache)
121
+ Maximum precision for complex mathematical derivations:
122
+ ```bash
123
+ ./llama-server \
124
+ -m "Tals-coder-01.gguf" \
125
+ --mmproj "Tals-coder-01-mmproj.gguf" \
126
+ -ngl 99 \
127
+ -c 65536 \
128
+ -ctk f16 -ctv f16 \
129
+ -fa on -np 1 -t 4 -tb 4 --poll 0 \
130
+ --spec-type draft-mtp --spec-draft-n-max 2 --spec-draft-p-min 0.2 \
131
+ --backend-sampling --host 127.0.0.1 --port 8080
132
+ ```
133
+
134
+ ### 3. Extreme Context Mode (262k Native Context on 16GB VRAM)
135
+ Process entire codebases and large book-length documents with zero CPU offload:
136
+ ```bash
137
+ ./llama-server \
138
+ -m "Tals-coder-01.gguf" \
139
+ -ngl 99 \
140
+ -c 262144 \
141
+ -ctk q4_0 -ctv q4_0 \
142
+ -fa on -np 1 -t 4 -tb 4 --poll 0 \
143
+ --spec-type draft-mtp --spec-draft-n-max 2 --spec-draft-p-min 0.2 \
144
+ --backend-sampling --host 127.0.0.1 --port 8080
145
+ ```
146
+
147
+ ---
148
+
149
+ ## πŸ’» OpenCode / Cline / Continue Configuration
150
+
151
+ Set your tool's API endpoint to:
152
+ * **Base URL:** `http://127.0.0.1:8080/v1`
153
+ * **Model Name:** `tals-coder-01`
154
+ * **API Key:** `not-needed` (any string)
155
+ * **Temperature:** `0.0` – `0.2` (Deterministic coding & reasoning)
156
+
157
+ ---
158
+
159
+ ## πŸ™ Credits & Acknowledgements
160
+
161
+ Special thanks to the open-source creators whose foundational work made this custom GGUF quant distribution possible:
162
+ * **[Ukisai](https://huggingface.co/ukisai/Swift-Bonsai-2-GGUF):** Creator of the original **Swift-Bonsai-2-PQ2_0.gguf** (Ternary Bonsai 2) model weights and quantization basis.
163
+ * **[killy369 / Kilian](https://huggingface.co/killy369/Ternary-Bonsai-2-27B-MTP-drafter-GGUF):** Creator of the **Ternary-Bonsai-2-27B-MTP-drafter-GGUF** native draft weights and pruned 64k vocabulary.
164
+ * **[Prism ML / Pascal](https://github.com/prism-ml):** For pioneering ternary Hadamard kernels and custom llama.cpp acceleration.
165
+ * **Qwen Team:** For the underlying Qwen 3.5 architecture.
166
+
167
+ Distributed under the **Apache 2.0** license.