Skip to content
MCU Atlas
ESP32ESP32-S3

Pocket Tank: a real LLM on an ESP32-S3

A 14.3M-parameter LLM distilled from a 26B teacher runs entirely on an ESP32-S3, deciding when each virtual fish eats, hides or rests — no cloud, no network.

Difficulty:BeginnerSource available

Key Facts

  • Brain: 14.3M-parameter transformer (dim 384, 8 layers, 8 heads), 4-bit, 7.56 MB — 7,557,640 bytes, our own check of the repo tree (2026-11-29)
  • Engine: llama2.c-style 4-bit inference; runs on the ESP32-S3's second core with quantized activations in internal SRAM, weights memory-mapped from flash, never copied
  • Teacher: gemma4:26b — ~26B parameters, ~18 GB (Q4_K_M), ~262K-token vocabulary, run via Ollama
  • Vocabulary: 54 tokens — a closed schema lexicon (state words + goal tokens)
  • Training: 51,613 teacher-labeled situations; ~1,818× fewer parameters than the teacher
  • Agreement: 72% of the teacher's goal picks on fresh situations (the teacher agrees with itself 82%) — maker measurement
  • On-board speed: ~3.7 s per decision at 12 tokens/s; tank renders at 25–30 fps on the other core — maker measurements
  • Board: one Waveshare ESP32-S3-Touch-AMOLED board (ESP32-S3R8, 16 MB flash, 8 MB PSRAM) — 1.8-inch default; 1.75C pendant, 2.06 watch and 2.16 square also supported. Maker framing: an "$8 chip"; complete boards with screen and battery "actually around $35" (README at HEAD, checked 2026-11-29 — no store price verified this run)
  • Install: browser installer over Web Serial (~8 MB, no toolchain; the same ESP Web Tools mechanism ESPHome and Home Assistant use); Wi-Fi optional and used only for OTA updates; two community board ports exist (4-inch ESP32-P4, 2.8-inch CYD) but are untested by the project
  • Status: v0.4.1 (alpha); repo created 2026-08-24, last push 2026-11-26 (checked 2026-11-29)
  • License: PolyForm Noncommercial 1.0.0 — non-commercial use only; commercial use needs written permission; versions ≤ v0.3.9.2 stay MIT

About This Project

What it is

Pocket Tank is a virtual aquarium for a single ESP32-S3 board where every high-level decision is made by a real, on-device language model: a 14.3-million-parameter transformer distilled from a 26-billion-parameter teacher. In the maker's words, "No network. No cloud. The whole brain is a 7.56 MB file read straight from flash". "The fish aren't scripted." Each fish describes its situation to the model as a line of text; the model completes it with a goal, and a reflex layer turns it into motion at 25 to 30 frames per second.

Why it fits our audience

What does running a model on a microcontroller look like? Here: watching a language model think, in real time, about a fish. The whole build is one dev board you buy complete — nothing to solder, a browser-click install — the cleanest edge-AI introduction we know. When the pet stops being enough, the same repo carries the distillation pipeline that trained it — the project grows with the reader, from keeper to trainer.

How the fish think

Three strictly separated layers, shared by simulator and firmware: a reflex layer for physics, steering, schooling and touch; an LLM advisor — a llama2.c-style 4-bit engine, re-asked only when a fish's situation changes, so four to six fish share one brain; and a progression layer keeping growth and milestones alive through power cuts. One rule stands out: "the model owns its decisions." When the model is unsure, the fish visibly hesitates — no fallback heuristic silently overrides it.

From 26 billion to 14 million

Distillation here is an apprenticeship you can read end to end. The teacher is a 26-billion-parameter model — the README names it gemma4:26b — served through Ollama; the maker ran a headless tank against it, logging 51,613 situations and the teacher's goal for each. The student is a 14.3M-parameter transformer, about 1,818× smaller, speaking a closed vocabulary of 54 tokens instead of the teacher's roughly 262,000 — words like hunger, reef and seek_food. Exported at 4-bit it shrinks from 57 MB to the 7.56 MB file in the repo, and picks the teacher's goal 72% of the time on fresh situations. A specialist, not a chatbot.

The hardware

One board, arriving finished: four Waveshare ESP32-S3-Touch-AMOLED boards are supported, all ESP32-S3R8 chips with 16 MB flash and 8 MB PSRAM. The 1.8-inch original is the default; the round 1.75-inch pendant, the wearable 2.06-inch watch and the 480×480 2.16-inch square run the same fish, shop and saves. The README is honest that complete boards, with screen and battery, cost meaningfully more than the eight-dollar chip story — the maker's figure, not a store price we checked, is in the key facts.

