Brainscope/examples/ESP32 Watch a microcontroller's LLM think

rbanffy1 pts0 comments

brainscope/examples/esp32 at main · moudrkat/brainscope · GitHub

//files/disambiguate" data-turbo-transient="true" />

Skip to content

Type / to search

Sign in<br>Sign upAppearance settings

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

moudrkat

brainscope

Public

Notifications<br>You must be signed in to change notification settings

Fork<br>10

Star<br>45

FilesExpand file tree

main

/esp32<br>Copy path

Directory actions

More options<br>More options

Directory actions

More options<br>More options

Latest commit

History<br>History<br>History

main

/esp32<br>Copy path

Top

Folders and files<br>NameNameLast commit message<br>Last commit date<br>parent directory<br>..<br>README.md

README.md

dirs.json

dirs.json

ple_tinylm.py

ple_tinylm.py

serve.py

serve.py

View all files

README.md<br>Outline<br>Watch a microcontroller's LLM think

This model normally lives on an ESP32-S3 microcontroller - a $5 chip with<br>512 KB of RAM - where it writes children's stories at 9.88 tokens/s on a<br>matchbox-sized board (slvDev/esp32-ai).<br>It fits because 25M of its 28.9M parameters sit in the chip's flash memory<br>(Per-Layer Embeddings, the Gemma 3n trick) and are read ~450 bytes per token.

Here you get those exact weights - the int4 artifact the chip runs, dequantized<br>and verified against its C runtime to ~1e-5 - under brainscope's microscope.<br>Six layers, four heads: the whole model fits on one screen. No cherry-picked<br>attention heads, no truncated views. It is the perfect glass-box model for<br>learning what the logit lens, attention maps and steering actually show.

Run it (no hardware needed)

pip install brainscope<br>python examples/esp32/serve.py

Weights download from the Hub on first run (~120 MB fp32).

Three experiments

Watch a story crystallize. Type Once upon a time in the chat box and<br>watch each word surface through the six layers in the logit lens.

Steer the mood. Turn steering on, pick the bundled dark direction and<br>drag the slider - the story clouds over: storms, tears, night. Extracted<br>from 10 contrast pairs at layer 3 (brainscope.extract).

Unplug the flash. python examples/esp32/serve.py --flash-unplugged<br>zeroes the 25M flash-resident parameters. The storyteller collapses into<br>time there time there time... - a direct picture of what a memory chip<br>contributes to a model's thinking.

Credit

Model and hardware story: slvDev/esp32-ai<br>(MIT). The conversion and the verification gate against the device's C runtime<br>live there in brainscope_adapter/. Per-Layer Embeddings are Google's design<br>from Gemma 3n; the model trains on<br>TinyStories.

You can’t perform that action at this time.

esp32 brainscope model time examples watch

Related Articles