esp32-ai is an experimental language-model project that runs a 28.9-million-parameter model entirely on an ESP32-S3 microcontroller. The quantized model occupies about 14.9 MB and generates text without sending data to a server. Most parameters remain in flash through a Per-Layer Embeddings design, while active computation uses SRAM and PSRAM. This memory layout allows the device to retrieve only the embedding rows required for each token. The implementation reaches roughly 9.5 tokens per second and can display generated words on a connected screen. Trained on TinyStories, the model produces short, simple stories rather than answering questions, following instructions, or providing factual knowledge. The repository includes firmware, wiring and flashing instructions, training code, quantization experiments, ablations, and measured results.
Features
- On-device text generation
- 28.9-million-parameter model
- Four-bit quantized storage
- Per-Layer Embeddings architecture
- Flash, PSRAM, and SRAM partitioning
- Training and firmware toolchain