Getting started

Three ways in, easiest first. The PC simulator: clone the repo, clone LVGL v9, install SDL2, and the same shared code runs with the shipped model. The browser installer: plug in a board, open the install page in Chrome or Edge, and about 8 MB goes over Web Serial. Wi-Fi is optional: "The radio is only on during a check: the tank itself still runs with no network at all." Last, build from source with ESP-IDF v5.4 — or train your own model: the trace generator, trainer and 4-bit export are all in the repository, built on Karpathy's llama2.c.

How it differs from our TamaFi and tinyworldformer pages

We have covered AI-flavored pets and games; Pocket Tank is a different thing. TamaFi, our Wi-Fi-eating virtual pet, is pure firmware: a decision engine over pet stats and the Wi-Fi around it — no model in the loop. tinyworldformer's two networks dream game frames on a Pico 2 W: a world model trained on a PC that predicts pixels, and an actor that picks the buttons — no language, no pet. Pocket Tank's differentiator is the distilled model itself, on-device and in charge: a 14.3M-parameter language model makes every high-level decision for the pet.

What we verified vs what the maker claims

A community library page: MCU Atlas has not built this project or run its firmware. We verified by reading the repo's README, LICENSE and file tree at main HEAD via the GitHub API on 2026-11-29. Confirmed ourselves: the shipped model file model_q4.bin is 7,557,640 bytes — 7.56 MB as claimed (git-trees listing, 2026-11-29); the 14.3M, 26B and 54-token figures match the README at HEAD; and the LICENSE file decodes to PolyForm Noncommercial 1.0.0. Maker measurements we did not re-run: the 3.7-second decision time at 12 tokens per second, the 25–30 fps rendering and the 72% agreement figure, documented in the repo's docs/stats.md.

License, attribution and safety

Pocket Tank is source-available under the PolyForm Noncommercial License 1.0.0 — "Use it, change it, build it on your own board and share it, for any noncommercial purpose." Selling it or anything built on it needs written permission first; the license file says to ask. Versions up to v0.3.9.2 stay MIT, and the cloned llama2.c and LVGL trees carry their own MIT licenses. The project is by StratoBuilds (Strato Doumanis), on GitHub as mediacutlet, at v0.4.1 — which the README itself calls alpha. MCU Atlas is not affiliated with the author or Waveshare.

---

Source & Attribution

Source: GitHub
License: PolyForm Noncommercial 1.0.0 (verified from the LICENSE file via the GitHub API — the body exactly matches the SPDX-canonical PolyForm-Noncommercial-1.0.0 text; custom Required Notice header: copyright Strato Doumanis, commercial use asks [email protected]; GitHub reports NOASSERTION). Non-commercial use only; commercial use needs written permission; versions up to v0.3.9.2 stay MIT.
Last verified: 11/29/2026
Pocket Tank: a real LLM on an ESP32-S3

Illustration

Bill of Materials

Parts list

5 parts · 4 linked

Heads up: some Buy links are affiliate links. If you buy through one, MCU Atlas may earn a small commission at no extra cost to you. It never changes which parts we list. How this works

1× Waveshare ESP32-S3-Touch-AMOLED-1.8

Maker statement: complete boards with screen and battery 'actually around $35' (README, checked 2026-11-29). No store price verified this run.

1× Waveshare ESP32-S3-Touch-AMOLED-1.75C

1× Waveshare ESP32-S3-Touch-AMOLED-2.16

1× USB-C data cable

No verified link — check the original project
Download CSV

Related Projects

TamaFi: Wi-Fi-eating virtual pet on ESP32-S3
Illustration
ESP32ESP32-S3
TamaFi is a Tamagotchi-style virtual pet on an ESP32-S3 and colour TFT that stays healthy by eating nearby Wi-Fi networks instead of food.
Intermediate·Code
4 parts listed
tinyworldformer: AI-dreamed games on a Raspberry Pi Pico 2 W
Illustration
RASPBERRY PI PICORP2350-W
Two tiny neural networks on a Pico 2 W: one dreams up each frame of Breakout, Pong or Doom-lite, the other plays it — press a button and you take over the game.
Advanced·Code
3 parts listed
Whistle: real speech-to-text entirely on an ESP32-S3, no network
Illustration
ESP32ESP32-S3
Real speech-to-text entirely on an ESP32-S3, no network or cloud: hold a button and say a command in one of seven languages — the onboard LED obeys.
Intermediate·Code
5 parts listed