Karpathy 设计的自主 ML 研究基础架构,可自动进行研究。支持多 GPU 并行运行、结构化实验跟踪和自适应搜索策略。
Karpathy 设计的自主 ML 研究基础架构,可自动进行研究。支持多 GPU 并行运行、结构化实验跟踪和自适应搜索策略。
Above: a 1-hour test run on dual RTX 4090s — 17 experiments, 3 kept improvements, 1.48% val_bpb improvement. Both GPUs running experiments in parallel, batch_size=4, depth=8, 50.3M params. A longer overnight run (8-24h) across more GPUs would find significantly more improvements, same as karpathy's 2-day run that found 20+ improvements across 276 experiments.
Same idea as autoresearch — agent modifies train.py, trains for 5 minutes, keeps or discards, repeats — but with structured experiment state, multi-GPU parallelism, adaptive search, and crash recovery via iii (Worker/Function/Trigger). The agent is still external. Claude, Codex, whatever you want. This repo is the infrastructure that replaces the bash loop, git-as-state, and flat TSV with queryable experiment tracking across N GPUs. More GPUs = more parallel experiments = faster research.
The repo has three files that matter, same as autoresearch:
prepare.py — data prep, tokenizer, eval. Not modified.train.py — model, optimizer, training loop. The agent edits this.program.md — agent instructions. The human edits this.Two workers talk to iii to provide the infrastructure:
uv run train.py, parses metrics, handles timeouts.The agent calls the same uv run train.py but wraps it with REST API calls:
POST /api/experiment/setup — init run tag
POST /api/experiment/register — record hypothesis before training
POST /api/experiment/complete — record metrics, auto keep/discard
POST /api/search/suggest — get guidance on what to try next
POST /api/report/summary — full stats for a run tagTraining runs for a fixed 5-minute time budget (wall clock). The metric is val_bpb (validation bits per byte) — lower is better, vocab-size-independent so architectural changes are fairly compared.
Requirements: NVIDIA GPU(s), Python 3.10+, uv, Rust 1.82+.
…Point Claude Code, Codex, or any agent at this repo and prompt:
Read program.md and kick off a new experiment.The agent loop:
1. POST /api/experiment/setup — init run tag
2. POST /api/search/suggest — get search guidance
3. edit train.py — the experiment
4. git commit
5. POST /api/experiment/register — record hypothesis
6. uv run train.py > run.log 2>&1 — train (5 min)
7. POST /api/experiment/complete — record results
{ improved: true, action: "keep_commit" }
{ improved: false, action: "git_reset" }
8. repeat from 2If training crashes, POST /api/experiment/crash tracks consecutive failures and aborts after 3.
N GPU workers = N parallel experiments. Each agent acquires a GPU, trains, records, releases. Search strategy adapts globally across all GPUs.
curl localhost:3111/api/pool/list
# { "total": 2, "idle": 0, "training": 2 }GPU workers on different machines can point to the same orchestrator:
# CPU machine (orchestrator)
iii --config iii-config.yaml
uv run python workers/orchestrator/orchestrator.py
# Each GPU machine
III_WS_URL=ws://:49134 GPU_INDEX=0 cargo run --releasePorts 49134 (WebSocket) and 3111 (REST) must be reachable from GPU machines.
Strategy auto-adapts after each experiment based on recent history:
explore (default) broad random changes, try underexplored categories
exploit refine around best config, small incremental tweaks
combine merge two near-miss experiments that improved different aspects
ablation systematically remove components to find what mattersTransitions:
crash rate > 50% -> exploit (conservative)
plateau + near-misses available -> combine
plateau + no near-misses -> ablation
keep rate > 30% -> exploit
default -> explore……train.py. Diffs are reviewable, scope is manageable.report::tsv exports in the original autoresearch format for backwards compatibility.Tested on dual RTX 4090 (24GB each). For smaller GPUs:
DEPTH from 8 to 4DEVICE_BATCH_SIZE to 4 (RTX 4090) or 2 (smaller)torch.compile if compilation OOMsWINDOW_PATTERN = "L" instead of "SSSL" if attention is slowFor H100 (80GB), the defaults work as-is.
Apache-2.0
暂无开放 Issues,或尚未同步最近议题。