Andrej Karpathy's autoresearch repository implements an autonomous AI research agent that iteratively modifies a single-file GPT training script (train.py) to minimize validation bits-per-byte (val_bpb) within a fixed 5-minute wall-clock budget per experiment. The system comprises three core files: prepare.py (immutable constants, data download, BPE tokenizer training at vocab_size=8192, dataloader, evaluation), train.py (the agent-editable file containing a nanochat-derived GPT model, Muon+AdamW optimizer, and training loop), and program.md (human-editable agent instructions). Training runs on a single NVIDIA GPU (tested on H100) using uv for dependency management. The fixed time budget yields ~12 experiments/hour, enabling ~100 overnight runs; val_bpb provides vocabulary-size-independent comparison across architectural changes. Default hyperparameters include DEPTH=8, MAX_SEQ_LEN=1024, TOTAL_BATCH_SIZE=2**19 (~524K tokens), WINDOW_PATTERN="SSSL" (alternating banded attention), and EVAL_TOKENS for validation. For smaller compute (MacBook, Windows RTX, AMD), the README recommends reducing DEPTH to 4, vocab_size to 256-4096, MAX_SEQ_LEN to 256, TOTAL_BATCH_SIZE to 2**14, switching to TinyStories dataset, and using WINDOW_PATTERN="L". Community forks exist for macOS (miolini, trevin-creator), Windows (jsegov), and AMD (andyluo7). The repo is MIT-licensed and intentionally minimal—no distributed training, Flash Attention 3, or multi-device support.
Read original
github-trending/python