Skip to content
lectern.tv
Independent / Eureka LabsNN-Z2HAI & MLundergraduate· 2023

Neural Networks: Zero to Hero

Andrej Karpathy

From scalar autograd and backpropagation in pure Python up to modern Transformer language models built line-by-line from scratch.

Start Lecture 111 lectures · 20h total
Syllabus progress0 of 11 watched
Neural Networks: Zero to Hero

Syllabus

11
Lecture 1· 2:34:45

Spelled-Out Intro to Neural Networks & Backpropagation: Building micrograd

Demystifies PyTorch's autograd in 150 lines of clean Python by manually computing numerical derivatives, applying the multivariable chain rule, and verifying gradients against torch.Tensor.

Lecture 2· 1:57:45

Spelled-Out Intro to Language Modeling: Building makemore (Bigram & Cross-Entropy)

Builds character-level autoregressive language models two ways—explicit transition count tables and gradient-based one-hot neural networks—proving they converge to identical negative log-likelihood loss.

Lecture 3· 1:15:39

Building makemore Part 2: Multi-Layer Perceptron Language Models (Bengio et al. 2003)

Implements Bengio et al.'s landmark 2003 neural probabilistic language model from scratch: learned token embeddings, mini-batch SGD, learning-rate finder sweeps, and train/dev/test splits.

Lecture 4· 1:55:57

Building makemore Part 3: Activations, Gradients, Kaiming Init & BatchNorm

Essential deep-learning diagnostics: visualizing saturated tanh tails, dead ReLUs, Kaiming He variance preservation, Batch Normalization internals, and gradient-to-data update-ratio histograms.

Lecture 5· 1:55:24

Building makemore Part 4: Becoming a Backprop Ninja (Manual Tensor Gradients)

Deletes loss.backward() and manually derives analytical tensor gradients through BatchNorm, linear layers, and fused cross-entropy softmax—checking every tensor to floating-point precision.

Lecture 6· 56:21

Building makemore Part 5: Hierarchical Dilated Causal Convolutions (WaveNet)

Transforms a flat MLP into a DeepMind WaveNet tree-structured architecture while building clean torch.nn-style Sequential and FlattenConsecutive abstractions.

Lecture 7· 1:56:20

Let's Build GPT: From Scratch, in Code, Spelled Out

Perhaps the single most-watched modern AI engineering lecture: constructs a full decoder-only Transformer (scaled dot-product causal self-attention, multi-head blocks, residuals, LayerNorm) live from an empty file.

Lecture 8· 42:40

State of GPT: Pretraining, SFT, Reward Modeling & RLHF Pipeline

Crisp architectural map of the four-stage LLM training pipeline (base pretraining, supervised finetuning, reward modeling, RLHF) plus practical inference psychology on token-by-token compute.

Lecture 9· 2:13:34

Let's Build the GPT Tokenizer: Byte Pair Encoding & Unicode Internals

Reveals why tokenization is the root cause of weirdly brittle LLM behaviors (spelling, arithmetic, trailing whitespace, non-English token bloat) by implementing UTF-8 Byte Pair Encoding from scratch.

Lecture 10· 4:01:26

Let's Reproduce GPT-2 (124M): Distributed PyTorch, FlashAttention & FineWeb

Four-hour systems-and-ML tour de force: reproduces OpenAI's GPT-2 (124M) from an empty file, optimizing throughput 10x via BF16 tensor cores, torch.compile, FlashAttention, cosine decay, and multi-GPU DDP.

Lecture 11· 59:48

Introduction to Large Language Models

A remarkably dense, hype-free 60-minute mental model of what an LLM actually is—two files on disk (weights + inference code) shaped by pretraining compression and post-training alignment.