Learn › Agents
·★ MEMBER·PAPER·12 min read

Paper Walkthrough: WHALE — Training the Weights and the Harness in Turns

An agent's performance is set by two things at once: the model weights, and the harness code wrapped around them. Polish one and the other becomes the ceiling. Here is a paper that dissolves that moving bottleneck by simply alternating two phases — explained from the metaphor through the math, the measured numbers, and the limits.

Key points

  • The harness is 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.
  • Agent performance depends jointly on model weights and the harness, and optimizing either alone leaves the system bottlenecked by its frozen counterpart.
  • WHALE alternates updating the model under the current harness with searching for a better harness under the updated model.
  • The weight update is rejection-sampling fine-tuning, which keeps only trajectories the verifier accepts and samples G=8 trajectories per prompt.
  • Harness search is a loop where a proposer writes M candidate harnesses as code and the highest scorer is accepted; WHALE requires only black-box interfaces to both procedures.
ModalitytextTaskagents

WHALE: A Simple Recipe for Joint Harness-Weight Optimization

Primary source — what this article is built on

undefined2026-08-31→undefined2026-09-09same month

WHALE: A Simple Recipe for Joint Harness-Weight OptimizationHaechan Kim, Yoonho Lee, Gisang Lee et al. · 2026-08-31 · v1arXiv:2609.00196Paper page·PDF
undefined

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, 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 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 great sprinter in the wrong shoes

If you want a sprinter to run faster, are the legs the only thing to train? Spike length, the angle of the starting blocks — the setup outside the body matters just as much. And the awkward part is that each one moves the other's optimum. Stronger legs call for a different block angle; a different block angle recruits different muscles. Perfect one while freezing the other and you never reach what the pair could do together.

The same thing happens to LLM agents. The paper here is "WHALE: A Simple Recipe for Joint Harness-Weight Optimization" (Haechan Kim et al., arXiv:2609.00196, published 31 August 2026).

Its argument, in brief: agent performance depends jointly on the model parameters and on the executable harness code that manages context and control flow. Optimizing either in isolation leaves the system bottlenecked by its frozen counterpart — weight updates change which harness is effective, and harness updates change which model capabilities are exposed. Existing joint-adaptation methods optimize weights and textual prompts, but leave the broader harness fixed. So the authors propose WHALE (Weight-Harness Alternating LEarning): a simple recipe that alternates updating the model under the current harness with searching for a better harness under the updated model.

What exactly is a "harness"?

The paper's definition is crisp. The harness is 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 (§1). It covers system instructions, tool schemas, context management, parser and execution logic, and the termination policy (§3).

So the prompt is only one part of the harness. Prior work, the authors argue, has confined "everything outside the model" to text (§2). Their intuition pump makes it concrete: for a QA 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 (§1).

There is only one objective: expected reward

Model parameters θ\theta and an executable harness program hh together induce a distribution πθ,h\pi_{\theta,h} over trajectories τ\tau — the sequence of model messages, tool calls and results, and environment transitions. Given a task distribution P\mathcal{P} and a verifier RR, the system's expected reward is (§3):

J(θ,h)=Ex∼P Eτ∼πθ,h(⋅∣x)[R(x,τ)]J(\theta,h) = \mathbb{E}_{x\sim\mathcal{P}}\,\mathbb{E}_{\tau\sim\pi_{\theta,h}(\cdot\mid x)}[R(x,\tau)]
(1)

Strip the notation away and it is a sentence which says "draw a lot of tasks, run the agent on each one, and average how often it gets them right." Here xx is an individual task, τ\tau is the record of that run, πθ,h\pi_{\theta,h} is the distribution over such runs that the weights and the harness jointly induce, and RR is a grader that returns 1 for correct and 0 otherwise. Nothing in it is specific to weights or to harnesses — that is the point. There is a single number to be raised, and both components sit inside it on equal footing.

We want the pair (θ⋆,h⋆)(\theta^\star, h^\star) that maximizes JJ — but the paper does not maximize over Θ×H\Theta\times\mathcal{H} directly. It splits adaptation into a phase that moves θ\theta with hh frozen and a phase that moves hh with θ\theta frozen. This is the classical move known in optimization as coordinate descent (Wright, 2015): decompose a coupled problem into conditional updates, each taken against a fixed counterpart (§2).

Why not run both at once? Harness search operates on a long propose-and-accept cycle conditioned on many rollouts, while online fine-tuning interleaves rollout collection with gradient updates in small steps. The cadences do not match. Run them concurrently and every update is evaluated against a moving counterpart, which confounds credit assignment; avoid that, and you need synchronization barriers instead (§1).

FIG 1When you cannot descend a two-variable surface straight down, you move one axis at a time. Read the horizontal axis as "weights" and the vertical one as "harness"

What goes inside the two phases

Weight updates: online rejection-sampling fine-tuning (RSFT) (§3.1). Under a fixed harness, let the model generate its own trajectories, keep only the ones the verifier accepts, and run ordinary supervised learning on those. The rest are simply discarded. The experiments sample G=8G=8 trajectories per prompt and maximize log-likelihood only over model-generated token positions, excluding user prompts and tool results.

Harness search: Meta-Harness (MH) (§3.2). An iterative propose–evaluate–select loop. At each iteration a proposer (Claude Opus 4.7 in the experiments) inspects the archived source files and the artifacts of past evaluations through filesystem tools, then writes MM candidate harnesses as code. Each candidate is scored, and the highest scorer across the whole archive is accepted. A proposal may refine an earlier candidate or revert to an earlier design.

WHALE itself is remarkably short

Cycle kk is just this (§4):

θk+1=ModelUpdate(θk; hk, Dweight),hk+1=HarnessSearch(hk; θk+1, Dharness)\theta_{k+1} = \mathrm{ModelUpdate}(\theta_k;\, h_k,\, \mathcal{D}_{\mathrm{weight}}), \qquad h_{k+1} = \mathrm{HarnessSearch}(h_k;\, \theta_{k+1},\, \mathcal{D}_{\mathrm{harness}})
(2)

Read aloud, it is a two-step recipe which says: train the model a little under the current harness, then search the harness a little under the newly trained model, and repeat. The semicolons carry the whole idea — hkh_k appears on the right of the first assignment and θk+1\theta_{k+1} on the right of the second, so each phase is handed the other's latest result and never guesses at it. The key property is that WHALE requires only black-box interfaces to the two update procedures, so RSFT and MH can each be swapped for something else.

The budget is a number of training epochs, and cycle consumes the span of from a persistent sampler — no data is revisited. The budget is the number of search iterations, and the number of candidates proposed per iteration.…

What's behind this

§

Members-only from here

449 walkthroughs, 42 textbook chapters, 48 student units and 6 close readings — all included for $4.99/mo, with about three new explainers a day on average. Cancel any time; access runs to the end of the period.

Already a member? Sign in to keep reading

References

  1. Haechan Kim, Yoonho Lee, Gisang Lee, Chelsea Finn et al.. (2026-08-31) WHALE: A Simple Recipe for Joint Harness-Weight Optimization. arXiv:2609.00196Paper page·PDF

This article is written from the source paper above. Where they differ, the original is authoritative.

Published by TechAthletes · Editorial policy · How we cite · Corrections

Comments

Sign in to comment