Skip to content

Meta-Harness: End-to-End Optimization of Model Harnesses

Agents stage 2 #2corefrontierpaperrubric 12/122026 · arXiv · ~40 min

Yoonho Lee, Roshen Nair, Qizheng Zhang, …, Chelsea Finn

Read first: DSPy: compiling declarative LM calls into self-improving pipelines · GEPA: reflective prompt evolution can outperform RL · Recursive Language Models (RLMs)

Status

TL;DR. A harness is the code around a language model that decides what to store, retrieve and show it at each step. Meta-Harness searches over harness code with the model frozen. The searcher is itself a coding agent (Claude Code with Opus-4.6) that can browse a filesystem holding the source code, scores and full execution traces of every harness tried so far. Raw access beats compressed feedback: on text classification the search finds a harness that is 7.7 points better than ACE while using about 4× less context, a single retrieval harness adds 4.7 points on IMO-level math across five models, and the TerminalBench-2 harness beats the hand-built Terminus-KIRA.

Why it matters now. In 2026 many agent gains come from harness changes rather than new weights, and the authors cite a 6× gap from harness choice alone on one benchmark. Most of this engineering is manual. Earlier optimisers (DSPy, GEPA, AlphaEvolve) see only scores, short windows or summaries. Meta-Harness shows that once coding agents are strong enough, the optimiser can be given the whole messy history and left to decide what to read, which looks a lot like an agentic retrieval problem over its own logs.

Objective (§3). Let MM be a frozen model, X\mathcal{X} a task distribution and r(τ,x)r(\tau, x) a reward on a rollout τ\tau produced when harness HH runs MM on task xx:

H∗=arg⁡max⁡H  Ex∼X,  τ∼pM(H,x)  r(τ,x).H^{*} = \arg\max_{H}\; \mathbb{E}_{x \sim \mathcal{X},\; \tau \sim p_M(H, x)}\; r(\tau, x).

When cost matters too (for example context tokens), candidates are compared by Pareto dominance and the frontier is reported.

The outer loop (Algorithm 1).

  1. Read. The proposer queries a growing filesystem D\mathcal{D}. Each past harness has a directory with its code, its scores and its traces (prompts, tool calls, outputs, state updates). The proposer uses grep and cat, not one big prompt.
  2. Propose. It writes kk new single-file Python harnesses, from small fixes to full rewrites.
  3. Check and evaluate. A quick interface test rejects broken candidates; a separate evaluator runs the rest on the search set.
  4. Log. Results go into new directories, and the loop repeats. A typical run evaluates about 60 harnesses over 20 iterations. In the held-out experiments (text classification and math), only Pareto-frontier harnesses are run on the test set, which the proposer never sees. Exception: on TerminalBench-2, search and final evaluation use the same 89 tasks, so that result is not evidence of unseen-task generalization.

The loop is deliberately minimal: no parent selection rule, mutation operators or summariser. All diagnosis is left to the proposer, guided by a short “skill” file that says where to write and what not to touch.

