Latent Harness: Compiling Agent Behaviors into Post-Block Activation Shifts
Organizations: Hong Kong University of Science and Technology · Southeast University · Rensselaer Polytechnic Institute · University of Tsukuba ·
Abstract
Harness engineering and self-evolving agents improve language-model agents quickly, yet their gains live outside the model. The harness is re-sent and re-paid on every call, and the standard route to internalization is a weight update that is costly to iterate and fixed once merged. We propose compiling the harness instead. Latent Harness distills an external condition into a rank-8 activation shift. The shift is applied at the output of every decoder block of a frozen backbone, at 0.03-0.05% of parameters. The condition is either an explicit process-level behavior instruction or the behavioral contract of an agentic harness. At inference the compiled bundle carries no harness text and adds no tokens. It exposes three runtime controls for injection strength, injection phase, and shift-space mixing. Compiled behaviors recover the source-harness gain in 8 of 10 preregistered settings. Where the explicit source pays the heaviest per-call token tax, the compiled form exceeds it. The same bundles transfer zero-shot across tasks (5 of 7 pairs positive) and compose in shift space, while stacked text instructions interfere destructively. Used as a search space, they lift budget-matched harness search by 1.45 times. On three agentic benchmarks the operator aligns policy to the harness con- tract. Under matched data, capacity, and effective strength it outperforms same-capacity LoRA, which needs 11.1 times the parameters to reach the same band, and it regresses nothing where the base policy is already strong. Across 1B-to-8B models the method skeleton is invariant while gain locations move with the model-task pair, which delimits where compiled harnesses should be deployed.
Figures & tables
| ToolHop | SearchQA | API-Bank | |||||||
| Model | Method | Params (%) | Ans. | Path | Hotpot | 2Wiki | Overall | Succ. | API. |
| Qwen3-4B | ADAS | 0 | 40.00 | 44.99 | 28.67 | 28.00 | 28.33 | 57.31 | 60.99 |
| AgentSquare | 0 | 29.23 | 39.46 | 29.33 | 30.00 | 29.67 | 47.82 | 46.10 | |
| AFlow | 0 | 31.28 | 43.81 | 30.67 | 29.33 | 30.00 | 45.72 | 41.13 | |
| MaAS | 0 | 42.05 | 51.80 | 30.67 | 30.00 | 30.33 | 62.74 | 63.83 | |
| MermaidFlow | 0 | 44.62 | 58.74 | 31.33 | 28.00 | 29.67 | 64.33 | 60.28 | |
| Setting | EXPL. | SOFT-PROMPT | TASK-ADAPTER | OURS | ( ) |
|---|---|---|---|---|---|
| M1 ARC COMPUTE | 0.300 | 0.347 | 0.533 | 0.322 | (1.23) |
| M1 ARC CONCISE | 0.380 | 0.376 | 0.533 | 0.362 | (0.83) |
| M1 MBPP TESTCONSULT | 0.066 | 0.079 | 0.308 | 0.323 | (5.86) |
| M2 MBPP DECOMPOSE | 0.410 | 0.508 | 0.562 | 0.661 | (1.66) |
| M2 MBPP COMPUTE | 0.470 | 0.521 | 0.554 | 0.660 | (1.43) |
| M2 MBPP CONCISE | 0.396 | 0.531 | 0.570 | 0.687 | (1.80) |
Appendix figures & tables11 assets
Supplementary material from the paper’s appendix.
Appendix
| Code | Model | Layers | Trainable | Share |
| M1 | Llama-3.2-1B-Instruct | 16 2048 | 524,288 | 0.0424% |
| M2 | Qwen3-4B | 36 2560 | 1,474,560 | 0.0367% |
| M3 | Llama-3.1-8B-Instruct | 32 4096 | 2,097,152 | 0.0312% |
| v2 | Llama-3.2-1B (base) | 16 2048 | 524,288 | 0.0424% |
| – | Qwen3-8B (policy) | 36 4096 | 2,359,296 | 0.0288% |
| Instruction tasks are BoolQ, ARC-Challenge, GSM8K, and MBPP. | ||||
| Dimension | 4B | 8B | Verdict |
|---|---|---|---|
| ToolHop both gain | [email protected] reproduces 55/95 ( ) | multi-band: [email protected] pt, [email protected] pt | gain location moves with scale |
| SearchQA gain | none (Hotpot subset) | Overall – pt (Hotpot – ) | direction flips with scale |
| Phase conclusion | both carries the stable gain ( 60% prompt-side) | gen both on ToolHop and both wins on SearchQA | task scale dependent |
| LoRA comparison | same-capacity LoRA base everywhere | LoRA r11 (3.09 params) matches Ours | Ours matches LoRA with 1/3 params |
| Scale safe interval | plateau 0.35–0.70 and cliff | narrows to 0.25–0.5 and collapse | same failure family, earlier onset |
| API-Bank | zero regression (bit-exact tie) | all configurations at or above base ([email protected] pt) | zero regression across scales |
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 406 papers