explaingit

slvdev/esp32-ai

Analysis updated 2026-07-26

919PythonAudience · researcherComplexity · 4/5Setup · hard

TLDR

Runs a 28.9 million parameter language model entirely on a $8 ESP32-S3 microcontroller chip. It generates text on-device without a server by storing most of the model in slow flash memory and only loading the parts it needs.

Mindmap

mindmap
  root((repo))
    What it does
      Runs AI on chip
      No server needed
      Writes to screen
    Tech stack
      Python
      ESP32-S3
      TinyStories data
    How it works
      Flash storage trick
      Per-Layer Embeddings
      Fast memory compute
    Use cases
      Offline text generation
      Tiny AI research
      Hardware experiments
    Audience
      Embedded developers
      AI researchers
      Hardware tinkerers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Generate simple text stories on a microcontroller without an internet connection.

USE CASE 2

Study how to fit large AI models onto small chips using flash memory storage.

USE CASE 3

Build offline AI hardware projects using affordable eight-dollar microcontrollers.

USE CASE 4

Experiment with on-device AI processing for privacy-focused embedded applications.

What is it built with?

PythonESP32-S3Firmware

How does it compare?

slvdev/esp32-aidjango/django-localflavorywnd1144/gopay_plus_automatic
Stars919919918
LanguagePythonPythonPython
Last pushed2026-06-23
MaintenanceMaintained
Setup difficultyhardeasyhard
Complexity4/52/54/5
Audienceresearcherdevelopergeneral

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1h+

Requires wiring an ESP32-S3 chip to a screen and flashing custom firmware, plus basic hardware components.

No license information is provided in the repository, so usage rights are unclear by default.

In plain English

This project runs a small language model on a microcontroller that costs about $8. The model has 28.9 million parameters and generates text at roughly 9 tokens per second, writing each word to a small screen wired to the chip. Nothing gets sent to a server. Everything runs on the device itself. The previous language model people ran on a chip like this had only 260 thousand parameters, so this one holds about a hundred times more. The hard part is memory. The ESP32-S3 chip has only 512KB of fast memory, which normally forces you to use tiny models. The trick here is to stop putting the model in fast memory at all. Most of a language model's parameters sit in an embedding table, which the model reads from rather than computes on. So you leave that 25 million row table in slow flash storage and pull only the few rows each token needs, about 450 bytes. The small part that does the actual work stays in fast memory. You never load most of the model. It just sits in flash and gets sampled a little at a time. This idea is called Per-Layer Embeddings, from Google's Gemma models. The author adapted it to run on a microcontroller instead of a phone or a GPU. As far as they can tell, nobody had tried it on a chip this small. The model was trained on TinyStories, a dataset of short synthetic stories simple enough that a small model can learn to write coherently. It writes short, simple stories and mostly keeps them coherent. It will not answer questions, follow instructions, write code, or know facts. The interest here is the architecture, fitting a large model onto a tiny chip, rather than what a 28.9 million parameter model can say. The repo includes the firmware, wiring steps, training code, and a writeup of the full method and measurements. The author left the messy commit history on purpose, including a bug in their parameter accounting and the corrected result that followed.

Copy-paste prompts

Prompt 1
Using the esp32-ai project as a reference, write Python code to store a large embedding table in flash memory and only load the rows needed for each token to save RAM.
Prompt 2
Help me wire a small screen to an ESP32-S3 microcontroller so it can display text generated by a local language model, based on the esp32-ai repo wiring steps.
Prompt 3
Explain the Per-Layer Embeddings technique from the esp32-ai project and write a summary of why it lets a 28 million parameter model run on 512KB of fast memory.
Prompt 4
Generate a simple Python training script for a tiny language model using the TinyStories dataset so it can later be converted to run on an ESP32 chip.

Frequently asked questions

What is esp32-ai?

Runs a 28.9 million parameter language model entirely on a $8 ESP32-S3 microcontroller chip. It generates text on-device without a server by storing most of the model in slow flash memory and only loading the parts it needs.

What language is esp32-ai written in?

Mainly Python. The stack also includes Python, ESP32-S3, Firmware.

What license does esp32-ai use?

No license information is provided in the repository, so usage rights are unclear by default.

How hard is esp32-ai to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is esp32-ai for?

Mainly researcher.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.