Progressive from-scratch construction
Build a system from an empty file, adding one concept at a time.
Based on Andrej Karpathy's public content. Not affiliated with or endorsed by Andrej Karpathy.
Steps
- Start from the simplest working model, such as a bigram
- Add gradients, autograd, layers and attention one at a time
- Keep each step small and clean, for example one commit per step
- Compare each component with its production-scale counterpart
Covered in
The spelled-out intro to language modeling: building makemore
This source, a video description, outlines building a bigram character-level language model as the starting point for a series that later grows into a modern Transformer language model like GPT. It states the focus is on introducing torch.Tensor, its subtleties, and its use in efficiently evaluating neural networks. The text is truncated, so the second stated focus is not available.
GitHub · LLM101n: LLM101n: Let's build a Storyteller
Karpathy outlines a planned course in which learners build a Storyteller AI large language model and turn it into a functioning ChatGPT-like web app. He teaches LLMs end-to-end from basic language modeling through training, optimization, inference, finetuning, deployment, and multimodal systems, using Python, C, and CUDA with minimal prerequisites.
GitHub · build-nanogpt: Video+code lecture on building nanoGPT from scratch
This README describes Karpathy's from-scratch reproduction of nanoGPT, built step by step in clean git commits alongside a video lecture, starting from an empty file and ending with a GPT-2 (124M) reproduction. He explains that such base models only "dream" internet documents and are not chat models, notes that reproduction now costs about an hour and $10, and documents errata openly.
Neural Networks: Zero To Hero
This is the course page for Karpathy's 'Neural Networks: Zero To Hero', which teaches neural networks by building them from scratch in code. It starts with backpropagation and works up to GPT and tokenizers. He argues that language models are an excellent vehicle for learning deep learning in general.
microgpt
Karpathy teaches the complete algorithmic essence of training and running a GPT by reducing it to a dependency-free, 200-line Python program. He explains how data, tokenization, autograd, Transformer architecture, optimization, training, and inference fit together, while distinguishing the core algorithm from the engineering required to operate production-scale LLMs.
GitHub · nn-zero-to-hero: Neural Networks: Zero to Hero
This README outlines Karpathy's course that teaches neural networks from the basics by coding and training them together, progressing from a scalar autograd engine (micrograd) through character-level language models (makemore) to building GPT and its tokenizer from scratch. He emphasizes hands-on implementation, understanding internals like gradients and activations, and building intuition that enables debugging and innovation.
Building makemore Part 5: Building a WaveNet
This source, a short video description, outlines how Karpathy extends the 2-layer MLP from the previous makemore video into a deeper, tree-like hierarchical model. The result is a convolutional neural network architecture similar to DeepMind's 2016 WaveNet. The description notes that the WaveNet paper implements the same hierarchical architecture more efficiently using causal dilated convolutions; the text cuts off at that point.