Inside Karpathy's autoresearch — Building an AI Research Lab in 630 Lines
A code-level deep dive into Karpathy's autoresearch. Dissecting train.py, BPE tokenizer, MuonAdamW optimizer, and the agent protocol design.

Inside Karpathy's autoresearch -- Building an AI Research Lab in 630 Lines
Andrej Karpathy released autoresearch in March 2026. This post is a code-level deep dive into how a single 630-line train.py lets an AI agent autonomously run 100+ ML experiments overnight.
This is Part 1 of a 3-part series on autoresearch.
- [Part 1](/post/autoresearch-part1-en) (this post): Project structure and deep code analysis
- [Part 2](/post/autoresearch-part2-en): Running it yourself and analyzing the results
Related Posts

Build Your Own autoresearch — Applying Autonomous Experimentation to Any Domain
Apply the autoresearch pattern to text classification, image classification, and RAG pipelines. Includes a universal experiment runner and program.md template.

Running autoresearch Hands-On — Overnight Experiments on a Single GPU
From environment setup to agent execution and overnight results analysis. Tuning guide for smaller GPUs and practical tips.

Agent Production — From Guardrails to Docker Deployment
Build safe agents with 3-layer Guardrails (Input/Output/Semantic), deploy with FastAPI + Docker. Includes HITL, rate limiting, and production monitoring checklist.