File size: 8,499 Bytes
d5c7cda
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
---
license: cc-by-nc-sa-4.0
language:
  - en
library_name: onnx
pipeline_tag: text-generation
tags:
  - aac
  - augmentative-communication
  - accessibility
  - on-device
  - edge-inference
  - small-language-model
  - kid-aac
  - speech-therapy
  - non-verbal
  - peel-conditioning
  - tinky
inference: false
---

# 🧠 TinkyBrain v6 β€” On-Device PEEL-Conditioned AAC Language Model

**25.5M-param transformer that generates 6 distinct response tiles per prompt for non-verbal kids and stroke survivors. Runs offline on a 2017 Kindle Fire HD 10. No internet. No data leaves the device.**

| Metric | Value |
|---|---|
| Parameters | 25.5M |
| Architecture | d=512 Β· h=8 Β· L=6 Β· d_ff=1024 |
| Vocabulary | 12,599 (incl. PEEL conditioning tokens) |
| Max sequence length | 64 |
| Disk footprint (int8) | 24 MB |
| Inference (Kindle Fire HD 10 2017) | ~2.9 sec for 6 tiles |
| Inference (modern arm64 phone) | ~0.6-1.2 sec for 6 tiles |
| **Diversity score** | **0.975** |
| **Coherence score** | **0.838** |
| Training pairs | 41,519 (kid corpus only) |
| Training time | 161 minutes on M4 |

---

## What it does

Given a caretaker prompt like `"Let's play soccer!"`, TinkyBrain v6 generates **6 semantically distinct response tiles** that a non-verbal user can tap to communicate:

```
INPUT:  "let's play soccer"

TILE 1  (happy + share)            β†’ "that sounds fun !"
TILE 2  (happy + express_desire)   β†’ "i want to play soccer !"
TILE 3  (curious + inquire)        β†’ "do you play soccer ?"
TILE 4  (confident + suggest)      β†’ "let's play on the field !"
TILE 5  (positive + affirm)        β†’ "okay !"
TILE 6  (neutral + deny)           β†’ "no , i want to play with you ."
```

Six different intents β€” yes, want, question, suggest, mild yes, no β€” produced by **conditioning each forward pass on a different (emotion, action) PEEL pair**. No sampling, no temperature. Deterministic, reproducible, and architecturally guaranteed-diverse.

## Why "PEEL conditioning"

TinkyBrain was trained on conversation trees harvested with the Tinky 32-PEEL system. Each response in the training data carries semantic metadata fields (emotion, action, intent, register, etc). At training time, the model learns:

```
P(response | prompt + <emo_X> + <act_Y>)
```

instead of the flat `P(response | prompt)` most LMs learn. At inference, six fixed `(emo, act)` combos drive six forward passes:

```python
CANONICAL_PEEL = [
    ("happy",     "share"),           # generic enthusiasm
    ("happy",     "express_desire"),  # want / let's-do-it
    ("curious",   "inquire"),         # question back
    ("confident", "suggest"),         # propose alternative
    ("positive",  "affirm"),          # mild yes
    ("neutral",   "deny"),            # honest no
]
```

This produces six distinct tiles by **design**, not luck.

## Performance

Evaluated on a 200-prompt held-out kid-conversation set:

| | v4 (positional) | v5 (PEEL kids only) | v6 (PEEL kids+trees) |
|---|---|---|---|
| Diversity | 0.589 | 0.966 | **0.975** |
| Coherence | 0.944 | 0.815 | **0.838** |
| Eval loss | 1.32 | 1.17 | 1.34 |
| Per-branch align | 0.170 | 0.110 | 0.122 |
| Speed (tiles/sec) | 56 | 48 | **51** |

The diversity climb from v4 β†’ v5 (0.589 β†’ 0.966) is the v3β†’v4 lesson encoded: positional branch tokens alone cannot beat topic-attention; semantic PEEL conditioning can.

## Files in this repo

```
v6_brain_int8.onnx       24 MB   ⭐ Production-ready int8 quantized
v6_brain_fp32.onnx       97 MB     Reference fp32 (alignment-safe)
tokenizer.json          209 KB    word2idx for 12,599 entries
config.json               1 KB    Architecture parameters
grade_card.json          ~4 KB    Held-out evaluation result
LICENSE                            Custom non-commercial license
README.md                          (this file)
```

The training scripts, harvest pipeline, and PEEL canonicalization rules are **intentionally not published**. The architecture and weights are open for inspection and non-commercial use; the recipe stays private.

## Inference example (ONNX Runtime)

