Topic guide · 13 recordings · 27 verbatim quotes

Andrej Karpathy on Neural Networks

Karpathy treats neural networks as trainable mathematical expressions whose power comes from gradients, data, and large-scale optimization rather than mystery.

In short
  • Neural networks are mathematical expressions with trainable parameters, not magic.
  • Backpropagation is the core mechanism: gradients flow through computational graphs and let optimization improve behavior.
  • Deep learning is a new programming style where optimization writes much of the code and the dataset becomes central.
  • Good neural nets depend on practical details like initialization, activations, normalization, and hyperparameter tuning.
  • Modern language models and sequence models show how simple trainable components can scale into surprisingly capable systems.
Watch: Karpathy on neural networksThe key moments, back to back, in his own words
4 moments · 3 min
1 / 4
“Even neural networks are just a mathematical expression.”
Educational talk, 2021-11 · 4:23

Neural networks are mathematical expressions you can train

Karpathy’s starting point is to strip away mystique. He presents a neural network as a mathematical expression with many adjustable parameters, where the basic task is to tune those parameters so the expression produces useful outputs. In his teaching, this is the key demystification step: once you see the network as an expression, training becomes an engineering and math problem instead of a magical one.12

That view also explains why he likes building tiny systems from scratch. A minimal autograd engine makes the essential mechanism visible: define a computation, compute a loss, get gradients, and update the parameters. This is the mathematical core he sees underneath modern deep learning libraries.32

Andrej Karpathy, Educational talk, 2021-11
“Even neural networks are just a mathematical expression.”
Educational talk, 2021-11 · full transcript →

Backpropagation is the engine that makes learning possible

For Karpathy, backpropagation is not a special trick for one architecture; it is a general method for computing how every parameter affects the final loss. He teaches it as repeated chain rule over a computational graph, where each operation contributes a local derivative and gradients are passed backward efficiently.42

This perspective matters because it gives you intuition for the whole training loop. The pattern is simple and repetitive: run the model forward, send gradients backward, update parameters, and repeat. That loop is what turns a static expression into a learning system.52

He also emphasizes making derivatives concrete rather than abstract. Even small derivative rules, such as the tanh backward formula, are worth understanding because they explain how signals and learning actually flow through a network.6

Andrej Karpathy, CS231n Winter 2016 Lecture 4
“…forward, backward, update; forward, backward, update.”
CS231n Winter 2016 Lecture 4 · full transcript →

Optimization and data are a new way of programming

Karpathy sees deep learning as a programming paradigm shift. Instead of writing detailed rules by hand, you define a model family, collect examples, choose a loss, and let optimization discover parameter settings that implement the behavior. In that sense, optimization writes a large part of the effective program.

This is why datasets matter so much in his framing. If the learned model is the executable result of optimization, then the examples are not just inputs to a process; they shape what the final system becomes. That is why he argues that in this style of software, the dataset effectively becomes the code.1011

He pushes the implication further: on hard perceptual problems, progress often comes from designing less by hand and leaving more to optimization. Humans still choose the search space and tooling, but the learned solution increasingly emerges from data and training rather than handcrafted features and rules.12

What makes neural networks work in practice is often the unglamorous stuff

Karpathy repeatedly shows that training success depends on practical details, not just architecture diagrams. A model can start off in a bad regime, producing outputs that are confidently wrong, which raises loss and slows learning. Looking at logits, activations, and gradients is how you diagnose that.1314

He pays close attention to activation behavior because learning can fail silently when gradients die or saturate. Saturated nonlinearities can squash gradients, dead units can stop contributing, and initialization can push the whole network into unhealthy operating ranges. These are not side issues; they are central to getting a network to learn.1315

He also treats optimization as empirical work. Learning rate schedules, hyperparameters, and validation behavior must be monitored experimentally, and production systems require many runs and careful comparison rather than guesswork.17

Andrej Karpathy, Building makemore Part 3 lecture, 2021
“…the network is very confidently wrong…”
Building makemore Part 3 lecture, 2021 · full transcript →

Neural nets become especially powerful when they can share structure

