Learning Transformers by Fitting a Portuguese Story Model on an ESP32

I wanted to understand transformers beyond calling a model API. Buying an ESP32-S3 gave that goal a concrete constraint: build a model that continues children’s stories in Brazilian Portuguese, with inference running on the board itself. The result is Historinhas, a 28.87M-parameter model trained from scratch. To understand its design, we will follow the path from the original Transformer to Gemma’s memory-saving embeddings, then trace Portuguese text through training, quantization, and deployment. A token is a text unit, often a word fragment, and each generation step predicts one more. ...

October 11, 2026 · 16 min · Emanuel Valente