Pack your model into a file, and run it anywhere.
After all that nudging, your model is nothing but numbers: the spots, the listening dials, the thinking dials, the guess dials. The nudge was only needed to find them. Write those numbers into one file, with a note saying which number belongs where, and anyone can open it and get your model back, exactly as it was, without training a thing. Squash each number into fewer bits and the file shrinks, and still mostly works.
- ✓ 1Do it by hand
- ✓ 2Build it
- 3Watch it work
- 4Say it back
- 5Name it
2 · Pack it 4,844 numbers
The file starts with 8 bytes saying how long the note is. The note is plain text: every table's name, its shape, how each number is stored, and where its bytes start and end. Your letter book rides along in the note too, so the file is all you need. Then come the numbers, back to back.
| table | shape | numbers |
|---|---|---|
| spots | 12 × 16 | 192 |
| places | 16 × 16 | 256 |
| block1.ask | 16 × 16 | 256 |
| block1.tag | 16 × 16 | 256 |
| block1.say | 16 × 16 | 256 |
| block1.mix | 16 × 16 | 256 |
| block1.w1 | 16 × 32 | 512 |
| block1.b1 | 32 | 32 |
| block1.w2 | 32 × 16 | 512 |
| block1.b2 | 16 | 16 |
| block2.ask | 16 × 16 | 256 |
| block2.tag | 16 × 16 | 256 |
| block2.say | 16 × 16 | 256 |
| block2.mix | 16 × 16 | 256 |
| block2.w1 | 16 × 32 | 512 |
| block2.b1 | 32 | 32 |
| block2.w2 | 32 × 16 | 512 |
| block2.b2 | 16 | 16 |
| out | 16 × 12 | 192 |
| bias | 12 | 12 |
{"spots":{"dtype":"F32","shape":[12,16],"data_offsets":[0,768]},"places":{"dtype":"F32","shape":[16,16],"data_offsets":[768,1792]},"block1.ask":{"dtype":"F32","shape":[16,16],"data_offsets":[1792,2816]},"block1.tag":{"dt…file size: 20.4 kB
score after packing at 32 bits: 2.53 (before: 2.53)
32 bits keeps every number almost exactly. At 8 bits each table keeps one scale, and every number is rounded to one of 255 steps; at 4 bits, one of 15. The file shrinks by four or eight times. Watch the score: a trained model barely notices 8 bits, and 4 bits costs a little.
3 · Open it and run it no nudging here
Nothing opened yet.
…
This is all a chat app does when you send it a message. It opens a file of numbers somebody else trained, never changes them, and runs them forward one letter at a time: look back, guess the shares, pick one, repeat.
These ideas have real names. They unlock once you can say, without looking, what's in the file, why the note comes first, and what squashing costs.