arXiv:2610.19834cs.AIOct 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2610.19834

Teaching Agents in their Own Style: Blackbox Teacher Distillation for Web Agents

Md Farhan Ishmam, Kenneth Marino

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

ABSTRACT

Frontier web agents using closed models have high inference and computational costs. Smaller open models can be an alternative, but to be performant, they require training supervision from a human or teacher model. Token-level teacher distillation is not an option for closed teachers as it needs access to the model's logits. The standard approach is to imitate teacher demonstrations offline, but it trains the student on states it has never visited, and in a style it does not write in. We introduce WEBKD, where the teacher is the editor of the student's failures. Given a failed episode, the teacher finds the first point of mistake, and rewrites the student's reasoning traces, harness states, and actions from that point onward. The editing reveals that the teacher's corrections can be more surprising to the student than the student's own text. WEBKD instead aims to edit minimally. In the data space, the teacher writes each correction in the student's style. In the objective space, the reasoning is weighted by its contribution to the action. A role-asymmetric KL anchor allows the corrected action to move freely while keeping the reasoning near the student's prior. On the TimeWarp benchmark, WEBKD students gain about 5.5-10.7pp over behavior cloning, outcome-reward RL, and teacher editing baselines. The performance transfers to unseen versions and to the live web in the OnlineMind2Web benchmark. WEBKD opens a new way of distilling black-box models to improve the capabilities of open-weight web agents.

1 INTRODUCTION

Agents built on the largest proprietary large language models (LLMs) now perform remarkably well on web tasks (Song et al., 2025; Xue et al., 2025). Such a task hands the agent a goal and a browser, and asks it to navigate complex, changing interfaces, plan across tens of steps, and carry intermediate findings through to a final answer. Deploying these agents for everyday use is another matter. Frontier models have high latency because they are large reasoning models. The computational cost makes them less viable as agents that run in the background of daily work. Robotics faced a similar problem, which led to compact Vision-Language-Action (VLA) models distilled for real-time control (Zitkovich et al., 2023; Kim et al., 2025). Web agents also need a small and cheap open-weight model that runs at interactive latency but carries the competence closer to its frontier teacher.

This raises the main challenge we address in this paper: how do we effectively transfer the competence of the black-box, teacher model to the small, more efficient model? Web tasks can be long-horizon over partially observed pages, and the agent must plan explicitly while reasoning in natural language (Xue et al., 2025). The harness truncates the history to recent observations due to the limited context. So the agent also keeps a scratchpad memory, and what it writes there, together with its earlier responses, is the only state that persists across steps (de Chezelles et al., 2025) (§3.1).

Secondly, the outcome reward is a single value per episode, far too sparse to shape multiple structured decisions with reinforcement learning (RL) (Shao et al., 2024; Wei et al., 2025). Teacher supervision is denser, but the strongest teachers are black boxes that expose no internals or logits. Every distillation method that consumes the teacher's next-token distribution, e.g., token-level knowledge distillation (KD), reverse Kullback–Leibler (KL) objectives, and on-policy distillation (Gu et al., 2024; Agarwal et al., 2024; Lu & Thinking Machines Lab, 2025), is therefore unavail-able. What a frontier teacher can emit is text. Our research asks how much of a black-box frontier teacher's competence can be distilled into a small web agent through text alone.

The standard approach is behavior cloning, which involves sampling teacher demonstrations and fine-tuning the student on them offline (Kim & Rush, 2016). For web agents, this is known to help substantially (He et al., 2025; Ishmam & Marino, 2026), and it is where our pipeline begins. But behavior cloning creates two new problems. It trains the student only at states the teacher visits, so at deployment, small errors carry the student into states its supervision never covered, and the errors compound over the horizon (Ross et al., 2011). Secondly, it trains the student on the teacher's surface distribution, unintentionally importing a writing style that the small model cannot comfortably produce. Is offline imitation really the most a teacher has to offer?

The classical answer to this is DAgger (Ross et al., 2011), where the expert relabels the states the learner visits. However, DAgger corrects only the actions while a web agent's generation is a structured response (Fig. 1). With truncated history, the non-action parts of that response form the belief state that guides later decisions. Fixing the click while leaving the reasoning that led to it unchanged, therefore fixes the immediate mistake but not its source. Conversely, on-policy expert correction (Lauffer et al., 2026) gives control to the teacher from the point of failure and lets it finish the episode. So the completed suffix is the teacher's trajectory, which is off-policy in state and style.

An alternative is to use the teacher as an editor of the student's own failures. The teacher reads a failed episode, localizes the earliest erroneous step, and rewrites the student's full structured response, reasoning, and harness traces included, from that step to the end. Each rewrite is a single-step teacher rollout on a state the student actually visited, so the supervision is on-policy. However, it is not on-policy in style. A frontier teacher's corrections are surprising to the student, which are at several times the perplexity of the student's own steps. This gap is especially large in the reasoning components, where perplexity can increase by up to an order of magnitude, while the action itself remains much closer to the student's distribution.

Under uniform fine-tuning, the loss is largest where the supervision is most foreign, which is the teacher's wording rather than its decisions. WEBKD attacks this perplexity premium by editing the rationale minimally. In data space, the teacher writes each correction in the student's own style from in-context exemplars of the student's writing. In objective space, each reasoning span is weighted by how much it raises the student's probability of the corrected action. A role-asymmetric anchor allows the corrected action to move freely while keeping the reasoning close to the student's prior. The student adopts the teacher's decisions in full, while being closer to its own writing style.

Our contributions are as follows:

• Problem. We formulate distillation from a black-box frontier teacher into a small web agent by using teacher-edits and identify a key obstacle, the on-policy perplexity premium (Defn. 1). The premium is the excess surprisal of the student on the teacher supervision, and it concentrates on the reasoning components rather than the action (Fig 2).

• Method. We introduce WEBKD, a new distillation method that uses the teacher to edit the student's failures without the teacher's logits (Fig.1). The teacher localizes the first erroneous step and rewrites the subsequent reasoning traces, scratchpad memory, and actions in the student's style instead of imitating teacher-style traces (§3.3). The student then trains under a novel objective function that weights each reasoning span by how much it informs the action (§3.3.1) and anchors the reasoning to the student's prior (§3.3.2).

• Evidence. On the TimeWarp benchmark, WEBKD lifts the performance of students by 5.5 – 10.7 pp across behavior cloning, outcome-reward RL, and teacher editing baselines using Qwen and Gemma models (Tab. 1). The gains translate to unseen TimeWarp versions, and the live web benchmark, OnlineMind2Web (Fig. 4). Our ablations vary the source of the edits and styles, training objectives, and hyperparameters (Tables 2, 3, Fig. 5).