Hao's last question is what happens when an agent runs the training loop for you. autoresearch is the repo for that idea. One important correction to the post: Hao describes this as an agent running stop 4, nanoGPT, for you. The autoresearch README says the training code is a simplified single-GPU implementation of nanochat, which is stop 6. The idea is the same. The file the agent edits is not nanoGPT's train.py.
Three files, one metric, a fixed clock
The repo is kept small on purpose.
prepare.pyholds constants, data prep, and runtime helpers. The agent does not modify it.train.pyholds the GPT, the optimizer, and the training loop. This is the only file the agent edits.program.mdholds the instructions for the agent. This is the file the human edits.
Each experiment trains for a fixed five-minute wall-clock budget, not counting startup and compilation. The metric is val_bpb, validation bits per byte. Lower is better. Bits per byte does not depend on vocabulary size, so a change to the tokenizer or the architecture can still be compared fairly. Hao's post said the agent keeps a change "only if validation loss improves." In this repo, the keep-or-discard signal is val_bpb, which is a validation metric, not the raw token loss.
flowchart LR
Edit["Agent edits train.py"] --> Train["Train for 5 minutes"]
flowchart LR
Edit["Agent edits train.py"] --> Train["Train for 5 minutes"]
Train --> Metric["Read val_bpb"]
flowchart LR
Edit["Agent edits train.py"] --> Train["Train for 5 minutes"]
Train --> Metric["Read val_bpb"]
Metric --> Keep["Keep if val_bpb improved"]
Metric --> Drop["Otherwise discard"]
Keep --> Edit
Drop --> Edit
Because every run lasts five minutes, the README says you can expect about 12 experiments per hour, and about 100 experiments while you sleep, on one GPU. That is Hao's "about 100 experiments overnight" figure, taken from the repo. The fixed clock has two effects. Runs on the same machine are comparable, even when the agent changes model size or batch size. Runs on different machines are not, because five minutes on an H100 is not five minutes on a laptop.
A keep-if-improved loop can overfit the validation set if that is the only score it ever sees. A held-out check is a good extra test. The official repo does not make that extra split the main loop. If you use this for real experiments, add one.
What you can run, and what came of it
The official repo currently needs a single NVIDIA GPU. It was tested on an H100. The README points at community forks for macOS, Windows, and AMD, including miolini/autoresearch-macos and trevin-creator/autoresearch-mlx. It also lists hyperparameter changes that make sense on a much smaller machine, such as a narrower dataset like TinyStories, a smaller vocabulary, a shorter sequence length, and a lower DEPTH.
git clone https://github.com/karpathy/autoresearch.git
cd autoresearch
uv sync
uv run prepare.py
uv run train.py
uv run train.py is one five-minute experiment, once the data and tokenizer are ready. Autonomous mode is then a coding agent, pointed at program.md. The README is direct about needing to disable permissions if you let the agent go overnight. That is a real risk. Do not point an unsupervised agent at a machine you cannot afford to let it use.
This loop has already moved the official nanochat leaderboard. Round 1, on 9 March 2026, cut time-to-GPT-2 from 2.02 hours to 1.80 hours. Round 2, on 14 March 2026, cut it to 1.65 hours. Those changes were found by the agent on a smaller d12 model and then confirmed at the speedrun scale. That is the payoff of stop 7: the same training loop you learned to read, now run by an agent, with a human still in charge of the instructions in program.md.
Key concepts
- Autoresearch lets an agent edit train.py, train for five minutes, and keep the change only if validation bits per byte improves.
- The training code is a simplified single-GPU nanochat, not nanoGPT, even though the inspiring post described it as running stop 4.
- The human edits program.md. The agent edits train.py. prepare.py stays fixed.
- A five-minute budget gives about 12 experiments per hour, or about 100 overnight, on one GPU.
- The official repo needs NVIDIA GPU support. Community forks exist for other platforms.
- Autoresearch rounds 1 and 2 are credited on the nanochat leaderboard for the 1.80 hour and 1.65 hour records.
Takeaways
- Describe the loop with the metric the repo actually uses, val_bpb, not only the words validation loss.
- If you run it, start with one manual uv run train.py, and think carefully before you give an agent unsupervised access.
- Keep a held-out check in mind. A loop that only watches one validation set can fit that set.