Harness-Aware Distillation for Small Language Model Agents
Organizations: KAIST AI · 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.
Figures & tables
| Component | Computed from |
| State Tracking | |
| Available actions | Environment action list |
| Situation | Location and inventory |
| History | Visit history |
| Budget | Step counter |
| Behavior Monitoring | |
| ALFWorld (1.7B 8B) | WebShop (0.6B 30B) | ScienceWorld (0.6B 30B) | ||||
| Method | Unseen SR | Seen SR | Score | SR | Score | SR |
| Teacher | 51.49 / 38.06 | 50.00 / 37.86 | 49.96 / 41.41 | 18.80 / 13.40 | 20.26 / 18.47 | 20.13 / 15.44 |
| Student | 0 9.70 / 0 2.99 | 20.71 / 0 6.43 | 20.95 / 0 4.29 | 0 9.80 / 0 1.40 | 16.47 / 16.97 | 0 3.36 / 0 3.36 |
| OPD | 47.01 / 31.34 | 40.00 / 31.43 | 41.59 / 39.05 | 19.00 / 16.60 | 0 0.82 / 0 0.64 | 0 8.05 / 0 7.38 |
| SAGE-OPD | 31.34 / 25.37 | 41.43 / 34.29 | 42.21 / 39.15 | 17.00 / 14.00 | 0 0.77 / 0 1.41 | 0 6.04 / 0 6.71 |
| Guided-OPD | 46.27 / 33.58 | 35.71 / 27.14 | 43.89 / 40.09 | 16.60 / 14.40 | 0 2.52 / 0 4.17 | 0 6.04 / 0 6.04 |
| Method | Unseen SR | Seen SR |
|---|---|---|
| Teacher | 51.49 / 43.28 | 49.29 / 42.14 |
| Student | 14.93 / 8.21 | 18.57 / 15.71 |
| OPD | 26.87 / 18.66 | 31.43 / 29.29 |
| SAGE-OPD | 24.63 / 20.90 | 28.57 / 27.14 |
| Guided-OPD | 29.10 / 18.66 | 32.86 / 24.29 |
| SOPD | 32.09 / 29.85 | 34.29 / 25.71 |
| Variant | SR | HU |
|---|---|---|
| HAD (ours) | 57.4 | 81.0 |
| w/o validity ( ) | 50.8 | 78.9 |
| w/o negative (pos-only) | 52.4 | 74.4 |
| w/o preference ( ) | 43.5 | 73.1 |
| Method | Unseen SR | Seen SR |
|---|---|---|
| OPD | 47.0 | 40.0 |
| OPD, 2 | 47.8 | 45.7 |
| SOPD | 45.5 | 41.4 |
| SOPD, 2 | 50.8 | 42.9 |
| HAD (ours) | 63.4 | 51.4 |
Appendix figures & tables9 assets
Supplementary material from the paper’s appendix.
Appendix
| ALFWorld | WebShop | ScienceWorld | |
| Teacher | Qwen3-8B | Qwen3-30B-A3B | Qwen3-30B-A3B |
| Student | Qwen3-1.7B | Qwen3-0.6B | Qwen3-0.6B |
| Teacher (other family) | Gemma-4-12B | – | – |
| Student (other family) | Gemma-4-E2B | – | – |
| Test set | 140 seen, 134 unseen | 500 goals | 149 tasks (30 types) |
| Training pool | 3,553 tasks | 11,587 goals | 3,592 tasks |
| Line | Function | Template (one paraphrase) | When it fires |
|---|---|---|---|
| Situation | State tracking | You are at {location}. You are holding {holdings}. {m} of {n} places visited; {k} unvisited ({names}). | Every step |
| Visit | State tracking | This visit to {location}: arrived turn {a}, {c} commands executed since. and, for a revisit, Previous visit: arrived turn {a}, {c} commands executed, left turn {l}. | Every step with a known location |
| Budget | State tracking | Step {t} of {cap}. and the warning Only {left} steps remain. Commit to finishing the task now. | Counter at every step, warning when fewer than steps remain |
| Failure | Behavior monitoring | ’{action}’ did not work here (this was attempt {N}). It will keep failing at this state - choose a different action from the displayed list. | The same action was refused or had no effect at the same state at least the minimum number of times |
| Stall | Behavior monitoring | Nothing new has been observed for {k} steps. You are not making progress. | No new state was reached in the last steps |
| ALFWorld | WebShop | ScienceWorld | |
|---|---|---|---|
| Stall window | 5 | 4 | 8 |
| Budget threshold | 11 | 5 | 11 |
| Minimum failed attempts | 2 | 1 | 2 |
| Available actions | Situation | Budget | Failure | Stall | HU | |
| Teacher | 90.1 | 97.2 | 87.8 | 79.4 | 16.9 | 74.3 |
| Student | 73.7 | 96.2 | 79.1 | 61.2 | 18.1 | 65.7 |
| OPD | 87.8 | 97.0 | 88.4 | 52.9 | 17.6 | 68.8 |
| SAGE-OPD | 88.0 | 97.9 | 83.7 | 52.3 | 11.0 | 66.6 |
| Guided-OPD | 82.5 | 94.1 | 85.7 | 28.6 | 5.3 | 59.2 |
| SOPD | 84.8 | 96.5 | 92.3 | 67.3 | 24.7 | 73.1 |
| ALFWorld | WebShop | ScienceWorld | |
| Optimizer | AdamW, weight decay 0.01, gradient clipping 1.0 | ||
| Learning rate | |||
| Schedule | cosine to 0, 15 warmup updates | ||
| Effective batch size | 60 | 60 | 60 |
| Updates | 250 | 150 | 150 |
| Tasks per round | 16 | 16 | 16 |
| With harness | Without harness | |
| Teacher | 14.10 | 12.99 |
| Student | 13.86 | 9.77 |
| OPD | 13.16 | 13.45 |
| SAGE-OPD | 14.71 | 12.85 |
| Guided-OPD | 14.14 | 12.23 |
| SOPD | 15.15 | 12.31 |
| Method | Unseen SR | Seen SR | Turns | HU |
|---|---|---|---|---|
| Teacher | 51.49 / 43.28 | 49.29 / 42.14 | 13.91 / 13.93 | 75.92 |
| Student | 14.93 / 8.21 | 18.57 / 15.71 | 12.26 / 12.92 | 71.38 |
| OPD | 26.87 / 18.66 | 31.43 / 29.29 | 13.26 / 12.97 | 68.76 |
| SAGE-OPD | 24.63 / 20.90 | 28.57 / 27.14 | 14.30 / 13.79 | 67.35 |
| Guided-OPD | 29.10 / 18.66 | 32.86 / 24.29 | 14.84 / 11.58 | 64.05 |
| SOPD | 32.09 / 29.85 | 34.29 / 25.71 | 13.85 / 12.33 | 69.04 |
LLM Agent Harnesses
LLM agent harnesses are the software and runtime systems that organize an agent’s tools, context, state, execution, and safeguards.
See all 357 papers