Manuscript Offprint

arXiv:2610.02858

Harness-Aware Distillation for Small Language Model Agents

Moonseok Choi, Taehong Moon, Giung Nam, Juho Lee

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

Moonseok Choi 1^{1} Taehong Moon 2^{2} Giung Nam 1,†^{1,\dagger} Juho Lee 1,†^{1,\dagger}

1^{1}KAIST AI, 2^{2}Independent researcher

Abstract: Language model agents are deployed with a harness, the software around the model that manages its context, tools, and feedback. When such an agent is distilled into a smaller one, the harness stays in place, so the student mainly needs the teacher-specific abilities that the harness cannot provide, such as acting correctly on harness information. Standard distillation, however, imitates the teacher's full outputs and treats the harness as part of the input. We propose Harness-Aware Distillation (HAD), which focuses distillation on what the teacher adds beyond the harness. HAD complements on-policy distillation with two components: an action preference that contrasts the same teacher's actions with and without the harness information, scored after the student's own reasoning, and a validity check that drops preference pairs whose preferred action contradicts the harness records. We show that the contrast gives the student information that imitating the teacher alone cannot provide, and HAD needs no task rewards, success labels, or future information. Across multiple long-horizon agent benchmarks and models, HAD outperforms on-policy distillation baselines with the same fixed harness. Our analysis shows that HAD enters fewer unproductive loops and recovers from errors more often than the baselines, and suggests that it adaptively keeps learnable feedback in its weights while reading state information from the harness. The project page is available at link.

1. Introduction

Language model agents solve long-horizon tasks through repeated interactions with an environment and its tools (Yao et al., 2023; Yang et al., 2024a). They are usually deployed inside a harness, the software around the model that manages its context, tools, and feedback (Wang et al., 2025; Lee et al., 2026). A harness can, for example, track the environment state, list the available actions, and report when the agent repeats an action without effect. Changing only the harness, with the model fixed, can improve agent performance substantially (Yang et al., 2024a; Lee et al., 2026), so practical deployments assume a harness-equipped agent.

At the same time, the high cost of large models gives a strong incentive to distill their capabilities into smaller agents (Belcak et al., 2025; Zeng et al., 2024). On-policy distillation (OPD) is a common choice, as it provides teacher supervision at the states the student itself visits (Agarwal et al., 2024; Lu and Thinking Machines Lab, 2025; Wang et al., 2026; Zhou et al., 2026), but existing methods do not explicitly account for the harness. Distilling a harness-equipped agent is a problem between two systems that share the same harness. The harness

Task: clean a plate and put it in the cabinet

OPD

HAD (ours)

  1. Ignores the harness.

HARNESS plate not clean

Figure

I have the plate.

Put it in the cabinet.

go to cabinet

Figure

The plate is not clean.

Let's clean the plate.

go to sink

  1. Right goal, wrong action.

HARNESS plate not clean

Figure

The plate is not clean.

Let's clean the plate.

go to cabinet

Figure

The sink is where

I can wash it.

go to sink

  1. Copies teacher errors.

HARNESS holding nothing

Figure

TEACHER TARGET

clean plate

clean plate

copied as-is

TEACHER TARGET

clean plate

clean plate

dropped, not holding it

Figure 1: OPD versus HAD on the three failures of OPD. HAD acts on the harness information in the first two rows and drops the invalid teacher target from its preference term in the last.

stays fixed when the teacher is replaced by a smaller model, so the student does not need to learn what the harness already provides. What it needs is the teacher's own ability to act on what the harness reports. A natural approach is to run OPD with the same harness for the teacher and the student, yet this approach does not reliably transfer the ability. As Figure 2 shows, adding the harness to OPD changes the student's performance

†^{\dagger} Co-corresponding authors

Correspondence to: {ms.choi, giung, juholee}@kaist.ac.kr.

Figure

Figure 2: Harness utilization and performance of distilled students on ALFWorld. Left: Each OPD method distilled without (light) and with (dark) the harness. Right: The zero-shot student, a distilled student trained without and with the harness, and HAD. Adding the harness to distillation improves harness utilization (65.7%→73.1%) but not performance (43.1%→43.5%), while HAD improves both (65.7%→81.0%; 43.1%→57.4%).

inconsistently across methods. The agreement between the student's actions and the harness records, which we call harness utilization, also shows limited improvement and can even fall below that of the untrained student.

We attribute such limited gains to three failures in the supervision that OPD provides, illustrated in Figure 1. First, OPD leaves the teacher's use of the harness implicit. Table 2 shows that part of the teacher's performance comes from the harness, and keeping this benefit requires the student to learn when harness information should change its decision. OPD supervises every step in the same way, so it does not mark the few steps where the harness changes the teacher's action, and it never shows what the teacher would choose without the harness. Second, OPD does not separate what the harness provides from what the teacher adds. The harness supplies information and feedback, but deciding how to act on them is an ability of the teacher that the harness cannot provide. In the middle row of Figure 1, the student reads that the plate is not clean, yet goes to the cabinet instead of the sink. Third, OPD accepts teacher targets that contradict the harness records. Prior work shows that teachers can be less reliable at student-visited states (Wang et al., 2026; Li et al., 2026; Zhou et al., 2026). The harness records can reveal teacher errors, such as a target that requires an object the agent does not hold, but OPD does not check teacher targets against the harness records.

