Cover of Inside nanoGPT, line by line
The library

Foundation Models · Book 02 of 04

Inside nanoGPT, line by line

A source-pinned, tensor-shape-driven walkthrough of Andrej Karpathy's nanoGPT, from LayerNorm and causal attention through training, checkpoints, and generation.

For ML-literate readers who want to turn Transformer theory into working PyTorch code.

Reading time
133 minutes
Contents
19 chapters + field guide
Verified
August 4, 2026