把"包裹固定 LLM 的 harness 代码"本身当成搜索目标:一个 coding-agent proposer 通过文件系统读取全部历史候选的源码、分数、执行 trace,逐轮提出新 harness。文本分类比 ACE 高 7.7 分且 context token 少 4×;数学检索 5 个 held-out 模型平均 +4.7 分;TerminalBench-2 上超过手工 harness。
Q1 — 痛点(为什么需要)
固定模型权重时,仅改 harness(决定存什么/取什么/怎么呈现给模型的代码)就能在同一 benchmark 上造成 6× 性能差,但 harness 至今基本靠人手工设计:看 failure、调启发式、在少数设计间迭代。已有的 text optimizer 想自动化这件事,却都对反馈做了过度压缩——有的只看当前候选(memoryless),有的只 condition 在 scalar score 上,有的把反馈限制成短模板或 LLM 摘要。而 harness 是长 horizon 的:一个"存什么/何时取"的决策会在很多推理步之后才显现,压缩反馈恰好抹掉了把下游 failure 归因到早期决策所需的信息。原文用 Table 1 量化这道鸿沟:代表性 text optimizer 每步的可用上下文只有 100–30,000 token,而一次 harness 评估可产生高达 10,000,000 token 的诊断信息(约高三个数量级)。
Q2 — 方法(怎么做)
Meta-Harness 是一个 outer-loop 系统,把 harness 优化写成"在代码空间里 argmax 期望 reward、模型权重冻结"的问题(见 §4 Eq 1),用一个 coding-agent 作为 proposer。核心设计:把全部历史通过文件系统 $\mathcal{D}$ 暴露给 proposer——每个被评估过的 harness 贡献一个目录,含源码、评分、执行 trace(prompt、tool call、模型输出、状态更新)。文件系统通常远大于 proposer 的 context window,所以 proposer 用 grep / cat 等终端工具按需检索,而不是把它整体塞进一个 prompt。每轮:proposer 先 inspect 先前代码/分数/trace、推断可能的 failure mode,再生成新 harness;新 harness 通过接口校验后被评估并写回文件系统;维护一个 population $\mathcal{H}$ 与 Pareto frontier,但不设 parent-selection 规则,proposer 可自由查看任意历史候选。实验里 proposer 是 Claude Code + Opus-4.6,base 模型按域而定且始终冻结;典型一次 run 在 20 iteration 内评估约 60 个 harness。
核心技术壁垒:不是"在代码空间搜索"本身,而是让 proposer 通过文件系统对全部历史诊断经验做选择性、非 Markov 的访问——能读到任意先前候选的原始 trace,从而对失败做因果归因(例如分离出"被共享 prompt 改动 confound 的结构性修复"),而压缩反馈的优化器无法支撑这种推理(详见 §7)。
Q3 — 结果(效果如何)
三域均超过强基线:(1) 在线文本分类,发现的 harness 比 SOTA 上下文管理系统 ACE 高 7.7 分(48.6 vs 40.9),且只用 11.4K context token vs ACE 的 50.8K(4× 更省),并以 0.1× 的评估次数 match 最佳 text optimizer 的最终性能、最终精度再超 10+ 分;(2) 检索增强数学推理,单个发现的检索 harness 在 5 个 held-out 模型上平均 +4.7 分(对 no-retrieval),整体均值居首;(3) TerminalBench-2,Opus 4.6 上 76.4% 超过手工 Terminus-KIRA(74.7%)排第 2,Haiku 4.5 上 37.6% 排第 1。消融(Table 3)显示:去掉原始 trace 只给 score 或 score+summary,median 从 50.0 跌到 34.6/34.9——原始 trace 访问是关键成分。
整体是一个三步 search loop(重建自 Figure 2 caption:read filesystem → propose;evaluate;store logs → repeat)外加 proposer 内部的 inspect→diagnose→edit 单轮回合。

