arXiv:2611.01415cs.CLNov 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2611.01415

Latent Harness: Compiling Agent Behaviors into Post-Block Activation Shifts

Ran Li, Shimin Di, Zeyu Ren, Ling Yue, Jiachuan Wang, Lei Chen

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 repaid 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×1.45\times. On three agentic benchmarks the operator aligns policy to the harness contract. Under matched data, capacity, and effective strength it outperforms same-capacity LoRA, which needs 11.1×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. Our code is available at https://github.com/rlisml/latentharness.

1 INTRODUCTION

The performance of a language-model agent is increasingly set by its harness, meaning the instructions, tool policies, memory, and verification scaffolds wrapped around model calls. Recent work searches over program spaces (Hu et al., 2025; Zhang et al., 2025b) and over modular design spaces (Shang et al., 2025; Zhang et al., 2025a), and some of it constrains the search to safety (Zheng et al., 2025). A second line makes harnesses improve themselves, either by synthesizing code harnesses from failures (Lou et al., 2026), by editing executable runtime harnesses (Shao et al., 2026), or by optimizing harness and model jointly (Lee et al., 2026). Surveys document how broad this engineering surface has become (Meng et al., 2026). Where the resulting gains end up is almost always one of two places, in text that surrounds the model or in the model's weights.

Both carry structural costs. A textual condition is a recurring expense. Even a 49-token process instruction is re-sent on every call, the behavior exists only while the text is present, and serving several harnesses multiplies prompt length. Weight updates internalize at a different price. Training-style policy alignment such as SFT, RLOO, and GRPO (Shao et al., 2024), co-evolution frameworks that update policy weights alongside the harness (Chen et al., 2026c;b; Hebar et al., 2026), and self-evolving agents that write acquired skills into fine-tuned or RL-trained weights (Huang et al., 2026; Xia et al., 2026; Zhang et al., 2026b) all modify millions of parameters per behavior. They also bind one behavior to one set of edited weights and fix the intervention strength at merge time.

Figure

Figure 1: Latent Harness compiles external conditions into post-block activation shifts. Teacher traces or strictly filtered success trajectories train a rank-8 shift at every block output of a frozen backbone. The bundle injects at run time with strength, phase, and mixing controls.

We propose a third destination and compile the harness. At compile time the frozen model produces its own supervision under the external condition. The supervision is either teacher traces generated with an explicit behavior instruction prepended, or decision pairs harvested from trajectories that succeeded under an agentic harness. A rank-8 low-rank shift is then trained at the output of every decoder block and exported as a per-layer bundle. At run time the bundle is injected into the residual stream after each block. The model then behaves as if the condition were present, without the condition text, at zero additional tokens, with every backbone parameter bit-identical. We call the compiled artifact a latent harness. Figure 1 summarizes the pipeline.

Compilation preserves behavior more faithfully than we expected. Across preregistered settings the compiled shift recovers most of the explicit-harness gain. In the settings where the text harness pays the heaviest per-call token tax, the compiled form exceeds it, because the internalized behavior pays that tax once, at compile time. The compiled object is the behavior itself and does not reduce to generic task skill. Preregistered behavioral markers move with the scores, accuracy-only adapters dissociate from behavior, shuffled pairings fail to reproduce it, and a harmful harness compiles into a harmful latent with the same fidelity. Compiled bundles are also reusable. They transfer zero-shot across tasks, they compose in shift space while stacked text instructions interfere destructively, and they lift budget-matched harness search by 1.45×. The same operator aligns policy on three agentic benchmarks. Under matched data, capacity, and effective strength it outperforms same-capacity LoRA, and on a benchmark where the base policy is already strong it regresses nothing. Our contributions are as follows.

  • A compilation abstraction for harness gains. One operator, a post-block rank-8 shift on a frozen backbone at 0.03–0.05% of parameters, compiles two kinds of external conditions into an artifact that needs no condition text and no tokens at inference. The artifact exposes runtime controls for strength, phase, and mixing.
  • Evidence that compilation preserves the behavior. 8 of 10 preregistered settings recover at least half of the source gain. A three-chain protocol over scores, preregistered markers, and controls attributes the recovery, including symmetric replication of harmful signatures. Where the text source pays the heaviest token tax, the compiled form exceeds it.
  • Evidence that compiled bundles are reusable. Frozen bundles transfer zero-shot across tasks (5 of 7 pairs positive, 59–74% out-of-distribution recovery). They compose exactly in shift space, where text stacking is destructive, and they deliver a 1.45× search gain at a matched evaluation budget.
  • Policy compilation on agent benchmarks. At 1.012× parameters and matched data and strength, the shift beats same-capacity LoRA on ToolHop (60.00% vs. 54.74%, paired net +5). Full-capacity LoRA needs 11.1× (4B) and 3.09× (8B) parameters to reach the same band. API-Bank

shows zero regression. The skeleton is invariant from 1B to 8B while gains move with the model-task pair.

References (62)