Manuscript Offprint

arXiv:2609.35738

Harness Learning Enables Generalizable Test-Time Adaptation

Alvin Zhang, Xuecheng Liu, Zixuan Wang, Fahim Tajwar, Daman Arora, Ruslan Salakhutdinov, Daniel Khashabi, Yuda Song, Andrea Zanette

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

A language-model agent is jointly defined by its model and its harness, the executable program that organizes model calls, tool use, and information flow. Because different tasks call for different ways of organizing these operations, the harness needs to be adapted using feedback from the task at hand. We introduce harness learning, which trains a proposer model to revise a solver's harness using execution feedback. We formulate this process as meta-learning over executable programs, with harness revisions playing the role of weight updates in gradient-based adaptation. We train the proposer with reinforcement learning, using the task performance of revised harnesses as the reward. At test time, the proposer uses feedback from successive executions on a new task to refine the harness, without performing any parameter-space update. Experiments on reasoning and multi-hop question answering show that harness learning improves revision quality and that the ability to adapt at test time transfers to unseen tasks. Policies trained on individual revisions can continue improving harnesses over multiple rounds, while the benefits of training on revision sequences vary across settings. These findings suggest a path towards continually learning agents that turn accumulated experience into generalizable improvements.

1 Introduction

A harness is the executable program that organizes calls to a foundation model and interactions with tools (Yang et al., 2024; Khattab et al., 2024). It determines what the model sees, which tools it can use, and how execution proceeds. Because these choices strongly shape performance (Shinn et al., 2023; Yang et al., 2024), adapting the harness provides a way to improve how a model uses its capabilities without changing its parameters (Zhang et al., 2025b; Lou et al., 2026).

Execution feedback can guide choices about model calls, tool use, and intermediate outputs, but finding effective harness revisions often requires repeated experimentation at test time, and revisions that work on one task may not transfer to another. We therefore ask whether a model can learn to revise harnesses from execution feedback in a way that generalizes to new tasks. We call this problem harness learning and view it as meta-learning over executable programs (Duan et al., 2016; Finn et al., 2017). The outer loop trains a revision model, which we call the proposer, from execution outcomes, and the inner loop uses the proposer to adapt a harness from execution feedback. Training therefore learns a reusable revision procedure that can transfer to unseen tasks without updating model parameters at test time (Baxter, 2000; Andrychowicz et al., 2016).

We implement harness learning by training the proposer to edit executable harness code (Figure 1). Given a task description, the current harness, and an execution report, the proposer generates a code change. We train the proposer with reinforcement learning, using the performance of the resulting harness as the reward, and optionally initialize it with supervised fine-tuning. At test time, the same proposer can be applied repeatedly, using feedback from each execution to guide the next revision.

∗^{*}Equal contribution.

†^{\dagger}Project lead.

‡^{\ddagger}Equal advising.

Policy update during training

Figure

Figure 1: Harness learning. The proposer reads the task description, the current harness ht−1h_{t-1}, and its execution report, and writes a code edit yty_t, here adding answer validation and a retry. Running the revised harness hth_t yields a reward and feedback for the next round. Training updates only the proposer, and at test time both models are frozen. Figure 2 details training.

We evaluate harness learning on reasoning and multi-hop question answering. On Reasoning Gym (Stojanovski et al., 2025), training improves revision quality on task families excluded from both supervised and reinforcement learning, and in single-step revision the trained 4B proposer outperforms the 35B teacher on average. In multi-hop question answering, a proposer trained on HotpotQA (Yang et al., 2018) transfers to MuSiQue (Trivedi et al., 2022) and 2WikiMultihopQA (Ho et al., 2020). In both settings, trained proposers can continue improving harnesses over successive rounds of test-time adaptation. In QA, even a proposer trained only on seed-harness inputs continues improving revised harnesses, suggesting generalization across adaptation contexts and tasks.

We make the following contributions.

Learning to adapt executable harnesses at test time. We introduce harness learning as meta-learning over executable programs: a model learns from execution outcomes how to revise the harness that organizes model calls and tool use. At test time, the model uses execution feedback to adapt harnesses for new tasks without any parameter updates.

Generalization to unseen tasks. We show that the capability of test-time adaptation via harness revision transfers to reasoning tasks and question-answering benchmarks that are unseen during training.

Iterative test-time adaptation. We show that proposers trained on individual revisions can continue improving harnesses over successive rounds of test-time adaptation. We analyze how training changes the reliability of the revision, the structure of the auxiliary, and the use of generated tools.

References (100)

Couldn't load all references. Reload the page to try again.