Transformer Decoder Explainer
Watch a decoder think, one matrix at a time.
Type in your own text and follow it through every operation of a GPT-style decoder: embeddings, masked self-attention, the feed-forward network, LayerNorm and residuals, stacked blocks, and next-token sampling. The numbers you see are computed on the server by a small, readable TypeScript implementation.
Lessons
Seven short sections, from token embeddings to sampling. Toggle the Concept, Maths and Code layers to choose your depth.
Start the lessons →
Playground
The whole decoder on one page. Change the input, the model size and the sampler, and generate text one token at a time.
Open the playground →
Experiments
Configurations other readers saved and shared. Sign in with GitHub to save your own or fork theirs.
Browse experiments →
The code is a teaching artefact too: read the source on GitHub for Next.js full-stack patterns alongside the maths.