Confirmed · 5 videos

Reduce to the minimal readable core

Strip a system to the smallest readable implementation that captures the algorithm, and reject complexity whose gains do not justify the cost.

In micrograd, microgpt, minGPT, nanoGPT, llm.c and minbpe, Karpathy shows that the core algorithm is small and that most remaining complexity exists only for efficiency. He treats readability and hackability as forms of accessibility. He keeps the main path simple, isolates experimental code, and prefers simple stacks and rewrites that focus on the core value.

Based on Andrej Karpathy's public content. Not affiliated with or endorsed by Andrej Karpathy.

What following it looks like

  • Writes a dependency-free single-file version of the full algorithm
  • Rejects small speedups that need disproportionate complexity or unusual dependencies
  • Keeps experimental code in a separate dev folder away from the main path
  • Exposes a single complexity dial, such as depth, instead of sprawling configuration

Evidence · 12 quotes from 5 videos

Each quote was matched word for word against the transcript. Tap the time to hear it.

“this is really done so that you understand and refactor out back propagation and chain rule and understanding of neurologic training”

5:52to not have to deal with these n-dimensional tensors that you would use
5:54n-dimensional tensors that you would use in modern deep neural network library so
5:56in modern deep neural network library so this is really done so that you
5:58this is really done so that you understand and refactor out back
6:00understand and refactor out back propagation and chain rule and

“but none of the math changes this is done purely for efficiency”

6:04understanding of neurologic training and then if you actually want to train
6:06and then if you actually want to train bigger networks you have to be using
6:08bigger networks you have to be using these tensors but none of the math
6:09these tensors but none of the math changes this is done purely for
6:11changes this is done purely for efficiency we are basically taking scale

“you can understand how things work uh at the fundamental level and then you can speed it up later”

6:38useful to be dealing with tensors from scratch uh and i think and that's why i
6:40scratch uh and i think and that's why i fundamentally wrote micrograd because
6:42fundamentally wrote micrograd because you can understand how things work uh at
6:44you can understand how things work uh at the fundamental level and then you can
6:46the fundamental level and then you can speed it up later okay so here's the fun

“This file contains the full algorithmic content of what is needed: dataset of documents, tokenizer, autograd engine, a GPT-2-like neural network architecture, the Adam optimizer, training loop, and inference loop.”

“Everything else is just efficiency.”

“All of these are important engineering and research contributions but if you understand microgpt, you understand the algorithmic essence.”

“0 frameworks were used to make this simple responsive website because I am becoming seriously allergic to [500-pound”

“This one is pure HTML and CSS in two static files and that's it.”

“I always try to find the first-order terms or the second-order terms of everything.”

“How can I simplify it? How can I have a simplest thing that shows that thing, shows it in action, and then I can tack on the other terms?”

“But the core intellectual piece of neural network training is micrograd. It’s 100 lines. You can easily understand it.”

“The code itself is plain and readable: `train.py` is a ~300-line boilerplate training loop and `model.py` a ~300-line GPT model definition, which can optionally load the GPT-2 weights from OpenAI.”

Linked topics