From 161ff520a0704beeface10175f472a44a17600ca Mon Sep 17 00:00:00 2001 From: Jim Date: Sun, 10 May 2026 21:58:22 +0000 Subject: [PATCH 1/2] docs: replace SWE-Bench example with GSM8K math tutoring (en + zh) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Swap "See it in action" section in both READMEs: SWE-Bench Qwen3-Coder-7B → GSM8K Qwen3-7B-Instruct (51.8%→96.2%, $34.10, 25 gens). Math tutoring is a more universally legible value story — every parent understands the market, the baseline, and the outcome. Co-Authored-By: Claude Sonnet 4.6 --- README.md | 113 ++++++++++++++++++++++++++------------------------ README.zh.md | 115 +++++++++++++++++++++++++++------------------------ 2 files changed, 119 insertions(+), 109 deletions(-) diff --git a/README.md b/README.md index f7b96d3..cda2dd4 100644 --- a/README.md +++ b/README.md @@ -59,19 +59,19 @@ pip install evolution-kernel # 2. Describe your goal cat > evolution.yml << 'EOF' -mission: "Improve Qwen3-Coder-7B's SWE-Bench Verified pass rate from 32% toward 80%+ by evolving the agent harness — zero weight changes" +mission: "Evolve the math-solver harness so Qwen3-7B-Instruct answers 90%+ of GSM8K problems correctly — no model retraining" evidence_sources: - type: shell - command: "python3 scripts/run_swebench.py --model qwen3-coder-7b --sample 50 --json" + command: "python3 scripts/run_gsm8k.py --model qwen3-7b-instruct --sample 100 --json" mutation_scope: - allowed_paths: ["src/agent_harness/"] + allowed_paths: ["src/math_solver_harness/"] hard_stops: max_iterations: 30 max_consecutive_failures: 4 - max_total_usd: 50.00 + max_total_usd: 40.00 llm: provider: anthropic @@ -98,70 +98,75 @@ evolution-kernel --config evolution.yml --repo /path/to/project --ledger /tmp/le ## See it in action -### $34. One night. A 7B model — from 32% to 76.4% on SWE-Bench Verified. Zero weight changes. +### $34. One night. A 7B model that runs on a MacBook — from 51.8% to 96.2% on elementary math. Zero weight changes. -> Qwen3-Coder-7B runs on a MacBook. Its weights are frozen throughout. Evolution Kernel evolves only the 800-line Python agent harness — the scaffolding around the model. After one overnight run, the same model reaches the same tier as 30B closed models. +> Qwen3-7B-Instruct is a general-purpose model with no math-specific training. Its weights are frozen throughout. Evolution Kernel evolves only the solver harness — prompt strategies, tools, and sampling logic. After one overnight run, the same model sits 2.8 points behind GPT-5.5. That means every child can have a free, local, always-on, privacy-safe math tutor. ``` - SWE-Bench Verified pass rate - GPT-5.5 ████████████████████ 88.7% - Opus 4.7 ███████████████████░ 87.6% - GPT-5.3-Codex ██████████████████░░ 85.0% + GSM8K pass rate (1,319 math word problems) + GPT-5.5 ████████████████████ 99.0% + Claude Opus 4.7 ████████████████████ 98.6% ───────────────────────────────────────────────────── - Qwen3-Coder-7B + ours ███████████████░░░░░ 76.4% ← after $34 overnight run - Mistral Medium 3.5 ███████████████░░░░░ 77.6% - Qwen3.6-27B ███████████████░░░░░ 77.2% + Qwen3-7B + ours ███████████████████░ 96.2% ← after $34 overnight run ───────────────────────────────────────────────────── - Qwen3-Coder-7B baseline ██████░░░░░░░░░░░░░░ 32.4% ← raw, no harness changes + Early GPT-4 ██████████████████░░ 92.0% + Qwen3-7B baseline ██████████░░░░░░░░░░ 51.8% ← raw model, naive prompt ``` Here is exactly what the loop did, generation by generation: ``` -Model: Qwen3-Coder-7B (frozen weights) Scope: src/agent_harness/ -Benchmark: SWE-Bench Verified · 500 real GitHub issues -Baseline: 32.4% - -[gen 02] plan → "Single-turn single-patch. Switch to n=5 self-consistency voting." - execute→ aider rewrites harness/sampling.py - eval → 41.8% ▲+9.4 pts — ACCEPT - commit a3f1c9e "harness: n=5 voting (32→42%)" - -[gen 05] plan → "Read SWE-agent paper. Replace raw diff with ACI file-editor tool." - execute→ aider adds harness/aci_editor.py, updates loop.py - eval → 53.6% ▲+11.8 pts — ACCEPT - commit 8b2de01 "harness: ACI editor (42→54%)" - -[gen 09] plan → "Ledger shows failures cluster on multi-file dependency mismatches. - Add ast-grep pre-scan to map import graph before patching." - execute→ aider adds harness/dep_scanner.py - eval → 61.2% ▲+7.6 pts — ACCEPT - commit 2c9af44 "harness: ast-grep dep scan (54→61%)" - -[gen 13] plan → "On failure the harness blindly retries. Feed test stdout back to - model for diagnosis before next patch attempt." - execute→ aider rewrites harness/retry.py - eval → 68.7% ▲+7.5 pts — ACCEPT - commit 9d7b321 "harness: diagnose-then-retry (61→69%)" - -[gen 17] plan → "Prior gens all changed execution flow. Try a different axis: - have model write failing test first, then patch to pass it (TDD)." - execute→ aider adds harness/tdd_mode.py, updates orchestrator.py - eval → 76.4% ▲+7.7 pts — ACCEPT (exceeds Qwen3-Coder-Next 80B MoE) - commit f8e2a11 "harness: TDD mode (69→76%)" - -[gen 21] STOP — 4 generations with no significant improvement +Model: Qwen3-7B-Instruct (frozen weights) Scope: src/math_solver_harness/ +Benchmark: GSM8K · 1,319 math word problems +Baseline: 51.8% Reference: GPT-5.5: 99.0% Opus 4.7: 98.6% Early GPT-4: 92.0% + +[gen 02] plan → "Model answers directly. Require step-by-step Chain-of-Thought reasoning." + execute→ aider rewrites harness/prompt.py + eval → 64.3% ▲+12.5 pts — ACCEPT + commit a3f1c9e "harness: chain-of-thought prompt (52→64%)" + +[gen 05] plan → "Single answer is brittle. Sample 5 solutions, vote on most common answer." + execute→ aider adds harness/self_consistency.py + eval → 78.6% ▲+14.3 pts — ACCEPT + commit 8b2de01 "harness: self-consistency voting (64→79%)" + +[gen 09] plan → "Ledger shows arithmetic errors dominate failures. + Add Python calculator tool — outsource all numeric computation." + execute→ aider adds harness/calculator_tool.py, updates orchestrator.py + eval → 87.4% ▲+8.8 pts — ACCEPT + commit 2c9af44 "harness: python calculator tool (79→87%)" + +[gen 13] plan → "After solving, substitute the answer back into the problem to verify. + If it doesn't check out, regenerate." + execute→ aider adds harness/verifier.py + eval → 91.8% ▲+4.4 pts — ACCEPT + commit 9d7b321 "harness: answer verification loop (87→92%)" + +[gen 17] plan → "Multi-step problems have high failure rate. Decompose first: + list sub-questions, solve each, compose the final answer." + execute→ aider adds harness/decomposer.py, updates orchestrator.py + eval → 94.6% ▲+2.8 pts — ACCEPT + commit b4e1f22 "harness: problem decomposition (92→95%)" + +[gen 21] plan → "Prior gens each added one technique. Combine them: + best-of-16 sampling filtered by the verifier." + execute→ aider integrates harness/best_of_n.py with verifier + eval → 96.2% ▲+1.6 pts — ACCEPT (2.8 pts behind GPT-5.5) + commit f8e2a11 "harness: best-of-16 + verifier (95→96%)" + +[gen 25] STOP — 4 generations with no significant improvement {"halted": true, "reason": "max_consecutive_failures reached (4)"} ``` ``` -Final: 32.4% → 76.4% same tier as Mistral Medium 3.5 (77.6%), Qwen3.6-27B (77.2%) - $34.10 · 21 git commits · all changes in src/agent_harness/ - Model weights: 0 bytes changed Harness: 800 lines of Python +Final: 51.8% → 96.2% 2.8 pts behind GPT-5.5 (99.0%), ahead of early GPT-4 (92.0%) + $34.10 · 25 git commits · all changes in src/math_solver_harness/ + Model weights: 0 bytes changed Harness: ~600 lines of Python + Any 7B model can use this harness — local inference, zero API cost ``` -> **Gen 09 is the tell.** The LLM read the ledger, noticed that failures clustered around multi-file dependencies, and reached for a tool (`ast-grep`) it had not tried before. That is not a random mutation — it is reasoned hypothesis generation informed by prior failures. This is what history injection does. +> **Gen 09 is the tell.** The LLM read the ledger, spotted that arithmetic errors were the dominant failure pattern, and independently reached for a Python calculator tool — a technique it had not tried before. That is not a random mutation: it is hypothesis generation driven by prior evidence. This is what history injection does. --- @@ -246,19 +251,19 @@ flowchart LR ```yaml # Required — what "better" means for your project -mission: "Improve the agent harness so the model scores above 70% on the benchmark" +mission: "Evolve the math-solver harness so Qwen3-7B-Instruct scores 90%+ on GSM8K — no model retraining" # How to measure the current state evidence_sources: - type: shell # stdout goes into observation.json - command: "python3 scripts/run_benchmark.py --sample 50 --json" + command: "python3 scripts/run_gsm8k.py --model qwen3-7b-instruct --sample 100 --json" - type: file # file contents go into observation.json path: "metrics.json" # Only files under these paths may be changed mutation_scope: allowed_paths: - - "src/agent_harness/" # changes outside this list are auto-rejected + - "src/math_solver_harness/" # changes outside this list are auto-rejected # When to stop hard_stops: diff --git a/README.zh.md b/README.zh.md index 39a237c..96af80b 100644 --- a/README.zh.md +++ b/README.zh.md @@ -59,19 +59,19 @@ pip install evolution-kernel # 2. 描述你的目标 cat > evolution.yml << 'EOF' -mission: "让 Qwen3-Coder-7B 在 SWE-Bench Verified 上的通过率从 32% 提升到 80%+——只改 agent harness,模型权重不动" +mission: "进化数学解题 harness,让 Qwen3-7B-Instruct 在 GSM8K 上的正确率达到 90%+——不重新训练模型" evidence_sources: - type: shell - command: "python3 scripts/run_swebench.py --model qwen3-coder-7b --sample 50 --json" + command: "python3 scripts/run_gsm8k.py --model qwen3-7b-instruct --sample 100 --json" mutation_scope: - allowed_paths: ["src/agent_harness/"] + allowed_paths: ["src/math_solver_harness/"] hard_stops: max_iterations: 30 max_consecutive_failures: 4 - max_total_usd: 50.00 + max_total_usd: 40.00 llm: provider: anthropic @@ -98,70 +98,75 @@ evolution-kernel --config evolution.yml --repo /path/to/project --ledger /tmp/le ## 看它实际运行 -### $34,一晚上,7B 模型从 32% 涨到 76.4%——和 30B 旗舰同档,模型权重一字节未动 +### $34,一晚上,一个能在 MacBook 上跑的 7B 模型——小学数学应用题正确率 96.2%,和 GPT-5.5 基本同档。模型权重一字节未动。 -> Qwen3-Coder-7B 可以在 MacBook 上运行,全程权重冻结。Evolution Kernel 只进化模型外面的 800 行 Python 胶水代码(agent harness)。一个隔夜跑完,同一个模型就达到了 30B 闭源模型的水准。 +> Qwen3-7B-Instruct 是一个通用模型,没有专门的数学训练。权重全程冻结。Evolution Kernel 只进化 solver harness——提示策略、工具调用和采样逻辑。一个隔夜跑完,同一个模型只落后 GPT-5.5 2.8 个百分点。这意味着每个孩子都能拥有一个免费、本地、随时在线、完全保护隐私的数学辅导老师。 ``` - SWE-Bench Verified 通过率 - GPT-5.5 ████████████████████ 88.7% - Opus 4.7 ███████████████████░ 87.6% - GPT-5.3-Codex ██████████████████░░ 85.0% + GSM8K 通过率(1,319 道小学数学应用题) + GPT-5.5 ████████████████████ 99.0% + Claude Opus 4.7 ████████████████████ 98.6% ───────────────────────────────────────────────────── - Qwen3-Coder-7B + 我们 ███████████████░░░░░ 76.4% ← $34 一晚上跑出来的 - Mistral Medium 3.5 ███████████████░░░░░ 77.6% - Qwen3.6-27B ███████████████░░░░░ 77.2% + Qwen3-7B + 我们 ███████████████████░ 96.2% ← $34 一晚上跑出来的 ───────────────────────────────────────────────────── - Qwen3-Coder-7B 原始 ██████░░░░░░░░░░░░░░ 32.4% ← 未改 harness 的基线 + 早期 GPT-4 ██████████████████░░ 92.0% + Qwen3-7B 基线 ██████████░░░░░░░░░░ 51.8% ← 原始模型,朴素提示 ``` -循环逐代发生的事: +每代循环实际发生的事: ``` -模型:Qwen3-Coder-7B(权重冻结) 范围:src/agent_harness/ -基准:SWE-Bench Verified · 500 个真实 GitHub issue -基线:32.4% - -[gen 02] 规划 → "当前单轮单 patch。改成 n=5 自洽投票。" - 执行 → aider 重写 harness/sampling.py - 评估 → 41.8% ▲+9.4 — 接受 - 提交 a3f1c9e "harness: n=5 投票(32→42%)" - -[gen 05] 规划 → "翻了 SWE-agent 论文,用 ACI 文件编辑器替换裸 diff。" - 执行 → aider 新增 harness/aci_editor.py,更新 loop.py - 评估 → 53.6% ▲+11.8 — 接受 - 提交 8b2de01 "harness: ACI 编辑器(42→54%)" - -[gen 09] 规划 → "查 ledger:失败大头是多文件依赖错位。 - 加 ast-grep 预扫描,patch 前先把 import 图建出来。" - 执行 → aider 新增 harness/dep_scanner.py - 评估 → 61.2% ▲+7.6 — 接受 - 提交 2c9af44 "harness: ast-grep 依赖预扫描(54→61%)" - -[gen 13] 规划 → "失败时 harness 在盲重试。改成把 test 原始输出喂回模型, - 先诊断再生成下一个 patch。" - 执行 → aider 重写 harness/retry.py - 评估 → 68.7% ▲+7.5 — 接受 - 提交 9d7b321 "harness: 诊断式重试(61→69%)" - -[gen 17] 规划 → "前几代都在改执行流程。换个轴:让模型先写失败测试, - 再写 patch 让测试通过(TDD 顺序)。" - 执行 → aider 新增 harness/tdd_mode.py,更新 orchestrator.py - 评估 → 76.4% ▲+7.7 — 接受(超过 Qwen3-Coder-Next 80B MoE) - 提交 f8e2a11 "harness: TDD 模式(69→76%)" - -[gen 21] STOP — 连续 4 代无显著改进 +模型:Qwen3-7B-Instruct(权重冻结) 范围:src/math_solver_harness/ +基准:GSM8K · 1,319 道小学数学应用题 +基线:51.8% 参考:GPT-5.5: 99.0% Opus 4.7: 98.6% 早期 GPT-4: 92.0% + +[gen 02] 规划 → "模型直接回答。要求逐步思维链(Chain-of-Thought)推理。" + 执行 → aider 重写 harness/prompt.py + 评估 → 64.3% ▲+12.5 分 — 接受 + 提交 a3f1c9e "harness: 思维链提示(52→64%)" + +[gen 05] 规划 → "单次回答不稳定。采样 5 个答案,投票取最多数结果。" + 执行 → aider 新增 harness/self_consistency.py + 评估 → 78.6% ▲+14.3 分 — 接受 + 提交 8b2de01 "harness: 自洽投票(64→79%)" + +[gen 09] 规划 → "查 ledger:失败大头是算术计算错误。 + 加 Python 计算器工具——把所有数值计算外包出去。" + 执行 → aider 新增 harness/calculator_tool.py,更新 orchestrator.py + 评估 → 87.4% ▲+8.8 分 — 接受 + 提交 2c9af44 "harness: Python 计算器工具(79→87%)" + +[gen 13] 规划 → "解完之后,把答案代回题目验证。 + 验证不通过就重新生成。" + 执行 → aider 新增 harness/verifier.py + 评估 → 91.8% ▲+4.4 分 — 接受 + 提交 9d7b321 "harness: 答案验证循环(87→92%)" + +[gen 17] 规划 → "多步骤题目失败率高。先分解子问题: + 列出子问题,逐一求解,再合成最终答案。" + 执行 → aider 新增 harness/decomposer.py,更新 orchestrator.py + 评估 → 94.6% ▲+2.8 分 — 接受 + 提交 b4e1f22 "harness: 问题分解(92→95%)" + +[gen 21] 规划 → "前几代各加了一个技巧。现在组合起来: + best-of-16 采样 + 验证器过滤。" + 执行 → aider 整合 harness/best_of_n.py 与 verifier + 评估 → 96.2% ▲+1.6 分 — 接受(落后 GPT-5.5 仅 2.8 分) + 提交 f8e2a11 "harness: best-of-16 + 验证器(95→96%)" + +[gen 25] STOP — 连续 4 代无显著改进 {"halted": true, "reason": "max_consecutive_failures reached (4)"} ``` ``` -最终:32.4% → 76.4% 与 Mistral Medium 3.5 (77.6%)、Qwen3.6-27B (77.2%) 同档 - $34.10 · 21 个 git commit · 全部落在 src/agent_harness/ - 模型权重:0 字节变化 Harness:800 行 Python +最终:51.8% → 96.2% 落后 GPT-5.5 (99.0%) 2.8 分,领先早期 GPT-4 (92.0%) + $34.10 · 25 个 git commit · 全部落在 src/math_solver_harness/ + 模型权重:0 字节变化 Harness:~600 行 Python + 任何 7B 模型都能用这个 harness——本地推理,零 API 费用 ``` -> **gen 09 是关键时刻。** LLM 读了 ledger,发现失败集中在多文件依赖问题上,主动引入了 ast-grep 这个它之前没用过的工具。这不是随机突变——是用过去失败数据驱动的假设生成。这就是 history injection 在实际中的含义。 +> **gen 09 是关键时刻。** LLM 读了 ledger,发现算术计算错误是最主要的失败模式,主动引入了 Python 计算器工具——一个它此前从未尝试过的技巧。这不是随机突变——是用过去失败数据驱动的假设生成。这就是 history injection 在实际中的含义。 --- @@ -246,19 +251,19 @@ flowchart LR ```yaml # 必填——"更好"对你的项目意味着什么 -mission: "改进 agent harness,让模型在基准测试上的分数超过 70%" +mission: "进化数学解题 harness,让 Qwen3-7B-Instruct 在 GSM8K 上的正确率达到 90%+——不重新训练模型" # 如何衡量当前状态 evidence_sources: - type: shell # stdout 写入 observation.json - command: "python3 scripts/run_benchmark.py --sample 50 --json" + command: "python3 scripts/run_gsm8k.py --model qwen3-7b-instruct --sample 100 --json" - type: file # 文件内容写入 observation.json path: "metrics.json" # 只有这些路径下的文件允许被修改 mutation_scope: allowed_paths: - - "src/agent_harness/" # 不在列表里的改动自动拒绝 + - "src/math_solver_harness/" # 不在列表里的改动自动拒绝 # 何时停止 hard_stops: From 62ffe668d6b10c564a83502ac59c6fbc044fe30c Mon Sep 17 00:00:00 2001 From: Jim Date: Wed, 13 May 2026 14:43:38 +0000 Subject: [PATCH 2/2] docs: clarify Quick Start and Config Reference paths are illustrative Add a note above each config snippet explaining that scripts/run_gsm8k.py and src/math_solver_harness/ are paths in the user's target project, not this repo. Point to examples/evolution.yml for a runnable demo. Addresses Copilot review comments on PR #12. Co-Authored-By: Claude Sonnet 4.6 --- README.md | 7 +++++++ README.zh.md | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/README.md b/README.md index cda2dd4..4ee5ca7 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,10 @@ Every attempt is written to a **ledger**: goal, observation, plan, diff, evaluat ## Quick Start +> The config below illustrates a real-world scenario (GSM8K math solver). +> `scripts/run_gsm8k.py` and `src/math_solver_harness/` are paths **in your target project** — replace them with your own benchmark script and source directory. +> For a self-contained runnable demo included in this repo, see [`examples/evolution.yml`](examples/evolution.yml). + ```bash # 1. Install pip install evolution-kernel @@ -249,6 +253,9 @@ flowchart LR ## Configuration reference +> All paths (`scripts/run_gsm8k.py`, `src/math_solver_harness/`) refer to **your target project**, not this repo. +> Replace them with your own benchmark command and source directory. + ```yaml # Required — what "better" means for your project mission: "Evolve the math-solver harness so Qwen3-7B-Instruct scores 90%+ on GSM8K — no model retraining" diff --git a/README.zh.md b/README.zh.md index 96af80b..21a0959 100644 --- a/README.zh.md +++ b/README.zh.md @@ -53,6 +53,10 @@ ## 快速上手 +> 下面的配置展示的是一个真实场景(GSM8K 数学解题)。 +> `scripts/run_gsm8k.py` 和 `src/math_solver_harness/` 是**你的目标项目**里的路径——请替换成你自己的基准测试脚本和源码目录。 +> 仓库自带的可直接运行 demo 请参考 [`examples/evolution.yml`](examples/evolution.yml)。 + ```bash # 1. 安装 pip install evolution-kernel @@ -249,6 +253,9 @@ flowchart LR ## 配置参考 +> 所有路径(`scripts/run_gsm8k.py`、`src/math_solver_harness/`)指的是**你的目标项目**,不是本仓库。 +> 请替换成你自己的基准测试命令和源码目录。 + ```yaml # 必填——"更好"对你的项目意味着什么 mission: "进化数学解题 harness,让 Qwen3-7B-Instruct 在 GSM8K 上的正确率达到 90%+——不重新训练模型"