emojiGPT ๐ง โจ
April 4, 2026 ยท View on GitHub
The world's smallest GPT that covers the full pipeline โ dataset curation, training, inference, and story generation โ in one file.
~4,000 parameters. Trains in 30 seconds. Runs entirely in your browser. No server, no dependencies, no install.
What is this?
A minimal GPT implementation running entirely in the browser โ autograd, transformer, and training loop built from basic primitives, zero dependencies:
- Autograd engine โ full backpropagation, built from scalar
Valuenodes - Transformer architecture โ multi-head self-attention, RMSNorm, MLP, positional embeddings
- Adam optimizer โ with bias correction and learning rate decay
- KV-cache inference โ token-by-token generation with probability visualization
The model trains on ~170 emoji stories (editable!), learning patterns like "๐ โ โ โ ๐ณ โ ๐" or "๐ค โ ๐ฅ โ ๐ โ ๐". After training, you can type any emoji prompt and watch the model continue the story, showing real-time probability distributions for each predicted token.
Quick Start
- Download
index.htmland open it in your browser โ that's it, just one file - Click โถ Train (takes ~30 seconds with default settings)
- Scroll down to the inference playground
- Type a few emoji (e.g.
๐ ๐ ๐ต) and press Continue โถ - Watch the model predict the story, one emoji at a time
Architecture
Token Embedding + Positional Embedding
โ
RMSNorm
โ
โโโโ Transformer Block (รN) โโโโ
โ RMSNorm โ Multi-Head Attn โ
โ + Residual โ
โ RMSNorm โ MLP (ReLU) โ
โ + Residual โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
Linear โ Softmax โ Loss
Default config: 16-dim embeddings, 4 attention heads, 1 layer, ~4K parameters.
Features
- Fully configurable โ embedding dim, heads, layers, block size, learning rate, temperature
- Editable training data โ write your own emoji stories or paste AI-generated ones
- Live training visualization โ loss curve, stats, auto-generated sample stories
- Interactive inference โ type emoji prompts, see token-by-token generation with probability bars
- Zero dependencies โ one self-contained HTML file
Use Cases
This isn't just a demo โ it's the world's smallest fully working GPT, and it can deliver real value:
- AI Education โ The most intuitive way to teach how GPT works. Students see the full pipeline live: data โ training โ loss curve โ inference โ generation. Tweak the parameters and watch what happens. Better than any slide deck.
- Storyboarding & Film โ Generate emoji story sequences as rapid visual storyboards. A screenwriter or director can use emoji narratives as a lightweight tool for brainstorming scene progressions before committing to full production.
- Cross-language Storytelling โ Emoji have no language barrier. A reader in Tokyo and a reader in Sรฃo Paulo both understand ๐คโ๐ฅโ๐โ๐โ๐ as the same story.
- Creative & Social โ Use generated emoji stories as prompts for improv writing, party games, or social media content.
- Narrative Prototyping โ Validate story structures at near-zero cost before scaling up to natural language with larger models.
Why does it work?
How can a ~4K-parameter model generate coherent stories? The answer is a blend of AI and cognitive psychology.
Emoji are a natural dimensionality reduction. A single ๐ฅ carries the meaning that would take an entire sentence in English. By training on emoji sequences instead of text, we collapse the problem space by orders of magnitude.
The other half of the magic is you. Your brain automatically unpacks each emoji into a rich scene โ the hospital visit, the injection, the prayer, the relief. The model writes a compressed story; your mind decompresses it into a full one.
Emoji as dimensionality reduction + the human brain as the decompressor โ that's how a tiny transformer learns to tell stories.
Acknowledgements
Built on @karpathy's microGPT and @xenova's microgpt.js browser port โ beautiful, minimal implementations that made this possible. emojiGPT extends their work from name generation to emoji story generation โ with a fully editable training dataset (swap in your own stories to change what the model learns), a token-by-token inference playground with probability visualization, and a redesigned UI.
โญ Like it? Star it!
If you find this project interesting, give it a star โ it helps others discover it too.
Follow Me
I write about AI, startups, and psychology.
- WeChat public account: MindCode
- X: @moneygalaxy
- Substack: mindcodeplus
License
MIT