Paper's Table 1(caption: "Comparison of text optimization methods and their settings... Mtok/iter is our best estimate of the full context generated from one evaluation... This paper considers settings that yield orders-of-magnitude more context per artifact evaluation.")。 该表把代表性 text optimizer 按 History(Window/Last/Summary)与 Log content 归类,并估计每次评估生成的上下文量(MTok/iter)。它正是 Meta-Harness 的设计动机:现有方法每步只暴露 0.002–0.022 MTok 的压缩反馈,而本方法让 proposer 能访问数量级更大的原始 trace。
要点(对应 deep-agent 的 agent-loop 维度):
发现的三个域内 harness(重建自 Figure 5/6/8/9 flowchart 标签):
\frac、^{2} 等 LaTeX token 当原子单位。_gather_env_snapshot():agent loop 开始前跑一条复合 shell 命令采集 OS/语言/包管理器//app 列表/内存并注入初始 prompt,省掉 2–4 个探查环境的回合。
Paper's Figure 8(caption: "Discovered math retrieval harness. A lexical router assigns each query to one of four subject-specific retrieval policies. The selected policy retrieves examples, which are inserted into the final prompt.")。 这张 flowchart 展示了上面"数学检索(four-route BM25)"要点的程序结构:单一 lexical router 把题分派到 combinatorics / geometry / number-theory / default 四条子策略,各自独立取数后注入最终 prompt——proposer 自动合并了来自两条搜索 lineage 的更强 geometry 与 combinatorics 路由。

Paper's Figure 9(caption: "Discovered TerminalBench-2 harness. The harness inherits Terminus-KIRA's native tool calling, output cap, and completion checklist (green). The environment bootstrap (red) is the component discovered by Meta-Harness...")。 图中绿色为继承自 Terminus-KIRA 的既有组件,红色的 environment bootstrap 是 Meta-Harness 唯一发现的增量:在 agent loop 前采集 sandbox 快照,消除早期探查回合。这正是"纯增量修改胜过结构性重写"结论的可视化。
无形式化作者证明 — 仅实证。 原文给出优化目标的形式化陈述(Eq 1)但没有收敛/成功率的形式保证;所有结论靠跨三域的实证(Tables 2–11)。
记号表(Eq 1 与 Algorithm 1):
| 符号 | 含义 |
|---|---|
| $M$ | 固定(冻结)的 language model |
| $\mathcal{X}$ | 任务分布;$x\sim\mathcal{X}$ 为任务实例 |
| $H$ / $H^{*}$ | harness(包裹模型的有状态程序)/ 最优 harness |
| $\tau\sim p_{M}(H,x)$ | 用 $H$ 在 $M$ 上跑实例 $x$ 诱导的 rollout trajectory |
| $r(\tau,x)$ | 任务特定 reward,对 trajectory 打分 |
| $P$ | proposer(coding agent) |
| $\mathcal{D}$ | 文件系统反馈通道(init $\emptyset$),存 code/scores/traces |
| $\mathcal{H}$ | 已评估 harness 的 population |
| $N$ / $k$ | 迭代数 / 每轮提出的新 harness 数 |
| $E_{H}$ | $H$ 的评估结果 |
优化目标(display math,单行):
$$H^{}=\operatorname{arg\,max}_{H}\;\mathbb{E}_{x\sim\mathcal{X},\;\tau\sim p_{M}(H,x)}\;r(\tau,x)$$
物理意义:在冻结模型的前提下,于程序(代码)空间而非权重空间里 argmax 期望 final reward;多目标时改为在 Pareto frontier 上取非支配解。
六项实证/内部一致性检查(替代形式化证明):
三域 + 消融,全部为表格证据。

