mcpField
K
karpathy-autoresearch

karpathy-autoresearch

github.com/learnpromptAgent 工作流118128 次安装16 周前更新
代码仓库

关于 karpathy-autoresearch

karpathy-autoresearch 是用于与 Agent 迭代开展实验的提示词技能。人负责提出研究问题并批准假设,Agent 则按指标实现、运行并记录实验。

主要功能

  1. 01设定研究问题和评估指标
  2. 02逐轮开展单变量实验
  3. 03将结果记录到实验日志
  4. 04用分支隔离不同实验
  5. 05将循环用于机器学习以外的任务

适用场景

  1. 01搜索机器学习超参数
  2. 02按任务成功率比较系统提示词
  3. 03测量不同代码实现的运行时间
  4. 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 项目——Agent 自主迭代训练代码”——28k 个赞

核心原则

你修改提示词。Agent 修改其他所有内容。

循环:Agent 读取当前状态 → 运行实验 → 分析结果 → 提出下一轮迭代方案 → 你批准提示词变更 → 重复。

你负责提出假设。Agent 负责实现和执行。

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?

将 AutoResearch 应用于 ML 以外的领域

这种模式适用于任何迭代优化:

领域研究问题指标
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.

验证清单

  • 研究问题有明确的单一评估指标
  • 每轮实验只改一个变量
  • 所有结果都记录到 experiments.jsonl
  • 每轮在独立 git branch 上工作
  • 人类在方向性变更前被征求意见
  • 有明确的停止条件(指标连续恶化/达到目标)

评论

支持 Markdown