GPT from Scratch

Feb 2026 ยท Personal project, following Andrej Karpathy's GPT lecture

I wanted to see what's inside a GPT, so I built a small one in PyTorch, following Andrej Karpathy's "Let's build GPT" lecture. The model stays close to his: the same attention heads, the same blocks and most of the same defaults. The repo used to be called yeen-gpt, and the code still is.

What I added:

At the defaults it's a 6-layer model with 6 heads, 384-dimensional embeddings and a 256-token context, about 11 million parameters, set up to train on a plain text file like Tiny Shakespeare.