A ternary (weights in {−1, 0, +1}) 2B model fine-tuned to play non-player characters in Brazilian Portuguese for a language-learning game: a baker, a waiter, a beach vendor talking with a student of Portuguese. It stays in character, remembers what the student said earlier in the conversation and answers in at most two short sentences.
Created using Bonsai by Prism ML.
The production file is 319 MB and runs in about 430 MB of RAM (2,048-token context), small enough for a phone.
| Step | Model | Who |
|---|---|---|
| Base | Qwen/Qwen3.5-2B (24 layers: 6 × (3 Gated DeltaNet + 1 Gated Attention), vocabulary 248,320, Apache 2.0) | Qwen Team |
| Ternary | prism-ml/Ternary-Bonsai-2-2B (ternary weights, FP16 scale per group of 128, fixed Walsh–Hadamard rotation, Apache 2.0; PrismML does not publish its training method) | PrismML |
| This model | NPC fine-tune by distillation from a Qwen3.5-4B teacher, then vocabulary cut to 24,000 tokens | this repo |
| Path | What |
|---|---|
bonsai2-2b-ptbr-npc-24k-PTQ1_0.gguf |
production: vocabulary cut to 24,000 tokens, 319 MB, ~430 MB RAM |
bonsai2-2b-ptbr-npc-PTQ1_0.gguf |
same weights, full 248,320-token vocabulary, 429 MB, ~620 MB RAM |
mlx/ |
fine-tuned weights in the layout of prism-ml/Ternary-Bonsai-2-2B-mlx-2bit (full vocabulary); load them as that repo's PACK-RUNTIME.md describes |
LICENSE, NOTICE.txt |
Apache 2.0 and PrismML's notice |
eval/ |
the 60 evaluation conversations of the production file and the verdicts |
code/ |
training, export, vocabulary cut, evaluation and judge scripts (comments and notes in Portuguese) |
PTQ1_0 is PrismML's ternary GGUF type. Tested with PrismML-Eng/llama.cpp at commit 6447906.
llama-server -m bonsai2-2b-ptbr-npc-24k-PTQ1_0.gguf -c 2048 -np 1 \
--cache-ram 0 -ctxcp 0 \
--reasoning-budget 0 --chat-template-kwargs '{"enable_thinking":false}' \
--temp 0 --repeat-penalty 1.15 --repeat-last-n 256 \
--dry-multiplier 0.8 --dry-base 1.75 --dry-allowed-length 2
The sampling flags matter: with plain greedy decoding the model repeats itself in 23 % of conversations; with repeat penalty + DRY it drops to 7 %. --cache-ram 0 -ctxcp 0 keeps RAM flat over long conversations (the prompt cache and the hybrid-model context checkpoints otherwise grow every turn; ~100 MB per turn measured on the 4B).
System prompt used in training and evaluation:
Você é Seu Jorge, padeiro simpático de uma padaria em Copacabana. Fique sempre no personagem, nunca diga que é uma IA. Responda em português do Brasil, em até 2 frases curtas.
PTQ1_0 (code/gguf_export.py).code/corte_vocab.py, code/corte_gguf.py): the 256 bytes, every token of the training data with its BPE merge closure, and the most frequent tokens of 20,000 Portuguese Wikipedia articles. 298 of 300 test chat texts tokenize identically, texts get 1.2 % more tokens, and 95 % of the evaluation replies are identical to the full-vocabulary model's.Data (not released): 37,509 Portuguese conversations — 13,277 dialogues from the game's activities, 20,000 Portuguese role-play conversations, 3,200 service dialogues generated from the NPC character cards, and 1,032 distilled memory conversations.
30 ten-turn conversations played by a scripted student, each run twice: with the plain system prompt above and with a full character sheet. The student introduces herself, says where she is from, orders something, asks whether the NPC is an AI, and later asks the NPC to recall those facts. Measured on a Mac with the production flags above.
| base Ternary Bonsai 2 2B | this model, full vocabulary | this model, 24k | |
|---|---|---|---|
| remembers the student's facts (plain / sheet) | 0.34 / 0.57 | 0.98 / 1.00 | 0.98 / 1.00 |
| remembers the city (plain / sheet) | 0.00 / 0.33 | 0.93 / 1.00 | 0.93 / 1.00 |
| says its own name | — | 1.00 | 1.00 |
| breaks character | 27 % | 0 % | 0 % |
| repeats itself | 100 % | 7 % / 0 % | 7 % / 0 % |
| at most 2 sentences | — | 100 % | 100 % |
| Portuguese only | — | 100 % | 100 % |
| RAM (MB) | — | 617 | 429 |
| judge score 1–5 (plain / sheet) | 1.84 / 2.41 | 3.67 / 3.46–3.53 | 3.72 / 3.49 |
The base model was measured with plain greedy decoding (with PrismML's recommended sampling it reaches 0.49 / 0.59 memory and 20–23 % out of character). The judge is Qwen3.6-27B (Q8_0) with a role-play rubric. For comparison, the same recipe on the 4B ternary model scores 3.81 / 3.61 but needs 1,208 MB of RAM.