Save this video free

The spelled-out intro to neural networks and backpropagation: building micrograd

Andrej Karpathy · 2:25:52 · Watch on YouTube

These notes were made with YouTube Collector. Paste any YouTube link and get the same: a summary, chapters and a searchable transcript.

Overview

Andrej Karpathy builds micrograd from scalar arithmetic to a trainable multilayer perceptron, showing how computation graphs, local derivatives, and the chain rule make backpropagation work. The roughly 100-line autograd engine accumulates gradients through a topologically sorted graph; a 41-parameter network then learns a small classification task with gradient descent, illustrating both the mechanics and common training bugs.

Key takeaways

Chapters

0:00 Micrograd’s Purpose: Make Backpropagation Visible
8:00 Derivative Intuition Through a Quadratic Function
14:00 Finite Differences for a Three-Input Expression
19:00 Implementing Value Objects and Arithmetic Operators
23:00 Recording Computation Graphs and Visualizing Expressions
29:00 Manual Backpropagation Starts at the Output
34:00 Chain Rule Connects Local and Global Derivatives
38:00 Multiplication Gradients and Gradient Ascent Intuition
45:00 A Neuron Computes Weighted Inputs Plus Bias
52:00 Adding tanh as a Differentiable Operation
57:00 Manual Gradients Through a tanh Neuron
1:02:00 Why a Zero Input Produces a Zero Weight Gradient
1:09:00 Coding Local Backward Functions for Each Operation
1:18:00 Topological Sorting Orders the Backward Pass
1:23:00 Shared Inputs Require Gradient Accumulation
1:27:00 Scalar Constants, Powers, Exponentials, and Division
1:39:00 Checking Micrograd’s Results Against PyTorch
1:44:00 Building Neuron and Layer Classes
1:49:00 Assembling a Multilayer Perceptron
1:51:00 Mean Squared Error for a Four-Example Classifier
1:57:00 Collecting Every MLP Weight and Bias
2:02:00 Gradient Descent Updates Parameters Against the Loss
2:08:00 Turning Forward, Backward, and Update into a Training Loop
2:10:00 Fixing the Missing Zero-Gradient Step
2:14:00 The Neural Network Training Recipe
2:17:00 Reviewing Micrograd’s Engine and Neural Network Library
2:19:00 Micrograd’s Larger Classification Demo
2:21:00 Finding tanh Backpropagation Inside PyTorch
2:23:00 Registering Custom Differentiable Operations

Keep these chapters and the full searchable transcript in your own library.

Transcript excerpt

0:00 hello my name is andre and i've been training deep neural networks for a bit more than a decade and in this lecture i'd like to show you what neural network training looks like under the hood so in particular we are going to start with a blank jupiter notebook and by the end of this lecture we will define and train in neural net and you'll get to see everything that goes on under the hood and exactly sort of how that works on an intuitive level now specifically what i would like to do is i would like to take you through building of micrograd now micrograd is this library that i released on github about two years ago but at the time i only uploaded the source code and you'd have to go in by yourself and really figure out how it works so in this lecture i will take you through it step by step and kind of comment on all the pieces of it so what is micrograd and why is it interesting good

0:49 um micrograd is basically an autograd engine autograd is short for automatic gradient and really what it does is it implements backpropagation now backpropagation is this algorithm that allows you to efficiently evaluate the gradient of some kind of a loss function with respect to the weights of a neural network and what that allows us to do then is we can iteratively tune the weights of that neural network to minimize the loss function and therefore improve the accuracy of the network so back propagation would be at the mathematical core of any modern deep neural network library like say pytorch or jaxx so the functionality of microgrant is i think best illustrated by an example so if we just scroll down here

This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.

Related notes

Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Andrej Karpathy.

Want the full transcript?

Save this video in YouTube Collector to get its complete searchable transcript, your own AI summaries, and a library that keeps every video you collect in one place.