Paper's Figure 1(caption: "(Left) On text classification, Meta-Harness outperforms the best prior hand-designed harnesses (ACE) and existing text optimizers (TTT-Discover, OpenEvolve), matching the next-best method's final accuracy after just 4 evaluations. (Right) On TerminalBench-2, Meta-Harness outperforms all reported Claude Haiku 4.5 harnesses.")。 左图按评估次数画出 best-so-far 曲线:Meta-Harness 在前 4 次评估内就追平 OpenEvolve/TTT-Discover 的最终精度并继续上升,最终高 10+ 分;右图给出 Haiku 4.5 上对各 harness 的领先。这是论文样本效率与最终性能两项主张的核心证据图。
在线文本分类(Table 2,test-set;Avg Acc / Ctx 千 token)——发现的 harness 在更省 context 下取得最高均值:
| Harness | USPTO | S2D | Law | Avg Acc | Ctx ↓ |
|---|---|---|---|---|---|
| Few-Shot (all) | 15.0 | 78.3 | 29.0 | 40.8 | 12.3 |
| MCE [51] | 14.0 | 83.0 | 23.0 | 40.0 | 28.5 |
| ACE [58] | 16.0 | 77.8 | 29.0 | 40.9 | 50.8 |
| Meta-Harness | 14.0 | 86.8 | 45.0 | 48.6 | 11.4 |

Paper's Table 2(caption: "Test-set metrics for all harnesses on the three datasets. Ctx denotes additional input tokens in context (thousands)... Meta-Harness improves online text classification accuracy while using a smaller input context.")。 原表与上方重建一致:Meta-Harness 在更小 context 下取得最高均值。对 ACE +7.7、对 MCE +8.6,且 context 仅 ACE 的 ~22%。配套 Figure 3(accuracy–context Pareto frontier)显示 Meta-Harness 的前沿全面占优。
接口消融(Table 3)——原始 trace 访问是关键成分:
| Method | Scores | Code | Summ. | Traces | Median ↑ | Best Acc ↑ | >ZS |
|---|---|---|---|---|---|---|---|
| Scores Only | ✓ | ✓ | × | × | 34.6 | 41.3 | 26 |
| Scores + Summary | ✓ | ✓ | ✓ | × | 34.9 | 38.7 | 23 |
| Meta-Harness (full) | ✓ | ✓ | - | ✓ | 50.0 | 56.7 | 39 |

