本文へスキップ
The Karpathy loop

The Karpathy loop: learn an AI concept by rebuilding it and teaching it

Pick one idea you use but cannot explain, rebuild the smallest version that runs, explain it out loud, and publish the code with the explanation. Coding agents make the rebuild fast; in MAO, a Builder, a Student and an Explainer share the notes and ask each other questions while you learn.

  • Karpathy's public work follows one loop: rebuild a famous system small, explain it step by step, ship the code.
  • Coding agents can write the toy version for you, which makes understanding it the part that is left to do.
  • In MAO, a Builder, a Student and an Explainer are wired to the same notes and ask each other with mao ask.
著者:更新日:約9分で読めます

The Karpathy loop is simple: pick one idea everyone uses but few understand, rebuild it from scratch as small as possible, explain it out loud step by step, ship the code so others can run it, name what you learned, and repeat. Andrej Karpathy has run it for more than a decade, from Stanford's CS231n to micrograd, nanoGPT and nanochat. You can run it in four weekends. A coding agent can write the toy version in minutes, so the work that is left is understanding it, and that is the point. In MAO, you put a Builder agent, a Student agent and an Explainer agent on one canvas, wired to the same notes, so the explanation gets tested before anyone else hears it.

What is the Karpathy loop?

Rebuild a famous system small, explain it in public, ship the code, repeat.

Look at what Karpathy does with his time rather than at his job titles. He takes something complicated, rebuilds it in as little code as possible, and explains it so clearly that a stranger can follow. Put together, his public work reads as six steps:

  1. Pick one idea everyone uses but few understand.
  2. Rebuild it from scratch, as small as possible.
  3. Explain it in public, out loud, step by step.
  4. Ship the code so others can run it.
  5. Name what you learned.
  6. Repeat with the next idea.

None of these steps needs a famous employer, and each one compounds: the code you ship is the next person's starting point, and the explanation is what people remember you for.

Where does the loop show up in his work?

At every stage, before and after the big jobs. The titles changed; the loop did not.

YearWhat he didThe loop in it
2015Designed and taught CS231n at Stanford with Fei-Fei Li, a deep learning class that grew from 150 students in 2015 to 750 in 2017Teaching forced a full understanding; the free notes and videos taught a large part of the field
2015Published "The Unreasonable Effectiveness of Recurrent Neural Networks", with char-rnn under the MIT licenseReaders trained it on Shakespeare, Wikipedia and Linux source in an afternoon
2017–2022Director of AI at Tesla, leading Autopilot's computer vision team; wrote "Software 2.0"Named what the job taught him: you curate data instead of writing rules
2022 onwardNeural Networks: Zero to Hero, from micrograd to a GPT and its tokenizerEach repository strips a famous system to the part you need to understand
2024Founded Eureka Labs, "a new kind of school that is AI native"Went back to teaching, with better tools

The repositories are the clearest example of step 2:

  • micrograd: backpropagation you can read in one sitting.
  • makemore: character-level language models.
  • nanoGPT: a small, readable GPT trainer.
  • llm.c: GPT-2 training in plain C and CUDA.
  • nanochat: "the simplest experimental harness for training LLMs", from tokenizer to chat.

The lesson is not "read his code". It is "build the small version yourself".

Why does rebuilding beat reading?

Because each level of contact shows you something the one before hid.

What you doWhat you know afterwards
Read the paperThe words
Use the libraryWhat it is for
Implement itThe mechanics
Teach it to someoneWhat actually matters

The last row is the one people skip. Explaining something out loud, to someone who stops you at every word you have not defined, is where gaps you did not know you had come to the surface. When you explain something well, you also get to name it, which is how "Software 2.0" and "vibe coding" entered the vocabulary.

How do I run the loop in four weekends?

One concept, one weekend per step. The first one will be rough; the fifth will be better than many paid courses.

  1. Week 1: pick. Choose one concept you use every day but cannot explain: attention, embeddings, RAG, an agent loop, backpropagation. Write down what you can already say about it and three questions you cannot answer yet.
  2. Week 2: rebuild. Write a toy version in the smallest code you can. No library that hides the part you are learning: for attention, write the softmax and the matrix products yourself. Ugly is fine; working is the point. Every step should print or show something.
  3. Week 3: explain. Record yourself explaining it from a blank screen. No slides.
  4. Week 4: ship. Publish the repository and the recording together, then one post about the part that surprised you.

