arXiv(opens in a new tab)cs.LGAug 2026Cited by 6 papers on PaperVantage

Manuscript Offprint

arXiv:2609.00196

WHALE: A Simple Recipe for Joint Harness-Weight Optimization

Haechan Kim, Yoonho Lee, Gisang Lee, Chelsea Finn, Kangwook Lee

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

ABSTRACT

Agent performance depends jointly on the model parameters and the executable harness code that manages context and control flow. Optimizing either component in isolation can leave the system bottlenecked by its frozen counterpart: weight updates can change which harness is effective, while harness updates can change which model capabilities are exposed. Existing joint-adaptation methods optimize weights and textual prompts but leave the broader harness fixed. We propose Weight-Harness Alternating LEarning (WHALE), a simple recipe that alternates two phases: updating the model under the current harness, then searching for a better harness under the updated model. We instantiate these two phases with online rejection-sampling fine-tuning and Meta-Harness (Lee et al., 2026), respectively. When to switch is a key design choice: to separate real improvements from noise without over-optimizing against a changing counterpart, WHALE uses either fixed phase durations or an adaptive patience rule over training signals. Using Qwen3.5-2B/4B agents across three domains (search question answering, mathematical reasoning, and chess puzzles), WHALE outperforms weight-only, harness-only, and Fast-Slow Training (Tiwari et al., 2026) by 4.15–24.38 percentage points in best mean@8 accuracy. Either component can be the bottleneck: harness search matches peak weight-only accuracy with far fewer rollouts in SearchQA, but improves math accuracy only after a weight update. Small interleaved updates also outperform stagewise weight-then-harness optimization in accuracy and rollout cost. The code is available at https://github.com/krafton-ai/WHALE.

(a) Joint Search Space

Figure

(b) Post-Adaptation Test Accuracy

Figure

Figure 1: Overview of WHALE. (a) Weight-only and harness-only adaptation move along a single axis of J(θ,h)J(\theta, h), whereas alternating updates allow both components to co-adapt. (b) Our simple joint harness–weight optimization recipe outperforms single-component updates across three diverse domains, as well as joint prompt–weight optimization.

1 INTRODUCTION

Model weights are only half of an agentic language-model system. The other half is the harness, the code that decides which observations enter the context, how tools are exposed and invoked, how execution errors are handled, and when an interaction terminates. Consider a question-answering agent with a retrieval tool: stronger weights cannot use evidence that a brittle harness never retrieves, while better retrieval cannot help a model that cannot synthesize the returned evidence. In this paper, we aim to address this shifting bottleneck by jointly optimizing the harness and the model for the given problem.

Prior work has jointly adapted model weights and their surrounding context, but has restricted the latter to textual prompts (Soylu et al., 2024; Zhang et al., 2026; Tiwari et al., 2026). Executable tool-using agents expose a broader target for adaptation: the harness code governing tools, observations, error handling, and control flow. Recent LLM-based optimizers make direct search over this code feasible (Hu et al., 2025; Lin et al., 2026; Lee et al., 2026). Although both components can now be optimized directly, how to coordinate model training with full-harness search remains unclear.

Coordinating model training with harness search is difficult because the two phases operate on different timescales. Harness search uses a long proposal-and-accept cycle conditioned on many rollouts, whereas online fine-tuning alternates rollout collection with gradient updates. Running the phases concurrently either evaluates each update against a moving counterpart, thereby confounding credit assignment, or requires synchronization barriers due to their mismatched update cadences. Alternation avoids this tradeoff by decomposing the coupled problem into conditional updates, each performed with respect to a fixed counterpart (Wright, 2015). This raises a key scheduling question: how much should each component change before switching? Each phase must gather enough evidence to distinguish genuine improvements from noise, but stop before over-optimizing against a fixed counterpart.

To study the design decisions surrounding alternating weight–harness updates, we propose Weight-Harness Alternating LEarning (WHALE), a modular framework that alternates model training under the current harness with harness search under the updated model (Figure 1(a)). In our experiments, we instantiate the weight-update and harness-search phases with online rejection-sampling fine-tuning (RSFT) (Dong et al., 2023; Gulcehre et al., 2023; Shao et al., 2024) and Meta-Harness (Lee et al., 2026), respectively. By default, fixed hyperparameters shared across cycles determine the duration of each phase. We also propose adaptive WHALE, which allows phase durations to vary across cycles by switching, after a minimum duration, when the current phase's training signal stops improving.

We evaluate WHALE against weight-only, harness-only, and Fast-Slow Training (FST, Tiwari et al. (2026)) across three domains: search question answering (SearchQA), mathematical reasoning with code execution (Math), and chess puzzles. To isolate the effect of the harness search space, our FST implementation uses the same update methods and schedule as WHALE but restricts the search to the system and user prompts. WHALE improves over the single-component baselines by 7.67–24.38 percentage points and over FST by 4.15–13.00 points (Figure 1(b)). Across domains, we observe both harness-limited and weight-limited regimes: in SearchQA, harness search alone matches peak weight-only accuracy with far fewer rollouts, whereas in Math it yields almost no improvement until a small weight update makes the same harness search effective. These contrasting regimes show why joint optimization matters: the bottleneck depends on the domain, and updating one component can unlock gains from the other. Compared with stagewise optimization, which spends the full weight-update budget before running the full harness-search budget once, WHALE's small alternating updates improve accuracy by 5.32 and 9.16 percentage points in SearchQA and Math, respectively, and surpass the stagewise result after only 29% and 49% as many rollouts. We also find that adaptive WHALE outperforms the main fixed schedule (with tuned hyperparameters) in both domains we evaluate. Together, our findings provide a controlled, budget-matched study of alternating weight-harness updates and motivate future work on joint weight-harness optimization.

References (1)

  • X who did A and B