A $5 Microcontroller Now Runs a 30-Million-Parameter Chatbot Offline
PocketGPT runs a 30-million-parameter GQA transformer offline on a $5 XIAO ESP32S3 board, replying at 1.12 tokens per second — and flash storage beat microSD by six seconds.
- AuthorRebecca Stone
- ChannelAI & Emerging Interfaces
- Filed
- Read4 min

- A 30-million-parameter 12-layer GQA transformer runs offline on a ~$5 XIAO ESP32S3, generating about 1.12 tokens per second.
- Moving model weights from microSD to the board's flash produced the same answer about six seconds faster.
- Part of the model is packed at 3 bits per weight in PSRAM; 4-bit packing gives a theoretical ceiling of roughly 34 million parameters on the board.
- Training to 300 million tokens on a Mac GPU took an estimated 7.5 hours, and the model still made mistakes at that point.
- Eight architectures were compared on identical data; Transformer GQA won overall, and only one in 30 answers was relevant after a short fine-tune.
A language model with about 30 million parameters now runs entirely offline on a microcontroller board that costs roughly $5, generating replies at about 1.12 tokens per second. The project, built by Marina on Seeed Studio's XIAO ESP32S3 and published with full code and setup instructions, squeezes a 12-layer GQA transformer into hardware with less memory than a single browser tab — and its most instructive finding has nothing to do with model architecture.
The biggest performance gain came from moving the model's weights from a microSD card to the board's own flash storage. Same question, same answer, roughly six seconds faster. On a board this small, where the weights live matters more than clever design.
How Do You Fit 30 Million Parameters on a Board?
The XIAO ESP32S3 carries 8 MB of PSRAM, 8 MB of flash and 512 KB of SRAM. That's the whole budget. For comparison, Nvidia's Jetson Orin Nano Super — a common entry-level training machine — has 8 GB of RAM, lists at $399 and occupies about 25 times the desk space.
The arithmetic is unforgiving. Fill every byte of PSRAM and flash with weights at the standard 32 bits and you hit a theoretical ceiling of roughly 4 million parameters. Pack at 4 bits instead and the ceiling rises to about 34 million. The PocketGPT build splits the difference: part of the model is quantized to three bits per weight and lives in PSRAM, while the remaining weights stay in flash.
Espressif's own ESP-DL toolkit takes a different route to the same problem, supporting per-tensor quantization with 8-bit or 16-bit weights and activations.
The tokenizer matters too. A vocabulary of around 6,000 tokens cut the steps needed to write two example words from four to two. A larger vocabulary would speed that further but eat storage space.
What Went Into the Training Data?
The mix was deliberately conversational: material chosen for clear explanations, TinyStories for coherent sentence production, and the SODA dialogue dataset to teach conversational responses. About 90% of the training text was general, about 10% dialogue.
Eight architectures were tested on identical data with the same tokenizer, compared both at equal token counts and after 20 seconds of training. The results were uneven:
- Three of eight models scored perfectly on a test that required recalling a number while ignoring distractions.
- Gated Delta won a second test tracking which details belonged to which items.
- Causal TCN processed the most training tokens per second, timed on a Mac.
Other checks covered text prediction, grammar, world knowledge and everyday reasoning. Transformer GQA was the overall winner, and all eight architectures were trained to 10 million tokens in the final round.
Training itself ran on a Mac GPU with PyTorch and Apple Metal, reaching 300 million tokens in an estimated 7.5 hours. A CPU can also do PocketGPT's training math, just slower. Windows and Linux users can train via Spyder with CUDA on a compatible NVIDIA GPU, some AMD and Intel GPUs also work, and Google Colab offers browser-based training. After fine-tuning, the model responded supportively to expressions of nervousness rather than treating them as good news.
How Fast Is It, Really?
Not fast. But the number deserves context, because raw chip specs mislead here.
The ESP32-S3 runs two cores at up to 240 MHz, and Espressif claims up to 7.5 billion multiply-accumulate operations per second at that clock. That figure is not a token rate. The actual touchscreen build produced about 1.12 tokens per second after a brief pause to read the incoming message — roughly a word every second, streamed piece by piece so you can start reading before the answer finishes.
Several optimizations get it there: batching a few pieces of each message and sharing lookups across them, a numeric format that lets the chip perform several multiplications at once, reused calculations in the math routines, and keeping frequently run code in faster memory.
The microSD version added its own caching tricks — three frequently used pieces of information held in faster memory, and a persistently open file to avoid repeated reopen costs. Flash still won.
Should You Build One?
The honest caveats are in the source itself. Even the best of the eight architectures gave only one relevant answer out of 30 after a short fine-tuning run, and the model still made mistakes at 300 million training tokens. Quality is the constraint, not speed.
The project's own framing is worth repeating: check that slow, imperfect answers are good enough for your use case, and confirm you have a suitable GPU or cloud notebook for training before you start. As a starting point for exploring how training choices and memory limits shape a small conversational model, though, it's a rare fully documented build — and the memory-first lesson generalizes to any board you choose.
Source: geeky-gadgets.com
More from Rebecca Stone
Show full bio
News editor covering technology and product news in Product and interaction design, design systems at Interface Wire.
195 articles