karpathy-autoresearch について
karpathy-autoresearchは、エージェントと反復実験を行うためのスキルです。人間が研究課題を設定し仮説の変更を承認する一方、エージェントは指標に沿って実装・実行し、実験を記録します。
主な機能
- 01研究課題と評価指標の設定
- 02一度に一つ変更する実験
- 03実験ログへの結果記録
- 04ブランチによる実験の分離
- 05機械学習以外への反復手法の応用
活用シーン
- 01機械学習のハイパーパラメーター探索
- 02タスク成功率によるシステムプロンプト比較
- 03コード実装ごとの実行時間測定
- 04コンテンツや製品設計の反復改善
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ learnprompt/ andrej-karpathy-skills --skill karpathy-autoresearchインストール後、Claude Code で/karpathy-autoresearchを入力して読み込まれたか確認します。
詳細
スキル 6:AutoResearch(自主研究ループ)
出典:https://x.com/karpathy/status/2030371219518931079 「Autoresearch project — エージェントがトレーニングコードを自律的に反復改善」— 28k 件の「いいね」
基本原則
プロンプトを変更するのはあなたです。それ以外のすべてを変更するのはエージェントです。
ループ:エージェントが現在の状態を読み取る → 実験を実行する → 結果を分析する → 次の反復を提案する → あなたがプロンプトの変更を承認する → 繰り返す。
仮説を立てるのはあなたです。実装と実行はエージェントが担います。
AutoResearch のアーキテクチャ
Human Layer (you):
- Define research question
- Approve hypothesis changes
- Set evaluation metric
- Stop when satisfied
Agent Layer:
- Implement current hypothesis
- Run experiment (on git branch)
- Analyze logs/results
- Propose next hypothesis
- Never change the research question
セットアップ用プロンプト(一度だけ)
You are AutoResearcher for this project.
Research question: [WHAT YOU'RE TRYING TO LEARN/OPTIMIZE]
Evaluation metric: [HOW WE MEASURE SUCCESS — must be a single number]
Current best result: [BASELINE or "none yet"]
Constraints:
- Work on git branches: each experiment gets branch "exp/[short-description]"
- Never modify main branch
- Log all results to experiments.jsonl in format: {"id": N, "hypothesis": "...", "metric": value, "notes": "..."}
- Each iteration: implement → run → log → propose next
Starting hypothesis: [YOUR FIRST HYPOTHESIS TO TEST]
Begin iteration 1. Implement the hypothesis, run it, report the metric, then propose iteration 2.
反復ごとのループ用プロンプト
AutoResearcher: Iteration [N]
Current state:
- Branch: exp/[current]
- Metric so far: [RESULTS LOG]
- Best result: [BEST SO FAR]
Completed last iteration: [WHAT HAPPENED]
Metric result: [VALUE]
Your tasks this iteration:
1. Analyze: what does the result tell us about the hypothesis?
2. Propose: what's the next hypothesis? (one variable change at a time)
3. Implement: write the code change for this hypothesis
4. Run: execute and report the metric
5. Commit: git commit to branch exp/[new-name] with message: "exp: [hypothesis description]"
Constraint: change ONE variable at a time. If last experiment failed, back off to simpler hypothesis.
実験ログの形式
{"id": 1, "branch": "exp/baseline", "hypothesis": "default hyperparams", "metric": 0.423, "runtime_s": 45, "notes": "starting point"}
{"id": 2, "branch": "exp/lr-0.001", "hypothesis": "lower learning rate 0.01→0.001", "metric": 0.451, "runtime_s": 47, "notes": "small improvement, keep lowering?"}
{"id": 3, "branch": "exp/lr-0.0001", "hypothesis": "lower learning rate 0.001→0.0001", "metric": 0.438, "runtime_s": 46, "notes": "worse than id=2, sweet spot was 0.001"}
研究概要用プロンプト(N 回の反復後に実行)
Summarize this research session.
Experiment log:
[PASTE experiments.jsonl]
Produce:
1. Best configuration found (all hyperparameters/settings)
2. What we learned (2-3 bullet points about the search space)
3. What we should try next (top 3 unexplored directions)
4. A clear hypothesis about WHY the best configuration works
5. Confidence level: how sure are we this is near-optimal?
ML 以外への AutoResearch の適用
このパターンは、あらゆる反復的な最適化に有効です。
| 分野 | 研究上の問い | 指標 |
|---|---|---|
| ML トレーニング | 最適なアーキテクチャ/ハイパーパラメーター | 検証損失 |
| プロンプトエンジニアリング | 最適なシステムプロンプト | タスク成功率 |
| コード最適化 | 最速の実装 | 実行時間(ms) |
| コンテンツ制作 | 最も反応を得られる形式 | クリック率/閲読率 |
| プロダクトデザイン | 最適な UX フロー | タスク完了率 |
安全策
AutoResearcher rules (always include):
- NEVER delete data or commits from previous experiments
- NEVER modify any file outside the current experiment's scope
- NEVER run experiments that cost > [COST_LIMIT] without checking
- ALWAYS commit before starting the next iteration
- ALWAYS report the metric before proposing the next hypothesis
- If metric degrades 3 iterations in a row, STOP and ask for guidance
ワークフロー
属するワークフロー:研究から公開まで(コンテンツクリエイター/研究者)
| 位置 | 上流 | 下流 |
|---|---|---|
| 入口 | ユーザーに研究上の問いがあるときに直接開始 | karpathy-llm-wiki(実験結果を知識ページとして蓄積) |
全体の流れ:autoresearch → llm-wiki → output-evolution → education-first
プロンプトの契約
You are AutoResearcher. Research question: <QUESTION>. Evaluation metric: <SINGLE_NUMBER_METRIC>. Current baseline: <VALUE or "none">. Starting hypothesis: <FIRST_HYPOTHESIS>. Work on git branches (exp/<name>). Each iteration: implement → run → log result to experiments.jsonl → analyze → propose next hypothesis (one variable change). Never modify main. Stop and ask if metric degrades 3 iterations in a row.
検証チェックリスト
- 研究上の問いに、明確で単一の評価指標がある
- 各実験で変更する変数は 1 つだけ
- すべての結果を experiments.jsonl に記録する
- 各反復を独立した git ブランチで行う
- 方針を変更する前に、人間に意見を求める
- 明確な停止条件がある(指標が連続して悪化する/目標に達する)
コメント
Markdown 対応