Our key insight is that the shared harness can itself guide distillation, as it shows which teacher decisions depend on it and its records reveal teacher targets that contradict observed facts. We propose Harness-Aware Distillation (HAD), which adds two components to response distillation, our term for on-policy distillation of the teacher's full response with the harness enabled, as illustrated in Figure 3. Harness-aware action preference learning queries the same teacher with and without the harness information and trains the student to prefer the action chosen with the harness, scored after the student's own reasoning. This contrast is active only at states where the harness changes the teacher's action, and as we show in Section 3.2, it carries information that imitating the teacher's response alone does not provide. Harness-aware action validity filtering drops preference pairs whose preferred action contradicts the harness records, while response distillation is unchanged. HAD uses no task rewards, success labels, or future information.

Our contributions are as follows:

• We view the distillation of a harness-equipped agent as distillation between two systems that share the harness, so the student should learn the teacher-specific abilities that the harness cannot provide. We show that on-policy distillation with the shared harness does not reliably teach the student what the teacher adds beyond the harness.

• We propose HAD, which queries the same teacher with and without the harness and teaches the student to prefer the action chosen with the harness. Since the teacher can still make mistakes, a validity check drops pairs whose preferred action contradicts the harness records. We show in Section 3.2 that the contrast adds information that imitating the teacher alone cannot provide.

• HAD outperforms on-policy distillation baselines with the same harness across multiple long-horizon agent benchmarks and models. Our analysis in Section 4.3 shows that HAD learns to recover from stalls, unlike the baselines, and suggests that it keeps learnable feedback in its weights while reading state information from the harness.

