Neural network training and debugging
He gives a staged recipe for training: inspect data, verify the pipeline, overfit, regularize, tune. He adds diagnostics such as train/validation gaps, initial-loss checks and activation statistics.
Based on Andrej Karpathy's public content. Not affiliated with or endorsed by Andrej Karpathy.
Rules
Understand the backward pass
ConfirmedVerify each stage before adding complexity
ConfirmedRun small, comparable experiments
ConfirmedMatch the tool to the task
Covered in
GitHub · char-rnn: Multi-layer Recurrent Neural Networks (LSTM, GRU, RNN) for character-level language models in Torch
This README describes char-rnn, Karpathy's Torch code for training multi-layer RNN/LSTM/GRU character-level language models and sampling text from them. Beyond usage, he teaches practical training wisdom: match parameter count to dataset size, monitor training vs. validation loss to diagnose over/underfitting, and pick the checkpoint with the lowest validation loss.
A Recipe for Training Neural Networks
Karpathy teaches a cautious, staged process for training neural networks because their abstractions leak and failures often remain hidden. He recommends understanding the data first, validating a simple end-to-end pipeline, increasing capacity until the model can overfit, regularizing, tuning, and only then applying final performance improvements.
Building makemore Part 2: MLP
This source is a short video description for Andrej Karpathy's lesson implementing a multilayer perceptron (MLP) character-level language model as part of the makemore series. He uses the build to introduce many machine learning basics, including model training, learning rate tuning, hyperparameters, evaluation, train/dev/test splits, and under/overfitting.
Deep Neural Nets: 33 years ago and 33 years from now
Karpathy reproduces LeCun et al.'s 1989 zip code recognition paper in PyTorch and uses it as a case study on progress in deep learning. He shows that modern techniques (cross entropy, AdamW, data augmentation, dropout, ReLU) cut the error by about 60%, and that scaling data helps further. He then extrapolates these lessons to predict how 2055 will view 2022 deep learning, arguing that training from scratch is giving way to finetuning and prompting foundation models.
Breaking Linear Classifiers on ImageNet
Karpathy explains adversarial 'fooling' images and argues that they are not a flaw of deep learning or of images specifically, but stem from the linear nature of model components. He shows that even a simple linear classifier on ImageNet can be fooled with imperceptible changes. He walks through how fooling works by reversing gradient-based training, gives a toy logistic regression example, and discusses how regularization relates to fooling resistance.
Building makemore Part 3: Activations & Gradients, BatchNorm
This source, a short video description, says Karpathy examines the internals of multi-layer MLPs. He looks at the statistics of forward-pass activations and backward-pass gradients, the pitfalls of scaling them improperly, and the typical diagnostic tools and visualizations used to understand them. The text is cut off, so these notes cover only the description.
GitHub · llama2.c: Inference Llama 2 in one file of pure C
Karpathy presents llama2.c, a minimal train-in-PyTorch, inference-in-pure-C implementation of the Llama 2 architecture, and uses it to teach that small models on narrow domains can perform surprisingly well. He explains practical topics such as sampling settings, int8 quantization, custom tokenizers, hyperparameter tuning for training, and CPU performance flags. He also states a design philosophy that puts simplicity, readability and hackability ahead of maximum efficiency.