Meta-Harness outer loop A filesystem in the centre holds one directory per evaluated harness, each with source code, scores and execution traces. On the left, the proposer, a coding agent, reads selectively from the filesystem with grep and cat, about 82 files per iteration, and writes new harness files. Candidates go through a quick interface check and then to a separate evaluator, on the right, which runs the frozen model on the search set and writes code, scores and traces back as a new directory. After the last iteration, only the Pareto frontier of harnesses over accuracy and context cost is evaluated on the held-out test set, which the proposer never sees. Exception: on TerminalBench-2 the search tasks and the evaluation tasks are the same 89 tasks. Proposer coding agent (Claude Code, Opus-4.6) diagnoses failures, writes k new harness files (edit or rewrite) Filesystem of history h01/ code, score, trace h02/ code, score, trace ... about 60 per run Evaluator interface check first run frozen model M on the search set log scores and full traces to a new dir read new harness files (single Python file each) log After N iterations: test only the Pareto frontier (accuracy vs context); held-out test set stays hidden exception: TerminalBench-2 searches and evaluates on the same 89 tasks
Original sketch. The proposer reads raw code, scores and traces from every earlier candidate, writes new harnesses, and a separate evaluator logs their results back into the same filesystem. The hidden test set applies to the held-out experiments; on TerminalBench-2 the search tasks are the evaluation tasks.
  • Online text classification (GPT-OSS-120B, Table 2). The selected harness averages 48.6% over three datasets with 11.4K context tokens, versus ACE 40.9% (50.8K), MCE 40.0% (28.5K), all-example few-shot 40.8% and zero-shot 27.4%. On nine unseen datasets it averages 73.1% versus ACE’s 70.2% (Table 5).
  • Versus other optimisers (Table 4, same proposer and budget). Median / best search-set accuracy: GEPA 32.6 / 40.2, Best-of-N 34.0 / 44.2, OpenEvolve 39.1 / 43.3, TTT-Discover 34.1 / 45.6, Meta-Harness 50.0 / 56.7. It reaches the others’ final accuracy with about 10× fewer evaluations.
  • Retrieval for olympiad math (Table 6). The search runs on 250 problems against a corpus of over 500,000 solved problems, and the result is tested on 200 IMO-level problems with five models. Averages: no retrieval 34.1, BM25 37.5, dense (k = 5) 38.1, Meta-Harness 38.8. The discovered program routes problems to four BM25 policies (App. B.2).
  • TerminalBench-2 (Table 7). Opus 4.6: 76.4% versus Terminus-KIRA 74.7% (second on the leaderboard after ForgeCode at 81.8%, which the authors could not reproduce). Haiku 4.5: 37.6% versus Goose 35.5%, the best reported. The winning change is about 80 lines that take an environment snapshot before the first model call, and it helps on 7 of 89 tasks (App. B.3).
  • Search equals test on TerminalBench-2. The authors audit for leaked task strings and treat it as a discovery problem, but a held-out split would be stronger. The gain over Terminus-KIRA is small relative to 89 tasks.
  • One proposer. Only Claude Code with Opus-4.6 was tested, so it is unclear how much is the method and how much the proposer.
  • Cost and baselines. A run takes a few hours but each evaluation can be expensive, and leaderboard baselines were not run under matched budgets.
  • The skill matters a lot. The authors report that editing the skill text changed search quality more than iteration count or population size (App. D), which is itself hand engineering.
  • Open: co-evolving harness and weights, as the authors suggest, and whether the proposer can be fooled by its own noisy evaluations.

Questions to think through