References (79)

  • On-policy distillation of language models: Learning from self-generated mistakes
  • Small language models are the future of agentic ai, 2025 (opens arXiv in a new tab)
  • FireAct: Toward language agent fine-tuning, 2023 (opens arXiv in a new tab)
  • Gemma 4 Technical Report
  • MiniLLM: Knowledge distillation of large language models
  • Distilling the Knowledge in a Neural Network
  • Distilling LLM agent into small models with retrieval and code tools
  • The interplay of harness design and post-training in LLM agents, 2026 (opens arXiv in a new tab)
  • Sequence-level knowledge distillation
  • Meta-Harness: End-to-end optimization of model harnesses
  • On-policy distillation with curriculum turn-level guidance for multi-turn agents, 2026 (opens arXiv in a new tab)
  • Direct preference knowledge distillation for large language models, 2024 (opens arXiv in a new tab)
  • Structured agent distillation for large language model agents
  • On-policy distillation (opens the publisher in a new tab)
  • Direct preference optimization: Your language model is secretly a reward model
  • Reflexion: language agents with verbal reinforcement learning
  • ALFWorld: Aligning text and embodied environments for interactive learning
  • Step-level on-policy distillation: Interpolating between on-policy distillation and supervised fine-tuning, 2026 (opens arXiv in a new tab)
  • UCOB: Learning to utilize and evolve agentic skills via credit-aware on-policy bidirectional self-distillation, 2026 (opens arXiv in a new tab)
  • Exploring temporal curriculum in on-policy distillation for multi-turn autonomous agents
  • ScienceWorld: Is your agent smarter than a 5th grader? In Conference on Empirical Methods in Natural Language Processing (EMNLP), 2022
  • OpenHands: An open platform for AI software developers as generalist agents
  • Contrastive preference optimization: Pushing the boundaries of LLM performance in machine translation
  • RPO: Retrieval preference optimization for robust retrieval-augmented generation
  • Qwen3 Technical Report
  • SWE-agent: Agent-computer interfaces enable automated software engineering
  • RLCD: Reinforcement learning from contrastive distillation for LM alignment
  • WebShop: Towards scalable real-world web interaction with grounded language agents
  • ReAct: Synergizing reasoning and acting in language models
  • On-policy context distillation for language models, 2026 (opens arXiv in a new tab)
  • Preference-based self-distillation: Beyond KL matching via reward regularization, 2026 (opens arXiv in a new tab)
  • AgentTuning: Enabling generalized agent abilities for LLMs
  • Training with harnesses: On-policy harness self-distillation for complex reasoning, 2026 (opens arXiv in a new tab)
  • SAGE-OPD: Selective agent-guided intervention for multi-turn on-policy distillation, 2026 (opens arXiv in a new tab)
  • Rather than using a fixed value of $\lambda_{\mathcal{B}}$, we introduce a per-mini-batch heuristic that scales the newly introduced preference loss-gradient so that its contribution to the parameter update is approximately half that of the original distillation loss-gradient:
  • Setting $\lambda = 0$ removes the auxiliary term, whereas setting $m_t \equiv 1$ retains every positive preference candidate
  • This preserves direct student-prefix supervision without the stripped-history comparison
  • For $y = (z, a)$, autoregressive factorization gives
  • Write the teacher response laws and action marginals as
  • Zero-weight imitation terms are interpreted as zero, including at zero student probabilities
  • The weights $\mu$ sum to one, and full support makes every weight positive and every $\eta(a,b)$ strictly between zero and one
  • Equivalently, $f - s$ is constant
  • Under the assumptions above, with student and reference action laws normalized on $\mathcal{A}$, $P_{+} = P_{-}$ now yields the reference law as the isolated optimum
  • For each accepted–rejected pair, only the comparison favoring the accepted action remains, and its contribution strictly decreases as the accepted action’s score margin increases
  • Validity filtering addresses this failure of harness access as a preference proxy, without requiring checks on negative candidates during training
  • Under Definition A.3, assume $J_{+}$ and $J_{-}$ are strictly positive on $\mathcal{Y}$
  • Because both length factors are positive, an opposite action ordering requires the additional term $r_{z}(a) - r_{z}(b)$ to change the sign of the action contrast
  • Normalization of each conditional law forces that constant to be zero, so equality is equivalent to $J_{+}(\cdot \mid a) = J_{-}(\cdot \mid a)$ for every action
  • The prefix-dependent constant cancels in action comparisons
  • Both laws have full support, with $P_{+} = (2/3, 1/3)$ and $P_{-} = (1/3, 2/3)$
  • Its action-score margin at $z_0$ is $2\log((1/4)/(3/4)) = -\log 9$, rather than $\log 4$, giving strictly greater action risk by Equation 23
  • It compares isolated preference optima; it does not establish the same reversal for the full-response variant after adding response distillation, nor does it order the variants by task utility
  • The resulting loss supplements imitation of complete teacher responses with supervision of the student's conditional action choice
  • Let Z be a common finite, nonempty reasoning-prefix alphabet
  • Define the per-prefix and prefix-averaged excess risks by
  • Under Definition A.4, let $Q(z, a) = Q_Z(z) Q_A(a \mid z)$ be strictly positive on $\mathcal{Z} \times \mathcal{A}$
  • This is a property of the collected-data loss, not a claim that preference updates leave the student's reasoning unchanged: neural parameters may be shared, and resampling prefixes would change $\omega$
  • This neither replaces $P_{\pm}$ by teacher continuation laws conditioned on $z_{s}$ nor labels the student's reasoning as correct
  • This does not imply that the combined HAD optimum is prefix-invariant, as it also includes response distillation and may constrain action conditionals through shared parameters
  • Definition A.4 supplies the common per-prefix excess risk used to compare these distributions
  • Let $\tau$ be another fixed prefix distribution used with the same action comparison, and define
  • The weighted-imitation argument in Section A.8 proves the formula, allowing zero probabilities on zero-weight actions
  • For positive lengths $\ell(\xi)$ and scores $\beta \log p(\xi)/\ell(\xi)$, its unique optimum over positive probability laws normalized on $\mathcal{S}$ is
  • For action preferences, take $\mathcal{S} = \mathcal{A}$, $g = s$, and $\ell = L$; for full-response preferences, take $\mathcal{S} = \mathcal{Y}$, $g = \log(J_{+}/J_{-})$, and $\ell = D$
  • All models are public checkpoints served with thinking disabled, and the Gemma pair uses the same prompts, harness, and training recipe as the Qwen3 pair on ALFWorld
  • Seen and unseen ALFWorld tasks are pooled
  • Following prior on-policy distillation work for multi-turn agents (Li et al., 2026; Sun et al., 2026), student rollouts are sampled at temperature 1.0 and all evaluations use temperature 0.4
  • ><tr><td> </td><td>ALFWorld</td><td>WebShop</td><td>ScienceWorld</td></tr><tr><td>Optimizer</td><td colspan=
  • Nothing happens
  • Do not add any text before the Thought line or after the Action line
  • Each prompt is shown as recorded, with the role markers <system>, <user>, and <assistant>, and the server adds the chat template tokens of each model
  • With the harness, HAD takes a similar number of turns to the other methods while solving the most tasks
  • I should check the ottoman again to place the first remote control
  • HAD follows the harness report that the sofa is the only unvisited place and finds the second remote
  • Action: inventory -> You are not carrying anything
  • Earlier in the episode, HAD placed an unheated mug on the coffee machine and concluded that the task was done
  • With the harness, HAD achieves the highest success rate on both splits and the highest harness utilization at 77.9%, above even the 75.9% of the teacher
  • Table 15 compares HAD with a full-response contrast and with the teacher as a reference model, whose definitions are given in Appendices A.2 and A.4 and whose results are discussed in Section 4.5
  • As Figure 9 shows, the two teacher actions differ at $15.5\%$ of the states on ALFWorld, $25.6\%$ on WebShop, and $19.3\%$ on ScienceWorld