A recurring theme in Karpathy’s examples is that neural networks beat naive lookup-style methods because they can share statistical strength. In language modeling, a count table over longer contexts grows explosively, while learned embeddings let the model represent similarities and transfer knowledge across contexts. That is how a network can generalize instead of memorizing isolated cases.1819

He also explains that layered structure is partly a computational choice. Organizing neurons into layers allows vectorized matrix operations, making large networks trainable in practice. So the familiar layered neural net is not just biologically inspired; it is also a highly efficient computational arrangement.20

This same principle scales up in modern architectures. In Transformers, repeated blocks refine representations through operations that combine communication across tokens with per-token processing, which helps explain why such systems can learn rich internal structure from next-token prediction alone.2122

Andrej Karpathy, Building makemore Part 2: MLP, online lecture, 2020
“…you can transfer knowledge through that embedding, and you can generalize in that way.”
Building makemore Part 2: MLP, online lecture, 2020 · full transcript →

Neural networks are not brains, but they can still become strange and capable systems

Karpathy does not frame artificial neural networks as literal replicas of biology. He treats them as a distinct kind of constructed intelligence, shaped by very different optimization pressures from those that produced animal brains. That difference is part of why he describes them as alien artifacts rather than familiar natural minds.23

At the same time, he takes their capabilities seriously. Sequence models can learn variable-length structure, reuse the same parameters across time, and discover patterns in text without explicit symbolic programming. In his examples, recurrent models begin to uncover higher-level regularities from raw sequence prediction, and modern large models push that same idea much further.242526

That leads to his broader outlook: synthetic intelligences are not a sideshow but a major developmental direction. Neural networks matter to him not only because they solve tasks, but because scaling optimization over simple components appears to be producing genuinely new forms of intelligence.2723

Karpathy on neural networks, in his own words

“Even neural networks are just a mathematical expression.”
Educational talk, 2021-11
“…forward, backward, update; forward, backward, update.”
CS231n Winter 2016 Lecture 4
“…the network is very confidently wrong…”
Building makemore Part 3 lecture, 2021

Where to watch

  1. Andrej Karpathy on Neural Networks: Building Micrograd2021 · 146 min · full transcriptBest single walkthrough of Karpathy’s core view: neural nets as expressions trained by autograd and backprop.
  2. Andrej Karpathy on Software 2.0: Data Is the Code2017 · 18 min · full transcriptExplains why he sees neural networks as a new software paradigm where data and optimization replace hand-written rules.
  3. Andrej Karpathy on Activations & Gradients: BatchNorm2021 · 116 min · full transcriptShows the practical side of neural nets: initialization, activations, gradients, and why models fail or learn.
  4. Andrej Karpathy on Backpropagation: Computational Graphs and Gradients2016 · 80 min · full transcriptGives the clearest conceptual explanation of backpropagation as chain rule over computational graphs.
  5. Andrej Karpathy on MLPs for Language Modeling: makemore2020 · 76 min · full transcriptA concrete example of how embeddings and MLPs let neural nets generalize beyond naive count tables.
  6. Andrej Karpathy on Artificial Intelligence: Aliens, AGI, and Exploits2024 · 209 min · full transcriptBest for Karpathy’s philosophical view of artificial neural nets as powerful, non-biological intelligences.

Questions people ask

Go deeper · free courseThe Andrej Karpathy Course13 chapters on everything Karpathy taught, with a certificate at the end.Start learning →

Sources

Every quote above, word for word from the transcripts. Numbers match the text.