These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.

  1. Derive / compute

    Table 1 estimates feedback per iteration at 0.008 MTok for GEPA, 0.026 MTok for TTT-Discover and 10 MTok for Meta-Harness. A typical run evaluates about 60 harnesses over 20 iterations. Compute the ratio of Meta-Harness feedback to each baseline, an upper bound on the total history the proposer could face by the end of a run, and explain why this forces the proposer to retrieve from a filesystem instead of reading a prompt.

    What a strong answer covers
    • 10 / 0.008 = 1,250 times GEPA and 10 / 0.026 is about 385 times TTT-Discover, i.e. two to three orders of magnitude.
    • If each of 60 evaluations produced up to 10 MTok, the history could reach about 600 MTok, far beyond any context window.
    • So the proposer must choose what to read: it uses grep and cat over per-harness directories and reads a median of 82 files per iteration (41% code, 40% traces).
    • This turns the optimiser's input into a retrieval problem over its own experience, like recursive language models or agentic search over a corpus.
    • The design moves the compression step from a fixed summariser into the agent's own query choices, so it can look up the exact trace that explains a failure.
  2. Mechanism

    Describe one iteration of the Meta-Harness outer loop (Algorithm 1) and the information flow between the proposer, the evaluator and the filesystem. Which parts are deliberately left unstructured compared with OpenEvolve or GEPA, and why do the authors argue this helps?

    What a strong answer covers
    • The proposer (Claude Code with Opus-4.6, guided by a short skill file) inspects prior harness code, scores and traces, then writes k new single-file Python harnesses.
    • Each candidate first passes a cheap interface test, then a separate evaluator runs it with the frozen model on the search set and writes code, scores and traces into a new directory.
    • There is no parent-selection rule, mutation operator, archive policy or summariser: the proposer decides what to read and whether to make a small edit or a rewrite.
    • The loop keeps a population and an accuracy-versus-context Pareto frontier; only frontier harnesses get a final test evaluation, and in the held-out experiments the proposer never sees test results (TerminalBench-2 is the exception: search and evaluation share its 89 tasks).
    • The bet is that a stronger coding agent will exploit raw evidence better than hand-designed search heuristics, so the method improves as agents improve.
  3. What if…

    Table 3 compares three proposer interfaces on text classification: scores only, scores plus LLM-written summaries, and full access with raw traces. Report the numbers and explain what they say about compressing feedback, including why summaries did not help.

    What a strong answer covers
    • Scores only: median 34.6, best 41.3. Scores plus summary: median 34.9, best 38.7. Full traces: median 50.0, best 56.7.
    • Even the median full-trace candidate beats the best candidate of both ablations.
    • Summaries drop the specific failing inputs, prompts and outputs needed to trace a failure back to a harness decision, so they add little or even hurt.
    • This parallels GEPA's finding that reflective text beats scalar reward, but goes further: the raw trace beats a reflection written in advance.
    • Caveat: this ablation is on the smallest setting and one proposer; the gap could differ for weaker proposers or noisier traces.
  4. Critique

    On TerminalBench-2, search and final evaluation use the same 89 tasks, the reported baselines come from a public leaderboard, and only one proposer model is tested. Critique the TerminalBench-2 claim (76.4% vs Terminus-KIRA 74.7% on Opus 4.6) and say what extra evidence would make it convincing.

    What a strong answer covers
    • Selecting on the test tasks inflates scores; the authors audit for task-specific strings and argue this is standard practice, but adaptive overfitting can be subtle.
    • The gain is 1.7 points on 89 tasks, about 1.5 tasks, and the winning change helps on 7 tasks; that is within run-to-run noise unless repeated with seeds.
    • Leaderboard baselines were not run under the same budget or infrastructure, and the search log shows a 64.4% Terminus-KIRA score in that run, not 74.7%.
    • Better evidence: a held-out task split or a newer benchmark version, several seeds with confidence intervals, and equal-compute hand-tuning or other optimisers.
    • The paper itself notes that only Claude Code was tested as proposer; results with other proposers are needed to know if the method or the proposer drives the gain.
  5. Design

    You want to use Meta-Harness to improve a deep-research agent on BrowseComp-Plus with a frozen open-weight model. Design the search set, what the logs should contain, the objectives, and the guards against leakage and reward hacking.

    What a strong answer covers
    • Search set: 50 to 100 queries the baseline fails, kept separate from the test queries, following the paper's advice to make the search set hard and cheap.
    • Logs per harness: code, per-query accuracy and calibration, full tool-call traces with retrieved document ids, and cost (search calls, tokens), all in JSON with consistent names.
    • Objectives: a Pareto frontier over accuracy and search calls or tokens, like the paper's accuracy-versus-context frontier.
    • Guards: the proposer cannot read test answers or the qrels; regex audits for hard-coded query strings or answers; final evaluation only on the held-out split.
    • Allow edits to query rewriting, reranking, context packing and stopping rules, but not to the evaluator, which a separate process runs.
  6. Connect

    Place Meta-Harness on a line from DSPy and MIPROv2 through GEPA and AlphaEvolve. What changes along this line in the artifact being optimised and in the feedback the optimiser sees? Use the discovered math-retrieval harness, a four-route BM25 program, as an IR example of what this kind of search produces.

    What a strong answer covers
    • DSPy and MIPROv2 tune prompts and demonstrations inside a fixed program structure using scores.
    • GEPA reflects on rollout traces in text to evolve prompts; AlphaEvolve evolves code with an LLM mutator and a program database with scores.
    • Meta-Harness optimises the whole harness program and gives the proposer the full raw history, not a window or a summary.
    • The math harness routes each problem to combinatorics, geometry, number theory or a default route with lexical rules, then uses route-specific BM25 depth, deduplication and reranking.
    • It beats dense retrieval on average (38.8 vs 38.1) with no extra encoder, showing that search can rediscover classic IR ideas: query routing, deduplication and per-domain retrieval depth.

Done with this page?

Status