Doesn't an AI agent make the rebuild pointless?

No. It moves the work from typing the code to understanding it, which was always the part that mattered.

A coding agent can write a working toy transformer in minutes. If you stop there, you have code you did not write and do not understand, which is worse than reading the paper. Used well, an agent changes what the four weekends are spent on:

  • It writes the scaffolding, so your time goes to the one idea you picked, not to data loading.
  • It explains on demand: you can ask why this shape, why this constant, what breaks if this line goes.
  • It can play the newcomer. An agent told to know nothing about the concept, run every step and ask about every undefined word is a patient first audience for your explanation.

What it cannot do is decide what deserves to be understood, rebuild it with taste, and make it click for a room. That part stays yours.

How do I set the loop up with coding agents in MAO?

Put three agents on one canvas, give each a role, and wire them to each other and to four notes.

NodeRoleWhat it does
BuilderFrom-scratch builderRebuilds the concept one runnable step at a time and logs each step with the command to run it
StudentCurious studentRuns every step from the log, says what it thinks the code does, and asks about every undefined word
ExplainerExplainerTurns the build log and the Student's questions into a lecture script and a post draft
Concept briefnoteThe concept, the allowed libraries, the four-weekend checklist
Build lognoteOne entry per step, the Student's questions and the surprises
Lecture scriptnoteWhat to type and say, part by part, from a blank screen
Post draftnoteThe post about the part that surprised you
  1. Open a canvas on an empty project folder and add three agent terminals, for example Claude Code or Codex. Name them Builder, Student and Explainer.
  2. Give each one a role from its agent sheet. A role is a reusable block of instructions; save each one with Save as role so the next concept starts from the same three.
  3. Add the four notes and write the concept and the rules in the Concept brief.
  4. Connect the Builder to the Student and the Explainer, and the Student to the Explainer, so they can send each other tasks. Connect each agent to the notes it needs: a wire grants access only to the node at its other end.
  5. Tell the Builder to start. Each agent reads and appends to the notes with the mao note commands and asks the others with mao ask, for example:
mao ask "Builder" "Step 3 changed the output shape and the log does not say why. Explain, then fix the log."
  1. When the canvas works, select it and choose Save arrangement…, so the next concept starts from the same layout.

You stay in the loop the whole time: you pick the concept, you read every step, and you record the explanation yourself. The agents make the rebuild fast and test the explanation before anyone else hears it.

The Builder, Student and Explainer instructions are also written up as a pack, Learn by rebuilding, with the four notes and two arrangements (the full four weekends, and a weekend sprint with only the Builder and the Student). It asks for the concept and the allowed libraries when you add it to a canvas. It will be listed for the MAO release that adds packs.

What are the ways to run the loop?

You do not need MAO for the loop. Choose by how much help you want with the explaining step.

ApproachRebuildExplainBest for
Alone, with a notebookSlow, every line yoursYou find the gaps when you recordThe deepest understanding, if you have the time
One coding agentFastYou ask it questions in the same sessionA first pass at a concept
Two agents, builder and student, in separate terminalsFastYou copy the student's questions to the builderTesting an explanation without setup
MAO with a Builder, a Student and an ExplainerFastThe agents ask each other and write into shared notesRunning the loop every month

Frequently asked questions

Something you already use every week and could not explain on a whiteboard: attention, embeddings, a tokenizer, RAG, or an agent loop. Small and well documented beats new and exciting.

Small enough to read in one sitting, and large enough to run end to end and show a result. micrograd's engine is about 100 lines of Python, which is a good target.

The recording is the step most people skip, and it is the one that finds the gaps. Publishing it is optional; making it is not.

They can draft the lecture script and the post, and a Student agent can test them. The explanation you record has to be yours, or you have skipped the step that teaches you.

No. The Builder, Student and Explainer are ordinary agent terminals with roles. Role instructions are added to ACP agents' prompts automatically; a PTY-only agent needs them pasted in.

Sources

Checked on 2026-10-29.

ご質問は?Discordで質問するか、hello@miguer.comまでメールでお知らせください。

自分のリポジトリで試す

エージェントをひとつのキャンバスに。

キャンバスの全機能を使える7日間のトライアル。カードは不要です。