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.
- 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.

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

“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

“…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

“…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

“…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.”
“…forward, backward, update; forward, backward, update.”
“…the network is very confidently wrong…”
Where to watch
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.
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.
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.
Andrej Karpathy on Backpropagation: Computational Graphs and Gradients2016 · 80 min · full transcriptGives the clearest conceptual explanation of backpropagation as chain rule over computational graphs.
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.
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
- What did Andrej Karpathy say about why deep learning felt more compelling than traditional AI?
- What is micrograd and why did Andrej Karpathy build it?
- What did Andrej Karpathy say about overfitting and hyperparameter tuning?
- What initialization loss did Andrej Karpathy expect for a character-level language model?
- Why did Andrej Karpathy say bigram language models break down with more context?
- Why does Andrej Karpathy say neural networks are arranged in layers?
Sources
Every quote above, word for word from the transcripts. Numbers match the text.
“Even neural networks are just a mathematical expression.”
“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…”
“…micrograd is basically an autograd engine.”
“…the correct thing to do is to multiply them…”
“…forward, backward, update; forward, backward, update.”
“…the backward pass for tanh is one minus t squared…”
“…your data set is really the code.”
“…this is a whole new way of designing software and we need tooling for it.”
“…design less, and leave more to the optimization.”
“…the network is very confidently wrong…”
“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.”
“…batch normalization was the first kind of normalization layer to be introduced…”
“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.”
“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.”
“…you can transfer knowledge through that embedding, and you can generalize in that way.”
“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.”
“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.”
“…everything here is just the other weights and biases and everything else of this Transformer…”
“I think of it as a very complicated alien artifact.”
“We can actually operate over sequences: sequences at the input/output or both at the same time.”
“This is what allows us to process, you know, variably sized inputs.”
“…the RNN starts to discover that okay this input data is actually made up of words…”
“Synthetic intelligences are the next stage of development.”
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.






