Source

GitHub · autoresearch: AI agents running research on single-GPU nanochat training automatically

Open the source

Karpathy presents a compact system in which an AI agent autonomously modifies an LLM training program, runs fixed-duration experiments, evaluates them, and keeps or discards changes. He teaches that tightly constrained, comparable experiments—and human-written agent instructions—can turn a single-GPU repository into a lightweight autonomous research setup.

- An AI agent can repeatedly edit training code, train for five minutes, evaluate the result, and keep or discard the change. - The human’s primary programming surface is `program.md`, which supplies context and instructions to the research agent. - Restricting agent edits to one file keeps the experimental scope manageable and makes diffs easier to review. - A fixed five-minute wall-clock budget makes architectural and hyperparameter experiments directly comparable on the same platform. - Validation bits per byte is used because lower values are better and the metric is independent of vocabulary size. - For smaller computers, Karpathy recommends simplifying the dataset, model, sequence length, evaluation workload, attention pattern, and batch size.

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

Supports these rules

Quotes from this video

“**Single file to modify.** The agent only touches `train.py`. This keeps the scope manageable and diffs reviewable.”

“**`train.py`** the single file the agent edits. Contains the full GPT model, optimizer (Muon AdamW), and training loop. Everything is fair game: architecture, hyperparameters, optimizer, batch size, etc. **This file is edited and iterated on by the agent**.”

“by the human**. By design, training runs for a **fixed 5-minute time budget** (wall clock, excluding startup/compilation), regardless of the details of your compute.”

“First, this makes experiments directly comparable regardless of what the agent changes (model size, batch size, architecture, etc).”

“the details of your compute. The metric is **val_bpb** (validation bits per byte) lower is better, and vocab-size-independent so architectural changes are fairly compared.”

“The training code here is a simplified single-GPU implementation of [nanochat](https://github.com/karpathy/nanochat). The core idea is that you're not touching any of the Python files like you normally would as a researcher. Instead, you are programming the `program.md` Markdown files that provide context to the AI agents and set up your autonomous research org.”

“the setup first. The `program.md` file is essentially a super lightweight "skill".”

“Second, this means that autoresearch will find the most optimal model for your platform in that time budget.”

“The downside is that your runs (and results) become not comparable to other people running on other compute platforms.”

“To get half-decent results I'd use a dataset with a lot less entropy, e.g. this [TinyStories dataset](https://huggingface.co/datasets/karpathy/tinystories-gpt4-clean).”

“I think these would be the reasonable hyperparameters to play with.”

Topics