1
“Even neural networks are just a mathematical expression.”
Educational talk, 2021-11
2
“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 backpropagation would be at the mathematical core of any modern deep neural network library, like say PyTorch or JAX. So the functionality of micrograd is, I think, best illustrated by an example, so…”
Educational talk, 2021-11answer page →
3
“…micrograd is basically an autograd engine.”
Educational talk, 2021-11
4
“…the correct thing to do is to multiply them…”
CS231n Winter 2016 Lecture 4
5
“…forward, backward, update; forward, backward, update.”
CS231n Winter 2016 Lecture 4
6
“…the backward pass for tanh is one minus t squared…”
Educational talk, 2021-11
10
“…your data set is really the code.”
NIPS conference talk, 2017
11
“…this is a whole new way of designing software and we need tooling for it.”
NIPS conference talk, 2017
12
“…design less, and leave more to the optimization.”
NIPS conference talk, 2017
13
“…the network is very confidently wrong…”
Building makemore Part 3 lecture, 2021
14
“At initialization, we have no reason to believe any characters to be much more likely than others, and so we'd expect that the probability distribution that comes out initially is a uniform distribution assigning about equal probability to all the 27 characters. So basically, what we'd like is the probability for any character would be roughly 1 over 27. That is the probability we should record, and then the loss is the negative log probability. So let's wrap this in a tensor and then we can take the log of it, and then the negative log probability is the loss we would expect, which is 3.29, much, much lower than 27.”
Building makemore Part 3 lecture, 2021answer page →
15
“…batch normalization was the first kind of normalization layer to be introduced…”
Building makemore Part 3 lecture, 2021
17
“You'll notice that in the update here, the learning rate is scaled as a function of number of iterations, and it shrinks. This is something called learning rate decay. So, in the beginning, you have a high learning rate, and as the network sort of stabilizes near the end, you bring down the learning rate to get some of the fine details in the end. And in the end, we see the decision surface of the neural net, and we see that it learns to separate out the red and the blue area based on the data points.”
Educational talk, 2021-11answer page →
18
“That the predictions from this model are not very good because you only take one character of context. So the model didn't produce very name-like sounding things. Now, the problem with this approach, though, is that if we are to take more context into account when predicting the next character in the sequence, things quickly blow up, and this table—the size of this table—grows, and in fact it grows exponentially with the length of the context. Because if we only take a single character at a time, that's 27 possibilities of context. But if we take two characters in the past and try to predict the third one, suddenly the number of rows in this matrix, you can look at it that way, is 27 * 27. So there's 729 possibilities for what could have come in the context.”
Building makemore Part 2: MLP, online lecture, 2020answer page →
19
“…you can transfer knowledge through that embedding, and you can generalize in that way.”
Building makemore Part 2: MLP, online lecture, 2020
20
“In a neural network, the reason we arrange these into layers is because arranging them into layers allows us to perform the computation much more efficiently. So instead of having an amorphous blob of neurons, and every one of them has to be computed independently, having them in layers allows us to use vectorized operations. And so we can compute an entire set of neurons in a single hidden layer just at a single time as a matrix multiply, and that's why we arrange them in these layers where neurons inside a layer can be evaluated completely in parallel, and they all see the same input. So it's a computational trick to arrange them in layers.”
CS231n Winter 2016 Lecture 4answer page →
21
“So the attention is the reduce, and the MLP is the map. And what you end up with is that the Transformer just ends up just being a repeated application of map produce if you want to think about it that way. So this is where they communicate, and this is where they think individually about the information that they've gathered. And every one of these blocks iteratively refines the representation at the residual stream.”
OpenAI / online talk, 2022-11answer page →
22
“…everything here is just the other weights and biases and everything else of this Transformer…”
OpenAI / online talk, 2022-11
23
“I think of it as a very complicated alien artifact.”
Lex Fridman Podcast #333, 2024
24
“We can actually operate over sequences: sequences at the input/output or both at the same time.”
CS231n Winter 2016 Lecture 10, 2017
25
“This is what allows us to process, you know, variably sized inputs.”
CS231n Winter 2016 Lecture 10, 2017
26
“…the RNN starts to discover that okay this input data is actually made up of words…”
Conference/meetup talk, February 2017
27
“Synthetic intelligences are the next stage of development.”
Lex Fridman Podcast #333, 2024

How this guide was made: drafted with AI from the full transcripts of the recordings cited, then checked: every quotation must match a transcript word for word and be the speaker's own words, and an independent review gates accuracy. Methodology and corrections.

All 13 recordings of Andrej Karpathy on Neural Networks

Andrej Karpathy on GPT From Scratch: How ChatGPT Works1:56:20