Paper's Table 3(caption: "Ablation of the information available to the proposer in online text classification... Access to raw execution traces is the key ingredient for enabling harness search.")。 表中三种接口条件单调地说明:仅 score(34.6)≈ score+summary(34.9)≪ 含原始 trace 的 full(50.0),且 summary 不能恢复 trace 的诊断信号——原始 trace 访问是使 harness 搜索成立的关键成分。
检索增强数学(Table 6,pass@1,括号为相对 no-retriever 增量)——单 harness 跨 5 模型迁移:
| Method | GPT-5.4n | GPT-5.4m | Gem-3.1FL | Gem-3F | GPT-20B | Avg. |
|---|---|---|---|---|---|---|
| No Retriever | 23.0 | 28.8 | 28.6 | 42.6 | 47.6 | 34.1 |
| Dense Retrieval (k=5) | 31.1 | 28.3 | 37.1 | 47.2 | 46.7 | 38.1 (+4.0) |
| BM25 Retrieval | 30.2 | 29.2 | 32.8 | 46.6 | 48.9 | 37.5 (+3.4) |
| Meta-Harness | 31.7 | 30.4 | 34.9 | 46.3 | 50.6 | 38.8 (+4.7) |
dense/random few-shot 在部分模型上回退(如 GPT-5.4m dense k=1 为 −4.3),Meta-Harness 全部为正增益。
TerminalBench-2(Table 7,Pass %)——自动搜索在竞争 benchmark 上胜过手工:
| Base / Harness | Pass (%) |
|---|---|
| Opus 4.6 · Terminus-KIRA | 74.7 |
| Opus 4.6 · Meta-Harness | 76.4 (#2) |
| Opus 4.6 · ForgeCode | 81.8 (未能复现) |
| Haiku 4.5 · Goose | 35.5 |
| Haiku 4.5 · Meta-Harness | 37.6 (#1) |
弱模型 Haiku 上增益更大(对次优 +2.1)。原文注:唯一更高的 ForgeCode 从公开代码无法复现。其余表(Table 1 反馈预算对比、Table 4 优化器对比、Table 5 OOD、Tables 8–11 文件访问统计/语料/测试集)见对应章节。
| 步 | 论点 | 依据(paper 内部) |
|---|---|---|
| 1 | harness 对固定模型的性能影响巨大(最高 6× gap),却仍靠手工设计 | §1 Para 1(引 [46]) |
| 2 | 现有 text optimizer 不胜任,因其压缩反馈(memoryless / 只看 scalar / 短模板摘要),而 harness 是长 horizon、需把下游 failure 归因到早期决策 | §1 Para 2 + Table 1(100–30K vs 10M token/iter) |
| 3 | 解法:把 harness 优化形式化为代码空间 argmax(Eq 1),用 coding-agent proposer 通过文件系统暴露全部历史,按需 grep/cat 检索而非整体塞 prompt | §3 Eq 1 + Algorithm 1 + Figure 2 |
| 4 | 原始 trace 访问是这套接口里最关键的成分(消融证明,summary 无法替代) | Table 3(34.6/34.9 → 50.0 median) |
| 5 | 因此样本效率与最终性能均超程序搜索/文本优化基线 | Table 4 + Figures 1,4(0.1× 评估 match,最终 +10pt) |
| 6 | 且不靠堆 context、能跨数据集(OOD)与跨模型迁移 | Table 2(11.4K token)+ Table 5(73.1% OOD)+ Table 6(+4.7 五模型) |
| 7 | proposer 的增益来自对历史失败的因果推理(识别 confound→隔离→转向纯增量修改) | Appendix A.1(82 文件/轮,非 Markov)+ A.2(10 轮 trajectory) |
| 8 | 在竞争性 long-horizon benchmark 上自动搜索也能胜过手工 harness | Table 7(TerminalBench-2 Opus #2 / Haiku #1)+ Appendix B.3(env bootstrap) |
代码层面 outer-loop 与 proposer 实现 [实现未公开](论文只给项目页 https://yoonholee.com/meta-harness/ 与交互 demo,proposer 为闭源 Claude Code + Opus-4.6)。可定位的实现锚点是论文 appendix 中点名的被发现 harness 单文件程序及其控制流:
draft_verification.py(两次调用、draft→confirmers/challengers 验证;§B.1 / Figure 5)。label_primed_query_anchored.py(label primer + coverage + query-anchored contrastive,TF-IDF 检索;§B.1 / Figure 6)。_gather_env_snapshot()(单条复合 shell 命令采集 OS/语言/包管理器//app/内存,15s 超时静默失败,在 Terminus-KIRA 上 ~80 行;§B.3 / Figure 9)。\frac 等 LaTeX 原子 token;§B.2 / Figure 8)。每个发现的 harness 约 100–1000 行。核心技术壁垒(最难复制的洞见):让 proposer 对全部历史诊断经验做选择性、非 Markov 的文件系统访问,是这套方法不可压缩的核心。难点不在"用 LLM 改代码"或"维护 population",而在三件协同的事:(1) 把每次评估的全部原始 trace(prompt/tool call/输出/状态更新,单次可达 10M token)以可被 grep/cat 可靠导航的层级化、机器可读格式落盘;(2) 不替 proposer 做 parent selection、不内置 mutation 算子,把诊断与编辑决策完全交给 coding agent,使系统随 agent 能力增强而自动变强;(3) 证据表明把这条诊断信号压缩成 summary 或 scalar 就会塌掉(Table 3),因此"全保真历史 + 选择性访问"二者缺一不可。Appendix A.2 的 confound-isolation 轨迹是这一壁垒发挥作用的直接证据:proposer 跨多轮对比 trace,分离出被共享 prompt 改动混淆的结构性修复,最终转向纯增量的 env-bootstrap。
关键实现细节(易漏的两点):