
Andrej Karpathy's small, readable repo for training and fine-tuning GPT models from scratch.
“The code most people read to finally see how a GPT is trained. It is short enough to understand in an evening.”
The cleanest way to see a real GPT train, end to end, in code you can read in an evening.
A complete GPT training loop in about 300 lines of model code and 300 of training code
Tiny, readable code; pairs with Karpathy's 'Let's build GPT' video
By Andrej Karpathy; reproduces GPT-2 (124M) results; 65k stars
You train a model yourself, from Shakespeare on a laptop to GPT-2 on GPUs
Training and finetuning only; no RLHF or serving
Karpathy now points people to nanochat for the newer full pipeline
A short README walks you from the quick start to reproducing GPT-2
Free and open source
No fluff: code, README, results
Reviewed by the Hive editors on 30 Nov 2026 from 1 page read. High confidence.
Nobody has tagged this on X yet. Reply to a post about it and tag @resourcehivebot to be the first.
Picked by the Hive editors · Report a problem