Purpose
autoresearch is an autonomous AI agent project for automating machine learning research. Its goal is to give an AI agent a small but real LLM training environment, letting it run experiments autonomously overnight: modify the code, train for 5 minutes, check whether the results improved, keep or discard, then repeat. When you wake up in the morning, you get an experiment log and (hopefully) a better model.
Main capabilities
- Autonomously modify training code and iterate on experiments.
- Train within a fixed 5-minute time budget, making experiments with different changes (model size, batch size, architecture, etc.) directly comparable.
- Use val_bpb (validation bits per byte) as the metric, where lower is better and it is independent of vocabulary size, making comparisons of architectural changes fair.
- Expect roughly 12 experiments per hour, and roughly 100 experiments during sleep.
- Self-contained: no external dependencies other than PyTorch and a few small packages, no distributed training, no complex configuration.
How to use
The project has only three key files:
- prepare.py: fixed constants, one-time data preparation (download training data, train BPE tokenizer), and runtime utilities (data loader, evaluation). Do not modify.
- train.py: the only file the agent edits. It contains the complete GPT model, optimizer (Muon + AdamW), and training loop. The architecture, hyperparameters, optimizer, batch size, etc. can all be modified.
- program.md: the baseline instructions for a single agent. Point the agent at this file and let it run. This file is iterated on by humans.
To run the agent: launch Claude/Codex or whatever tool you want in the repository (with all permissions disabled), then prompt something like this. program.md is essentially an ultra-lightweight "skill".
Applicable scenarios
- Automated LLM training experiments on a single GPU.
- Explore the effects of changes to architecture, hyperparameters, optimizer, batch size, etc. on training results.
- As a starting point for an autonomous research organization, you can iterate on program.md to find the "research organization code" that achieves the fastest research progress, or add more agents.
Limitations
- Currently requires a single NVIDIA GPU (tested on H100), Python 3.10+, and uv.
- In principle, platforms such as CPU and MPS can be supported, but this would increase the code size; the author is currently unsure whether to take that on personally. You can refer to the full/parent nanochat repository, which has broader platform support (such as a Flash Attention 3 kernel fallback implementation, generic device support, automatic detection, etc.).
- Due to the fixed time budget, your run results are not comparable to run results on other computing platforms.
- When running on a computing platform much smaller than an H100, the author recommends using some forks and gives tuning suggestions: use a lower-entropy dataset (such as TinyStories), reduce vocab_size, reduce MAX_SEQ_LEN, reduce EVAL_TOKENS, reduce DEPTH, use a WINDOW_PATTERN of "L", reduce TOTAL_BATCH_SIZE (keep it a power of 2), etc.
Platform support and related forks
The current code requires a single NVIDIA GPU. Related forks include: miolini/autoresearch-macos (MacOS), trevin-creator/autoresearch-mlx (MacOS), jsegov/autoresearch-win-rtx (Windows), andyluo7/autoresearch (AMD).