ESP32 LLM
Proof that a language model can run on an ESP32: a 260K-parameter TinyLlamas model trained on TinyStories generating text at about 19 tokens per second.
- Hardware:
- ESP32-S3 with PSRAM
- Difficulty:
- Advanced
- Creator:
- DaveBben
A real LLM running on an ESP32.

By DaveBben
- Posted
What it does
Proof that a language model can run on an ESP32: a 260K-parameter TinyLlamas model trained on TinyStories generating text at about 19 tokens per second.
What you need
- Difficulty
- Advanced
- License
- No license stated
Parts
- ESP32-S3FH4R2 (2MB of embedded PSRAM) [not stated]
- AI model or service
- llama2.c tiny model
Prices, notes and sources: Parts and requirements
Parts and requirements
| Part | Spec / notes | Needed | Price |
|---|---|---|---|
| ESP32-S3FH4R2 | 2MB of embedded PSRAM | Not stated |
Steps
- Difficulty
- Advanced
- Install the ESP-IDF toolchain.
- Build with
idf.py build. - Flash with
idf.py -p /dev/{DEVICE_PORT} flash.
Full instructions: View original
How it works
It uses llama2.c on an ESP32-S3FH4R2, whose 2 MB of PSRAM fits the roughly 1 MB model. Speed-ups include using both cores, ESP-DSP SIMD dot-product functions, a 240 MHz CPU and 80 MHz PSRAM, and a larger instruction cache. It builds with the ESP-IDF toolchain.
Limits and caveats
- The 260K parameter tinyllamas checkpoint still requires 1MB of RAM.
Like this build? Get the weekly builds
Every Thursday: the 5 best gadget hacks you can copy. Free.
Built something? Submit a build
Why it's interesting
This is the earlier, smaller proof that an LLM can run on an ESP32 at all, and the author is candid that it is probably not very useful. The model is a 260K-parameter tinyllamas checkpoint trained on TinyStories, run with llama2.c. Even that needs about 1 MB of RAM, so the build uses an ESP32-S3FH4R2 for its 2 MB of embedded PSRAM. The README lists the optimizations that reach 19.13 tokens per second: using both cores for the heavy math, using ESP-DSP dot-product functions that take advantage of the S3's few SIMD instructions, and pushing the CPU to 240 MHz and PSRAM to 80 MHz with a larger instruction cache. Building requires the ESP-IDF toolchain. The 28.9M-parameter ESP32-S3 LLM on HardwareLab goes much further.
Hardware
- ESP32-S3 with PSRAM
This page is a short summary written by HardwareLab. Build steps, code and photos belong to the creator; follow “View original” for the full project.
Featured? Add this badge
Built this? Paste the badge into your README. It links back to this page.
Markdown
[](https://hardwarelab.dev/projects/esp32-llm/?utm_source=badge&utm_medium=referral&utm_campaign=launch_2w)HTML
<a href="https://hardwarelab.dev/projects/esp32-llm/?utm_source=badge&utm_medium=referral&utm_campaign=launch_2w"><img src="https://hardwarelab.dev/badge.svg" alt="Featured on HardwareLab" width="188" height="20"></a>Related builds
All 23 in Local LLM Rigs & Edge Agents
Needle 2 ESP32
45M-parameter LLM offline on an ESP32-S3 turning English into valid commands.
- ESP32-S3
Advanced209
ESP32s3 LLM Cluster
Seven ESP32-S3s daisy-chained to run a 0.5B ternary LLM.
- 7x ESP32-S3 over SPI
Advanced259
PFor
A 180.9M-parameter MoE language model and agent on a $6.80 ESP32-P4.
- WT9932P4-Tiny (ESP32-P4 v1.3, 32MB PSRAM, 16MB flash)
Advanced$6.80 (Wireless-Tag store)12
28.9M-parameter LLM on an ESP32-S3
A 28.9M-parameter language model generating text on an ESP32-S3.
- ESP32-S3 N16R8
- OLED
Advanced4.6K
Muse Gadgets SDK
Meta’s open SDKs for connecting Muse to ESP32 and Raspberry Pi gadgets.
- ESP32 boards
- Raspberry Pi (3B+, 4, 5 or Zero 2 W) or another Linux computer with Bluetooth LE
Intermediate2.7K
ESP32 iPhone Agent
An ESP32-S3 board lets an AI model use a real iPhone: no computer at run time, no jailbreak.
- Seeed XIAO ESP32S3 (plain, 8MB PSRAM; any ESP32-S3 with native USB + PSRAM)
- iPhone on iOS 18+ with cellular data
- Lightning to USB Camera Adapter (Lightning iPhones only)
- +2 more
Intermediate4.8K