Generative language models for inference on Raspberry Pi Zero. Just Another Model(s) for the smallest Rasberry Pi!
| Variant | Type | Weights | Description |
|---|---|---|---|
neuralpi (WIP) |
Decoder transformer | ~25 MB | 8-layer attention model, KV cache inference |
jamxe |
2-layer MLP | 76 KB | 512→512→45, dual-source feature hash with frozen query anchor |
jamkid |
2-layer MLP | 76 KB | Same engine as jamxe, trained on a kid-register dataset |
jamxe and jamkid respond in milliseconds.
neuralpi (work in progress) will be slower but architecturally more capable
Requires gcc and make. No other dependencies for inference.
makeTo cross-compile for Pi Zero (ARM1176)
CC=arm-linux-gnueabihf-gcc makeTo build a single variant:
make -C neuralpi # decoder transformer
make -C jamxe # extended MLP (~76 KB weights)
make -C jamkid # kid register (~76 KB weights, same engine as jamxe)Each variant is a REPL: type a query, get a response
./jamxe/dist/jamxe jamxe/weights_xe.bin
./jamkid/dist/jamkid jamkid/weights_jamkid.bin
./neuralpi/dist/neuralpi neuralpi/weights_neuralpi.binWhen running on the Pi, the binary and weights file can sit in the same directory and the weights path can be omitted:
cd jamxe && ./dist/jamxe| Variant | Try |
|---|---|
| jamxe | HOW ARE YOU, WHAT IS LOVE, 3+4, COUNT 5 |
| jamkid | HELLO, NAME, ORCA, STORY |
| neuralpi | HOW ARE YOU, WHAT IS ATARI, TELL A STORY |
Training requires Python 3 and PyTorch (offline and independent from the Pi).
# MLP (jamxe / jamkid)
cd jamxe
python3 train_xe_strong.py td_xe.txt weights_xe.bin
make
# NeuralPi (transformer)
python3 train_transformer.py neuralpi/td_transformer.txt neuralpi/weights_neuralpi.bin
make -C neuralpi
# For large datasets (>10K pairs), augmentation auto-scales; override with --aug N if neededLineage and naming of this repo comes from Atari JAM (Just Another Model), originally designed to run on an even tinier Atari 800.