```python
import onnxruntime as ort
import numpy as np
import json

sess = ort.InferenceSession("v6_brain_int8.onnx")
with open("tokenizer.json") as f:
    word2idx = json.load(f)

PAD, BOS, EOS, SEP, UNK = 0, 1, 2, 3, 4

def encode(text):
    import re
    return [word2idx.get(t, UNK) for t in
            re.findall(r"[a-z']+|\d+|[.,!?]", text.lower())]

def decode(ids, idx2word):
    return " ".join(idx2word.get(i, "?") for i in ids
                    if not idx2word.get(i, "<unk>").startswith("<"))

idx2word = {v: k for k, v in word2idx.items()}

def six_tiles(prompt, max_tokens=20):
    inp = encode(prompt)
    canonical = [
        ("happy", "share"), ("happy", "express_desire"),
        ("curious", "inquire"), ("confident", "suggest"),
        ("positive", "affirm"), ("neutral", "deny"),
    ]
    out = []
    for emo, act in canonical:
        emo_id = word2idx.get(f"<emo_{emo}>", UNK)
        act_id = word2idx.get(f"<act_{act}>", UNK)
        tokens = [BOS] + inp + [emo_id, act_id, SEP]
        sep_anchor = len(tokens)
        for _ in range(max_tokens):
            x = np.array([tokens], dtype=np.int64)
            logits = sess.run(["logits"], {"tokens": x})[0]
            nt = int(np.argmax(logits[0, -1, :]))
            if nt in (PAD, EOS, SEP):
                break
            tokens.append(nt)
        out.append(decode(tokens[sep_anchor:], idx2word))
    return out

print(six_tiles("let's play soccer"))
```

## Inference on Android (Kotlin / ONNX Runtime Android)

The reference Kotlin engine in TinkySpeak Android uses ONNX Runtime 1.15.1
(later versions have alignment crashes on ARMv7 / Kindle Fire HD 10 2017).
Same PEEL inference loop. Same 6-tile output.

```kotlin
val session = OrtEnvironment.getEnvironment()
    .createSession("/path/to/v6_brain_int8.onnx")
// ... encode prompt + emo + act tokens
// ... session.run(...) β†’ argmax last token β†’ repeat until EOS
```

## Designed for the population the smartphone forgot

TinkyBrain v6 is the brain inside [TinkySpeak](https://tinkyspeak.com) and
[TinkyTown](https://tinkytown.com) β€” universal communication infrastructure for:

- πŸ§’ Non-verbal kids (autism, apraxia, cerebral palsy, Down syndrome)
- 🧠 Stroke survivors with aphasia or motor impairment
- πŸ‘΄ Dementia / progressive aphasia
- 🌍 LEP visitors at public buildings (125 languages via translation layer)
- 🦻 Deaf / hard-of-hearing in voice-required contexts

The model is **trained from scratch on kid-vocabulary data only**, which means
it architecturally cannot produce adult / harmful content β€” the words simply
don't exist in its vocabulary. This isn't a safety filter that can be jailbroken.
It's a **vocabulary boundary**.

## License

**CC-BY-NC-SA 4.0** with an explicit non-commercial restriction. See `LICENSE` for full text.

- βœ… Free for research, education, accessibility-focused projects, non-profits
- βœ… Free for individuals and families using it on their own AAC devices
- ❌ Commercial use requires written permission from the author
- ❌ Building competing AAC products on top of these weights is prohibited

If you want to build something commercial with this brain, contact: **lukekist@gmail.com**

## Citation

```bibtex
@misc{tinkybrain_v6_2026,
  title  = {TinkyBrain v6: On-Device PEEL-Conditioned Language Model
            for Augmentative and Alternative Communication},
  author = {Kist, Luke A.},
  year   = {2026},
  howpublished = {\url{https://huggingface.co/Hoodrobot/TinkyBrain-v6}},
  note   = {25.5M params. Trained from scratch on kid-conversation
            harvest with PEEL semantic conditioning. Runs offline
            on legacy ARMv7 Android devices.}
}
```

## Links

- 🌐 **TinkySpeak** (free AAC builder + brain): https://tinkyspeak.com
- πŸ›οΈ **TinkyTown** (universal communication kiosks for public buildings): https://tinkytown.com
- πŸ“§ **Contact / commercial licensing**: lukekist@gmail.com

---

> *"It only knows kid words. It was trained on conversations between kids
> and their teachers, period. Adult things β€” alcohol, violence, anything
> inappropriate β€” aren't filtered out. They literally don't exist in the
> model. It can't suggest them because it doesn't know them. The same way
> a 5-year-old doesn't know about bourbon. It's not censored. It's just…
> a kid."*

β€” Luke Kist, on building an AAC model from scratch instead of restricting an adult one.