Andrej Karpathy on GPT From Scratch: How ChatGPT Works

2022 · 8.3M views

Karpathy builds a GPT-style Transformer from first principles, explains tokenization, attention, and how ChatGPT differs from pretraining and fine-tuning, in a 2022 keynote.

Andrej Karpathy on Neural Networks: Building Micrograd2:25:52

Andrej Karpathy on Neural Networks: Building Micrograd

2021 · 4.5M views

Karpathy builds micrograd from scratch to explain neural network training, backpropagation, derivatives, and debugging in an educational talk in 2021.

Andrej Karpathy on Character-Level Language Modeling: Building makemore1:57:45

Andrej Karpathy on Character-Level Language Modeling: Building makemore

2020 · Interview · 1.3M views

Karpathy builds a character-level language model from scratch, from bigrams and sampling to loss, smoothing, and a neural-net version, in makemore (2020).

Andrej Karpathy on GPT-2 Reproduction: Rebuilding 124M From Scratch4:01:26

Andrej Karpathy on GPT-2 Reproduction: Rebuilding 124M From Scratch

2022 · 1.2M views

Karpathy rebuilds GPT-2 124M from scratch, explaining the architecture, training setup, and speedups like Torch Compile and Flash Attention at an OpenAI talk in 2022.

Andrej Karpathy on MLPs for Language Modeling: makemore1:15:40

Andrej Karpathy on MLPs for Language Modeling: makemore

2020 · 617K views

Karpathy builds makemore with an MLP, showing embeddings, cross-entropy, minibatches, and sampling from a character model.

Andrej Karpathy on Activations & Gradients: BatchNorm1:55:58

Andrej Karpathy on Activations & Gradients: BatchNorm

2021 · 573K views

Karpathy explains neural net initialization, saturated activations, vanishing gradients, and batch norm in his 2021 makemore lecture.

Andrej Karpathy on PyTorch at Tesla11:11

Andrej Karpathy on PyTorch at Tesla

2018 · 559K views

Karpathy explains how Tesla uses PyTorch to train autonomy networks, manage data pipelines, and deploy models to the fleet at an industry talk in 2018.

Andrej Karpathy on Backpropagation: Computational Graphs and Gradients1:19:39

Andrej Karpathy on Backpropagation: Computational Graphs and Gradients

2016 · 333K views

Karpathy explains backpropagation through computational graphs, chain rule, Jacobians, and neural net layers in CS231n Lecture 4 from 2016.

Andrej Karpathy on Deep Learning: From ImageNet to AGI15:11

Andrej Karpathy on Deep Learning: From ImageNet to AGI

2019 · 202K views

Karpathy explains why deep learning felt like a new programming paradigm, how he benchmarked human ImageNet performance, and what he learned about AGI.

Andrej Karpathy on Recurrent Neural Networks: LSTMs and Captioning1:09:54

Andrej Karpathy on Recurrent Neural Networks: LSTMs and Captioning

2017 · 131K views

Karpathy explains RNNs, LSTMs, and image captioning with practical intuition, code, and demos in CS231n Lecture 10.

Andrej Karpathy on Software 2.0: Data Is the Code17:55

Andrej Karpathy on Software 2.0: Data Is the Code

2017 · 73K views

Karpathy explains Software 2.0 and how Tesla uses data, labeling, and optimization to build self-driving systems at NIPS, 2017.

Andrej Karpathy on RNNs and LSTMs: Text and Image Generation15:47

Andrej Karpathy on RNNs and LSTMs: Text and Image Generation

2017 · 21K views

Karpathy explains RNNs, character-level text generation, and image captioning with vivid demos from a 2017 talk.

Andrej Karpathy on Artificial Intelligence: Aliens, AGI, and Exploits3:28:48

Andrej Karpathy on Artificial Intelligence: Aliens, AGI, and Exploits

2024 · 6.6M views

Karpathy discusses neural nets, AGI, self-driving, Tesla, aliens, and the idea that physics may have exploits in Lex Fridman Podcast #333.

Search every transcript
Open the full search page →