# Ternary Bonsai 2.5 27B

PrismML’s PTQ1_0 file fits in VRAM with MTP and a 96k window. Decode reaches 89.9 tok/s with thinking off.

- Recipe id: `ternary-bonsai-27b`  ·  status: measured  ·  updated 2026-11-29
- Model: [Ternary Bonsai 2.5 27B](https://huggingface.co/prism-ml/Ternary-Bonsai-2.5-27B-GGUF) (27B Ternary dense Qwen3.8-27B hybrid)
- Weights: GGUF PTQ1_0-mtp, 6.23 GB, from https://huggingface.co/prism-ml/Ternary-Bonsai-2.5-27B-GGUF, file `Ternary-Bonsai-2.5-27B-PTQ1_0-mtp.gguf`, revision `28a7093cc`
- Engine: [llama.cpp](https://github.com/PrismML-Eng/llama.cpp) prism-b12232-f702476
- Hardware: RTX 3060 12 GB, 62 GB RAM, i5-12500
- Context: 98,304 tokens
- Placement: Model and KV caches in VRAM.
- Contributor: [David Hatley](https://github.com/davidghatley)

## Run it

From `ternary-bonsai-27b/` in a clone of https://github.com/davidghatley/3060-recipes:

```sh
./serve.sh
```

API: OpenAI-compatible /v1 on port 8108

Key flags: `VARIANT=base|q2|uncensored|uncensored-mtp|lora`, `TB_PROFILE=default|long|full|card|stock`, `-ctk q8_0 -ctv q8_0 -ctkd q8_0 -ctvd q8_0 -ub 512`, `--spec-type draft-mtp --spec-draft-n-max 3 --spec-draft-p-min 0`

The script itself (`ternary-bonsai-27b/serve.sh`, machine paths shown as `$MODELS`, `$SCRATCH`, `~`; set them to where your weights and builds live):

```sh
#!/usr/bin/env bash
# PrismML Ternary Bonsai 2.5 27B (Qwen3.8-27B, ternary weights, 1.75 bpw) all in VRAM on one RTX 3060 12 GB.
# OpenAI-compatible on 127.0.0.1:8108. See README.md / RESULTS.md; experiment log in PLAN.md.
#   ./serve.sh                       default profile on the base PTQ1_0-mtp file (PrismML fork)
#   TB_PROFILE=long ./serve.sh       192k window, q4_0 K/V, MTP (lossy K/V, see RESULTS.md)
#   TB_PROFILE=full ./serve.sh       the full native 262k window, q4_0 K/V, no MTP (does not fit with it)
#   TB_PROFILE=card ./serve.sh       the command from prism-ml's consumer-GPU MTP preset (16k, MTP n=3, p-min 0)
#   TB_PROFILE=stock ./serve.sh      plain llama-server defaults (fit picks window, layers, slots) + --jinja
#   VARIANT=q2 ./serve.sh            Q2_0-mtp file on stock llama.cpp master (no fork needed)
#   VARIANT=uncensored ./serve.sh    AtomicChat's baked uncensored PTQ1_0 (no MTP head in that file)
#   VARIANT=uncensored-mtp ./serve.sh  the same weights + prism-ml's MTP head (local graft: tools/graft_mtp.py)
#   VARIANT=lora ./serve.sh          base PTQ1_0-mtp + AtomicChat's uncensored LoRA at runtime (scale 1.25)
#   TB_MMPROJ=1 ./serve.sh           also load the vision projector (image input)
# Every knob has a TB_* env override; extra args go to llama-server. Holds the shared GPU lock (gpu_run) while serving.
set -euo pipefail
W=$MODELS/ternary-bonsai-27b
FORK=$SCRATCH/llama.cpp/prism-b12232-f70247610/bin
MASTER=$SCRATCH/llama.cpp/master-225a5345b/bin
PTQ=$W/prism-ml/Ternary-Bonsai-2.5-27B-PTQ1_0-mtp.gguf
Q2=$W/prism-ml/Ternary-Bonsai-2.5-27B-Q2_0-mtp.gguf
UNC=$W/atomicchat/Ternary-Bonsai-2.5-27B-Uncensored-PTQ1_0.gguf
# Local copy: the PTQ1_0-mtp file with AtomicChat's 36 edited matrices copied in (tools/graft_mtp.py, verified byte-identical)
UNCMTP=${TB_UNCMTP:-$W/local/Ternary-Bonsai-2.5-27B-Uncensored-PTQ1_0-mtp-graft-local.gguf}
LORA=$W/atomicchat/Ternary-Bonsai-2.5-27B-Uncensored-LoRA.gguf
MMPROJ=$W/prism-ml/Ternary-Bonsai-2.5-27B-mmproj-Q8_0.gguf

# Variant: file, engine, whether the file has an MTP head, LoRA
v_lora=()
case "${VARIANT:-base}" in
  base)       v_m=$PTQ; v_bin=$FORK;   v_mtp=1 ;;
  q2)         v_m=$Q2;  v_bin=$MASTER; v_mtp=1 ;;
  uncensored) v_m=$UNC; v_bin=$FORK;   v_mtp=0 ;;
  uncensored-mtp) v_m=$UNCMTP; v_bin=$FORK; v_mtp=1 ;;
  lora)       v_m=$PTQ; v_bin=$FORK;   v_mtp=1; v_lora=(--lora-scaled "$LORA:${TB_LORA_SCALE:-1.25}") ;;
  *) echo "VARIANT must be base, q2, uncensored, uncensored-mtp or lora" >&2; exit 2 ;;
esac

# Profiles (PLAN.md rows). p_ctx=0 / p_fit=on: llama-server picks the window and layout itself (stock).
case "${TB_PROFILE:-default}" in
  stock)   p_ctx=0;      p_kv=f16;  p_ub=512; p_fa=auto; p_fit=on;  p_spec=none; p_n=3; p_pmin=0 ;;
  card)    p_ctx=16384;  p_kv=f16;  p_ub=512; p_fa=on;   p_fit=off; p_spec=mtp;  p_n=3; p_pmin=0 ;;
  default) p_ctx=98304;  p_kv=q8_0; p_ub=512; p_fa=on;   p_fit=off; p_spec=mtp;  p_n=3; p_pmin=0 ;;
  long)    p_ctx=196608; p_kv=q4_0; p_ub=256; p_fa=on;   p_fit=off; p_spec=mtp;  p_n=3; p_pmin=0 ;;
  full)    p_ctx=262144; p_kv=q4_0; p_ub=256; p_fa=on;   p_fit=off; p_spec=none; p_n=3; p_pmin=0 ;;
  *) echo "TB_PROFILE must be default, long, full, card or stock" >&2; exit 2 ;;
esac
# Smaller windows where the profile's does not fit (b12): the Q2_0 file is 1.6 GB larger; the mmproj adds 0.6 GB.
case "${VARIANT:-base}:${TB_PROFILE:-default}" in
  q2:default) p_ctx=49152 ;;
  q2:long)    p_ctx=98304 ;;
  q2:full)    p_ctx=131072 ;;
esac
if [ "${TB_MMPROJ:-0}" = 1 ] && [ "${VARIANT:-base}" != q2 ]; then
  case "${TB_PROFILE:-default}" in default) p_ctx=65536 ;; long) p_ctx=131072 ;; full) p_ctx=196608 ;; esac
fi
BIN=${TB_BIN:-$v_bin}
MODEL=${TB_MODEL:-$v_m}
[ -f "$MODEL" ] || { echo "model file not found: $MODEL (uncensored-mtp: run tools/graft_mtp.py first, see README)" >&2; exit 2; }
CTX=${TB_CTX:-$p_ctx}
KV=${TB_KV:-$p_kv}
KV_V=${TB_KV_V:-$KV}
SPEC=${TB_SPEC:-$p_spec}
[ "$v_mtp" = 0 ] && [ "$SPEC" = mtp ] && SPEC=none     # the uncensored file has no MTP head
NGL_ARGS=(-ngl "${TB_NGL:-99}"); [ "${TB_PROFILE:-default}" = stock ] && [ -z "${TB_NGL:-}" ] && NGL_ARGS=()
CTX_ARGS=(-c "$CTX"); [ "$CTX" = 0 ] && CTX_ARGS=()
SPEC_ARGS=()
case "$SPEC" in
  none) ;;
  # -ctkd/-ctvd: the MTP context's own K/V (one layer) is f16 unless set; it follows the main K/V type by default.
  mtp) SPEC_ARGS=(--spec-type draft-mtp --spec-draft-n-min 0 --spec-draft-n-max "${TB_DRAFT_N:-$p_n}" --spec-draft-p-min "${TB_DRAFT_PMIN:-$p_pmin}"
         -ctkd "${TB_KV_DRAFT:-$KV}" -ctvd "${TB_KV_DRAFT:-$KV_V}") ;;
  *) echo "TB_SPEC must be none or mtp" >&2; exit 2 ;;
esac
NP_ARGS=(-np "${TB_NP:-1}"); [ "${TB_PROFILE:-default}" = stock ] && [ -z "${TB_NP:-}" ] && NP_ARGS=()
MM_ARGS=(--no-mmproj); [ "${TB_MMPROJ:-0}" = 1 ] && MM_ARGS=(--mmproj "$MMPROJ")
# Sampling: the card's thinking-mode settings (temp 1.0, top-p 0.95, top-k 20, min-p 0, no penalties).
SAMP=${TB_SAMPLING:---temp 1.0 --top-p 0.95 --top-k 20 --min-p 0 --repeat-penalty 1.0 --presence-penalty 0}
THINK=${TB_THINK:-on}

export LD_LIBRARY_PATH="$SCRATCH/envs/llama-build-cuda/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
# Everything sits in VRAM; the mmap'd file still counts in the page cache that memcap sees (AGENTS.md traps).
export GPU_RUN_MEM=${GPU_RUN_MEM:-24G}
# TB_NO_GPU_RUN=1: start llama-server directly (already inside a gpu_run session, see tools/gpu_batch.sh)
RUN=("$HOME/anime-pipeline/tools/gpu_run" --free --need "${TB_NEED:-10000}" --wait "${TB_WAIT:-3600}")
[ -n "${TB_NO_GPU_RUN:-}" ] && RUN=()
CMD=("$BIN/llama-server" -m "$MODEL" --alias "${TB_ALIAS:-ternary-bonsai-27b}" "${MM_ARGS[@]}" "${v_lora[@]}"
  "${NGL_ARGS[@]}" --fit "${TB_FIT:-$p_fit}" "${CTX_ARGS[@]}" "${NP_ARGS[@]}" -t "${TB_THREADS:-6}"
  -b "${TB_BATCH:-2048}" -ub "${TB_UBATCH:-$p_ub}" -fa "${TB_FA:-$p_fa}" -ctk "$KV" -ctv "$KV_V"
  "${SPEC_ARGS[@]}"
  --jinja --reasoning-format deepseek --reasoning "$THINK" $SAMP
  --host 127.0.0.1 --port "${TB_PORT:-8108}" ${TB_EXTRA:-} "$@")
if [ "${TB_DRY:-}" = 1 ]; then printf '%q ' "${CMD[@]}"; echo; exit 0; fi
exec "${RUN[@]}" prlimit --core=0 "${CMD[@]}"
```

## Measured results

| Metric | Conditions | Value | Stock | Ceiling | Source |
|---|---|---|---|---|---|
| decode | Empty context, thinking off | 89.9 tok/s | 47.6 |  | [ternary-bonsai-27b/RESULTS.md:52](https://github.com/davidghatley/3060-recipes/blob/main/ternary-bonsai-27b/RESULTS.md#L52) |
| decode | Empty context, thinking on | 65.7 tok/s | 47.4 |  | [ternary-bonsai-27b/RESULTS.md:53](https://github.com/davidghatley/3060-recipes/blob/main/ternary-bonsai-27b/RESULTS.md#L53) |
| decode | 90k depth | 55.7 tok/s |  |  | [ternary-bonsai-27b/RESULTS.md:54](https://github.com/davidghatley/3060-recipes/blob/main/ternary-bonsai-27b/RESULTS.md#L54) |
| prefill | 8k prompt | 572 tok/s | 603 |  | [ternary-bonsai-27b/RESULTS.md:55](https://github.com/davidghatley/3060-recipes/blob/main/ternary-bonsai-27b/RESULTS.md#L55) |
| needles | 49k and 92k prompts | 3/3 found |  |  | [ternary-bonsai-27b/RESULTS.md:57](https://github.com/davidghatley/3060-recipes/blob/main/ternary-bonsai-27b/RESULTS.md#L57) |
| decode | Locally grafted uncensored MTP, thinking off | 93.5 tok/s |  |  | [ternary-bonsai-27b/RESULTS.md:91](https://github.com/davidghatley/3060-recipes/blob/main/ternary-bonsai-27b/RESULTS.md#L91) |

## Caveats

- The default PTQ1_0 file requires PrismML’s fork. The full profile disables MTP to fit. Created using Bonsai by Prism ML.

## Credits

- PrismML: Ternary Bonsai weights, MTP head and image projector. (https://huggingface.co/prism-ml)
- PrismML llama.cpp fork: PTQ1_0 runtime and CUDA kernels. (https://github.com/PrismML-Eng/llama.cpp)
- AtomicChat: The Q4_K_M file the Nemotron-Labs-Image recipe serves, and the tested llama.cpp revision it runs on. (https://huggingface.co/AtomicChat/Nemotron-Labs-Image-30B-A3B-GGUF)
- Qwen: The 15 mtp.* tensors grafted back into the 3D coder came from Qwen3.5-4B; Kintsugi-27B is built on Qwen3.8-27B. (https://huggingface.co/Qwen/Qwen3.5-4B)
- Unsloth: The Mainline_Support files are the max-speed options of the Inkling recipe (41.4 tok/s whole-on-GPU); UD-Q3_K_XL was the smaller-expert test on Flint. (https://huggingface.co/unsloth/Inkling-2-Mini-GGUF)
- llama.cpp (ggml-org and contributors): The engine for Flint, the 3D coder and Inkling-2-Mini, and the base of the Kintsugi fork. (https://github.com/ggml-org/llama.cpp)
- ggml-org: Flint-Q4_K_M.gguf and Inkling-2-Mini-IQ4_NL.gguf are the files the two recipes serve; the Q8_0 files are the KLD references. (https://huggingface.co/ggml-org/Flint-GGUF)
- 0xSero / Sybil Solutions: The tuning method behind the Flint and Inkling recipes; its q8_0 KV gotcha is one we confirmed on Flint. (https://github.com/sybil-solutions/inference-optimisation-skill)

## Reproductions

None yet. Ran it on your own 3060? Report your numbers: https://github.com/davidghatley/3060-recipes/issues/new?template=reproduction.yml

## Machine-readable

- https://davidghatley.github.io/3060-recipes/recipes/ternary-bonsai-27b/recipe.json
- Folder with scripts and raw runs: https://github.com/davidghatley/3060-recipes/tree/main/ternary-bonsai-27b
- Full results log: https://raw.githubusercontent.com/davidghatley/3060-recipes/main/ternary-bonsai-27b/RESULTS.md

## Full write-up (README)

This recipe serves PrismML's [Ternary Bonsai 2.5 27B](https://huggingface.co/prism-ml/Ternary-Bonsai-2.5-27B-GGUF) on the RTX 3060 12 GB
with **every layer in VRAM**.

The model is Qwen3.8-27B (64 layers, 3 Gated DeltaNet : 1 full attention, 262k native window) re-trained to ternary
weights in a rotated (Hadamard) basis. The weights take 1.75 bits each, so the trunk is 5.4 GB. The `-mtp` files
add the model's multi-token-prediction head.

Every 3- and 4-bit file of this base model needs part of the model in RAM on a 12 GB card
(`../qwen38-27b-family/`). This one leaves room for three things:
- **the MTP head.** With every layer on the GPU the verify step is cheap, so MTP n=3 roughly doubles decode, to ~90 tok/s.
- **a long window.** On PrismML's llama.cpp fork, q8_0 or q4_0 K/V costs MTP nothing. The default serves 96k with MTP, `long` 192k
  with MTP, and `full` the native 262k with needles found at 248k.
- **an uncensored variant at the same speed.** AtomicChat's baked uncensored file has no MTP head. Copying its 36
  edited matrices into prism-ml's MTP file brings it back to 93.5 tok/s.

Numbers and quality are in [RESULTS.md](RESULTS.md). The experiment log is [PLAN.md](PLAN.md), the ceilings are in
[THEORY.md](THEORY.md), and the raw data is in `runs/`.

### Result

| Single user | Stock (`llama-server -m … --jinja`) | **This recipe (default)** | `long` | `full` |
|---|---:|---:|---:|---:|
| Decode, thinking off | 47.6 tok/s | **89.9 tok/s (1.9×)** | 90.3 | 47.2 |
| Decode, thinking on | 47.4 tok/s | **65.7 tok/s (1.4×)** | 64.9 | 47.0 |
| Decode deep in the window | – | **55.7 at 90k** | 36.8 at 180k | 8.2 at 241k |
| Prefill 8k / 32k | 603 / – tok/s | 572 / 503 tok/s | 562 / 496 | 588 / 515 |
| Prefill near the window (TTFT) | – | 387 at 90k (241 s) | 273 at 186k (680 s) | 242 at 248k (17 min) |
| Window | 56,832 (fit's choice, shared by 4 slots) | **98,304, q8_0 K/V** | 196,608 q4_0 | 262,144 q4_0 |
| Needles at ~50% / ~95% | – | 3/3 / 3/3 | 3/3 / 3/3 | 3/3 / 3/3 |
| Card (incl. desktop) | 11.0 GB | 11.36 GB | 11.46 GB | 11.58 GB |

- **Plain decode:** 47.5 tok/s, 83% of the 57.0 tok/s ceiling (6.0 GB read per token at 342 GB/s).
- **MTP:** accepts 80% of drafts on code and ~50% with thinking on.
- **The card's own MTP preset** (`TB_PROFILE=card`: 16k, f16) runs at 91.7 / 71.0. The default matches it with 6× the window.
- **codeeval:** 8/8. The q8_0 K/V of the default sits at the KLD floor, so its only change from the published model is MTP, which is lossless.
- **Image input** through the mmproj works: 3/3 on a shapes-and-colours test.
- **On the same card:**
  - the same base model as IQ3_XXS (`../qwen38-27b-family/`) decodes at 16.6 tok/s at 32k and 7.5 at 128k;
  - Kintsugi-27B (`../kintsugi-27b/`) runs ~16 plain and 35–60 with its drafter.

### Which config

| `TB_PROFILE=` | MTP | Window, K/V | Decode d0 / deep | Prefill 8k | Card | Use |
|---|---|---|---:|---:|---:|---|
| **`default`** | n=3 | 96k q8_0 | 89.9 / 55.7 (90k) | 572 | 11.36 GB | chat, coding, agents: lossless |
| `long` | n=3 | 192k q4_0, ub 256 | 90.3 / 36.8 (180k) | 562 | 11.46 GB | big documents and repos; q4_0 K/V is lossy (KLD 0.005) |
| `full` | – | 262k q4_0, ub 256 | 47.2 / 8.2 (241k) | 588 | 11.58 GB | the whole native window; slow at the far end |
| `card` | n=3 | 16k f16 | 91.7 / – | 550 | 8.8 GB | prism-ml's consumer-GPU preset, as published |
| `stock` | – | fit's choice | 47.6 / – | 603 | 11.0 GB | the baseline |

| `VARIANT=` | File, engine | Decode (32k) off / on | Notes |
|---|---|---:|---|
| **`base`** | prism-ml PTQ1_0-mtp, PrismML fork | 89.9 / 65.5 | default |
| `q2` | prism-ml Q2_0-mtp, **stock llama.cpp** | 50.7 / 40.6 | no fork needed; same weights (KLD at the floor); 1.6 GB larger, so windows 48k / 96k / 131k |
| `uncensored` | AtomicChat's baked PTQ1_0 | 47.5 / 47.3 | the published file; no MTP head |
| `uncensored-mtp` | the same edit + prism-ml's MTP head (local copy, `tools/graft_mtp.py`) | 93.5 / 68.1 | refusals 20/20 answered, codeeval 7/8 |
| `lora` | base + AtomicChat's LoRA ×1.25 at runtime | 84.8 / 66.4 | 3× the baked file's KLD and +4.3% code perplexity |

`TB_MMPROJ=1` loads the vision projector (+0.6 GB). The windows drop to 64k / 131k / 192k (default / long / full).
The VRAM figures leave 0.7–0.9 GB of the card free, so close other GPU programs before `long` or `full`.

### Use it

```bash
## 1. weights (pinned; ../scripts/hf_get.sh fetches, resumes and checks sha256)   ../notes/batch2/downloads.tsv
##    prism-ml/Ternary-Bonsai-2.5-27B-GGUF @ 28a7093cc -> $MODELS/ternary-bonsai-27b/prism-ml/
##      Ternary-Bonsai-2.5-27B-PTQ1_0-mtp.gguf (e0fc5f3d…), -Q2_0-mtp.gguf (b0f83de8…), -mmproj-Q8_0.gguf (6807ede6…)
##    AtomicChat/Ternary-Bonsai-2.5-27B-Uncensored-GGUF @ 500fdfc33 -> $MODELS/ternary-bonsai-27b/atomicchat/
##      Ternary-Bonsai-2.5-27B-Uncensored-PTQ1_0.gguf (f6b5f856…), -Uncensored-LoRA.gguf (0573a04f…)
## 2. engine: PrismML-Eng/llama.cpp tag prism-b12232-f702476, CUDA build
##    git -C $SCRATCH/llama.cpp/src-r2 fetch prismml --tags
##    HF_UI_VERSION=b12017 ./build-r2.sh prism-b12232=prism-b12232-f702476   # -> prism-b12232-f70247610/bin
##    (VARIANT=q2 runs on stock master-225a5345b instead)
## 3. optional, for VARIANT=uncensored-mtp: the local copy with the MTP head (6.2 GB, ~1 min, stdlib only)
python3 -I tools/graft_mtp.py $MODELS/ternary-bonsai-27b/prism-ml/Ternary-Bonsai-2.5-27B-PTQ1_0-mtp.gguf \
  $MODELS/ternary-bonsai-27b/atomicchat/Ternary-Bonsai-2.5-27B-Uncensored-PTQ1_0.gguf \
  $MODELS/ternary-bonsai-27b/local/Ternary-Bonsai-2.5-27B-Uncensored-PTQ1_0-mtp-graft-local.gguf
##    (expects 36 replaced tensors, sha256 29331c54…; --check lists them without writing)
## 4. serve (through gpu_run, OpenAI-compatible on 127.0.0.1:8108, model name ternary-bonsai-27b)
./serve.sh                                  # default: 96k q8_0, MTP n=3
TB_PROFILE=long ./serve.sh                  # 192k q4_0, MTP n=3
TB_PROFILE=full ./serve.sh                  # 262k q4_0, no MTP
VARIANT=uncensored-mtp ./serve.sh           # uncensored at full speed
TB_MMPROJ=1 ./serve.sh                      # image input
TB_DRY=1 ./serve.sh                         # print the llama-server command
```

The default command:
```
llama-server -m Ternary-Bonsai-2.5-27B-PTQ1_0-mtp.gguf --no-mmproj -ngl 99 --fit off -c 98304 -np 1 -t 6 -b 2048 -ub 512 \
  -fa on -ctk q8_0 -ctv q8_0 --spec-type draft-mtp --spec-draft-n-min 0 --spec-draft-n-max 3 --spec-draft-p-min 0 \
  -ctkd q8_0 -ctvd q8_0 --jinja --reasoning-format deepseek --reasoning on \
  --temp 1.0 --top-p 0.95 --top-k 20 --min-p 0 --repeat-penalty 1.0 --presence-penalty 0 --host 127.0.0.1 --port 8108
```

Notes for these flags:
- **`-np 1`:** the auto setting makes 4 slots that share the window.
- **`-ctkd/-ctvd`:** these matter. Without them the MTP context keeps its own K/V at f16, which costs 0.9 GB at 224k.
- **Samplers:** the card's thinking-mode set.
- **Thinking:** the chat template thinks at effort `xhigh` by default. Pass `"chat_template_kwargs": {"reasoning_effort": "medium"}`,
  or `"enable_thinking": false`, per request. `TB_THINK=off` turns thinking off server-wide.

### Limits

- **Deep decode in `full` is slow:** 8.2 tok/s at 241k, 25% of its bytes ceiling. The single-token attention over a long
  q4_0 cache is the limit. MTP's verify amortises it, which is why `long` keeps 36.8 at 180k. MTP does not fit at
  262k (the draft's recurrent-state copies need another 0.6 GB).
- **Long prompts take minutes:** prefill is compute bound at 240–590 tok/s on this card, so a 186k prompt takes 11 min before the first token.
- **Lossy profiles:** q4_0 K/V (`long`, `full`) has 10× the KLD floor (0.005 wiki).
- **Not measured:**
  - error against the original BF16 model (no reference on disk);
  - concurrency;
  - answers above 8k tokens.
- **The PrismML testing-kernel env knobs** (`GGML_CUDA_FWHT_MMQ=1 GGML_CUDA_FWHT_MMQ_GLU=1`, ...) give +5–7% prefill but
  take 0.8 GB of VRAM, so the profiles leave them off.
- **Memory cap:** the 24 GB `gpu_run` cap counts the mmap'd file's page cache (10–16 GB here, 23.7 GB with two files in cache).

### Licences

- **The model:** Apache-2.0 (card and NOTICE), built from Qwen3.8-27B (Apache-2.0).
  - PrismML asks for attribution when the model is redistributed or deployed publicly: "Created using Bonsai by Prism ML."
  - The MTP head started from Qwen3.8-27B's MTP head (via Unsloth's UD-Q4_K_M conversion) and was fine-tuned by Prism ML.
- **AtomicChat's uncensored file and LoRA:** Apache-2.0. The `uncensored-mtp` local copy is a derivative of both
  repositories' files. It is not redistributed here; `tools/graft_mtp.py` rebuilds it.
- **The uncensored variants answer requests a stock assistant refuses.** That is their purpose; what they are used for
  is the user's responsibility.

### Tools

| Tool | What it does |
|---|---|
| `serve.sh` | the launcher: `VARIANT=`, `TB_PROFILE=`, MTP, window, K/V, mmproj; holds the GPU lock while serving |
| `tools/graft_mtp.py` | builds the `uncensored-mtp` copy: prism-ml's MTP file with AtomicChat's edited tensors copied in; checks names, types and shapes, `--check` only lists |
| `tools/srv.sh <label> [ENV=…] -- <cmd>` | one server start/stop through `../scripts/with_server.sh` on port 8108; records the command and env in `runs/` |
| `tools/gpu_batch.sh`, `tools/launch.sh`, `tools/chain.sh` | one GPU-lock hold per batch (`GPU_RUN_MEM=24G`), detached, logged to `runs/batches/` |
| `tools/srvtest.py` | prefill, decode (with draft acceptance) and needle client on llama-server's own timings |
| `tools/measure.sh <label> <window>` | the measurement set: prefill 8k/32k/92%, decode empty and deep, needles 50%/95%, codeeval, greedy, memory |
| `tools/image_test.py` | image input check through the mmproj (stdlib-drawn PNG, three shapes) |
| `tools/kld.sh` | KL divergence of a change against the PTQ1_0-mtp file on the fork |
| `tools/greedy.py`, `tools/longans.py` | temperature-0 answers to fixed prompts; long answers with loop flags |
| `tools/codeeval_lenient.py` | `../scripts/codeeval.py`'s tasks also counting bare unfenced code |
| `tools/gguf_info.py` | GGUF header and tensor summary (`runs/gguf-*.txt`) |
| `tools/mkconfigs.py` | writes `configs/<label>.json` from each run's command, env and ledger rows |
| `tools/mem.sh`, `tools/concurrent.py` | memory and startup of a running server; N simultaneous requests |

### Credits

- **[PrismML](https://huggingface.co/prism-ml)**, for Ternary Bonsai 2.5 27B: the ternary training, the PTQ1_0 and
  Q2_0 GGUFs, the MTP head, the mmproj, the [llama.cpp fork](https://github.com/PrismML-Eng/llama.cpp) with its CUDA
  ternary, FWHT and MTP kernels, and the consumer-GPU MTP preset and sampler settings in
  [Bonsai-demo](https://github.com/PrismML-Eng/Bonsai-demo). Created using Bonsai by Prism ML.
- **[AtomicChat](https://huggingface.co/AtomicChat)**, for the uncensored edit, both
  [baked](https://huggingface.co/AtomicChat/Ternary-Bonsai-2.5-27B-Uncensored-GGUF) and as a LoRA.
- **[Qwen](https://huggingface.co/Qwen/Qwen3.8-27B)**, for Qwen3.8-27B, its architecture and MTP design; and
  [Unsloth](https://huggingface.co/unsloth/Qwen3.8-27B-GGUF), whose conversion the MTP head started from.
- **[llama.cpp](https://github.com/ggml-org/llama.cpp) and ggml-org**, for the engine, the upstream Q2_0 and Hadamard
  runtime support that lets the `q2` variant run on stock master, MTP speculative decoding and `llama-perplexity`.
- **Sibling recipes:** [`../qwen35-9b-heretic/`](../qwen35-9b-heretic/) and [`../qwen38-27b-family/`](../qwen38-27b-family/)
  for the batch tooling and the earlier MTP and K/V findings this one rechecked.
- **Method:** 0xSero's [inference-optimisation-skill](https://github.com/sybil-solutions/inference-optimisation-skill):
  ceilings first, one change at a time between controls, output gated as well as speed.
