Back to blog
10 min readBy VIBPS

How can an AI harness help a model generalize to longer tasks?

A November 2026 study argues that an agent harness can teach models reusable task decomposition. Here is how the design works, what the experiments show, and what they do not establish.

AI agentsLanguage modelsDeveloper guide

A model may solve a short research task, then lose its way when the same job arrives as a much longer document or a sequence of dependent steps. One response is to train the model on more long examples. Another is to change the software around it: keep the large task outside the prompt, let the model inspect pieces with code, and use smaller model calls to handle local questions. That surrounding software is the agent harness. A November 2026 research paper asks whether a harness can do more than help at inference time: can training inside a carefully designed harness teach behavior that transfers to longer or structurally different tasks?

The paper is titled Language Model Harnesses Can Be Compositional Generalizers. Alex L. Zhang, Souradip Chakraborty and Omar Khattab study Recursive Language Models (RLMs), a harness that holds context in an external read-evaluate-print loop, or REPL. The paper’s central proposal is that the harness can shape what each model call sees, so a strategy learned on one task can be reused as a set of smaller, familiar operations on another. The authors call this locally in-distribution behavior. It is a hypothesis about why their results transfer, supported by diagnostics rather than a direct measurement of a model’s training distribution.

The harness controls the shape of the task

A conventional agent often sends its growing history back to the model at every turn. The prompt accumulates the original request, retrieved material, tool output and previous decisions. That can work for a while, but a longer history also changes the input the model must reason over. The paper calls this trajectory-as-a-prompt design: the neural model has to learn the next action from an ever-changing transcript.

An RLM changes that boundary. It stores the full context as a variable in a REPL. The root model sees a short description and can write code to inspect, split or search the variable. It can then call another model on selected snippets and keep intermediate results in the environment instead of appending every detail to the root prompt. A long task may still require many operations, but the root model can reuse a compact pattern such as inspect, choose a slice, ask a focused question, store the result and continue.

Think of a support agent asked to compare a year of incident reports. A transcript-based agent may carry report after report into one conversation. A harness could keep the files outside the model, use code to select relevant records, ask bounded questions about each group, and combine the answers. The example describes a possible design, not an experiment from this paper. Whether it is better depends on the task, the quality of the decomposition and how the system checks the pieces before combining them.

Why training the harness changes the question

The researchers train language models while they operate inside harnesses. The learned behavior is still in model weights; the harness is the program that determines the inputs, tools and sub-calls available during training and evaluation. This distinction matters. The paper is not claiming that an untrained wrapper automatically makes any model generalize. It investigates whether a model trained to decompose work through one harness can reuse that behavior when the task grows or its subject matter changes.

The authors compare several setups, including a base model that receives the task directly, harnesses with context offloading and code, and an RLM with programmatic sub-calls. They train on shorter versions of tasks and evaluate on longer variants. They also train on one domain and test in another domain chosen to share a solution structure. The transfer question is therefore specific: can a learned decomposition strategy travel when the surface text, length or domain changes, while smaller model calls handle the local content?

What the length and domain experiments show

In six length-generalization settings, training uses short tasks and evaluation uses longer versions, from two to 64 times the training context length. One example trains on a 32,000-token OOLONG split and evaluates on a 256,000-token split. The paper reports that the RLM’s evaluation reward often tracks its training trend more closely than the base Transformer’s. Code-based methods also transfer well on tasks with clear programmatic solutions. On denser tasks that require many local judgments, the authors report stronger results from combining decomposition with sub-model calls.

The domain experiments ask whether a strategy can transfer when the vocabulary and subject change but the structure remains similar. For example, the paper compares ranking-style work across writing and math material, and other pairs with different content but related decomposition patterns. The RLM generally transfers more strongly in the selected experiments. This is not evidence that a model trained on one arbitrary domain will perform well in another. The shared structure is a key condition, and the results vary by harness and task.

The authors also show why a harness name is not a guarantee. Reinforcement-learning training on short tasks improved the average score for one base model by seven points, but improved another by only 2.4 points; token use moved in different directions as well. The learned policy depended on its starting model. A system can learn behavior that works on its training tasks without learning a reusable decomposition. The paper’s distinction between training reward and held-out evaluation is more useful than treating a successful training run as proof of generalization.

Synthetic training tries to teach one reusable move

For messier long-context tasks, the authors introduce surrogate harness training. They construct synthetic environments that do not reuse the evaluation task content but are designed to exercise a candidate decomposition. Some training environments use cheap or simulated tools and sub-calls. The idea is to teach the root model how to organize work without paying for a complete, expensive rollout of the real task each time. The model is then evaluated on held-out tasks with real context and calls.

The paper reports 8,015 root-only synthetic rollouts across eight environments, plus 1,465 sub-agent rollouts for one setting. A model called RLM-27B, produced by supervised fine-tuning Qwen3.8-27B on synthetic traces, averaged 58.5 across the selected long-context benchmark suite. The Qwen3.8-27B base model in the same RLM harness averaged 46.1. The difference is 12.4 score points, or 26.9 percent relative to the baseline score. Each benchmark contributes its own task metric, so this is an average of scores rather than a pooled accuracy over one common set of questions.

On the same evaluation runs, the paper reports an average of 6.5 root turns for RLM-27B versus 18.4 for the base Qwen3.8-27B in the RLM harness. Summing the reported input and output tokens across root and sub-calls gives about 385,000 versus 721,000 per trajectory, roughly 1.9 times fewer tokens for the trained model. Its output-token total is higher, however, and token counts do not tell you wall-clock time, monetary cost or the quality of a production service. The result is evidence about these models, harnesses and benchmarks, not a general efficiency promise.

Recursion adds another layer of composition

A final experiment asks whether a learned solver can itself be called as a component. The researchers select 87 tasks the trained RLM handles well, then create a chain of four tasks where each correct answer reveals the next task. The regular RLM solves all four in 55.2 percent of sampled chains. Giving it a simple recursion hint lowers that figure to 47.2 percent. After additional synthetic training on recursive behavior, the full-chain solve rate reaches 77.5 percent in this constructed setup. The difference shows that a high-level instruction to recurse was not enough; the behavior had to be trained and evaluated as part of the harness.

How to evaluate a harness claim in your own software

If you are building a coding agent, research assistant or another long-running software feature, the paper suggests a practical evaluation plan. Start by writing down the task structure your product expects to repeat. Decide what stays in application state, what the root model must decide, what can be delegated and what evidence makes a sub-answer safe to combine. Keep this architecture explicit enough that you can compare it with a simpler baseline.

  • Hold out longer tasks: train or tune on short examples, then test longer instances with the same underlying goal.
  • Change the domain while preserving a known structure, and separately test tasks that do not share that structure.
  • Compare the base model, a simple context-offloading setup and the full harness using the same held-out tasks.
  • Remove one mechanism at a time, such as code-based inspection or sub-calls, to see which component changes the result.
  • Measure task success, errors in delegated work, root turns, total input and output tokens, latency and actual cost.
  • Publish the task split and failure cases so a result cannot be explained only by examples that resemble training data.

Treat synthetic tools as a way to train or test a specific behavior, not proof that the real tool path works. A fake sub-call can help isolate the root model’s planning pattern, but it cannot establish that a live service returns reliable data, respects permissions or stays available. Those boundaries need their own integration tests. Our separate guide to testing an AI agent harness covers observable state, retries and real-provider checks; this article addresses the different question of what harness design may contribute to learning and transfer.

A harness should also make it possible to inspect and correct its decomposition. If it makes hundreds of sub-calls, repeats a faulty split or combines contradictory answers, the top-line score can hide operational problems. Give the application explicit limits, provenance for intermediate results and a way to surface uncertainty. These are engineering recommendations for turning the research idea into a product; they are not claims tested by the study.

What remains unproven

This is a research preprint, not an independent evaluation of production agents. Its strongest numbers come from a selected suite of eight long-context benchmarks and a specific training recipe built around Qwen models and RLMs. Transfer changes with the base model, task and harness. The paper’s locally-in-distribution explanation is supported by similarities in root trajectories and sub-task performance, but those diagnostics do not directly reveal what data the model saw during pretraining. Its synthetic environments are designed with knowledge of the target task families, so they should not be confused with zero-knowledge transfer to arbitrary work.

The sensible conclusion is narrower and still useful: agent behavior is shaped by both model weights and the program that decides what the model sees and can do. For some tasks, context offloading and explicit decomposition let a model reuse a strategy on longer or structurally related work. The next question for a maker is not whether harnesses replace models. It is which task boundaries your software can define, and whether held-out evidence shows that your chosen harness helps the model cross them.

That kind of software is worth explaining as it develops. VIBPS is the social network for software, where makers can introduce an app, show how it works and give people a way to follow what they build next.

Source: Zhang, Chakraborty and Khattab, Language Model Harnesses Can Be Compositional Generalizers (paper and PDF, submitted November 20, 2026)

Source: Authors’ experiment code, configurations and released artifacts for the paper

Source: Alex Zhang, Language model harnesses are compositional generalizers (July 20, 2026; earlier author explanation)

Source: Zhang, Kraska and Khattab, Recursive Language Models (original RLM paper)

How to test an AI agent harness before shipping it

How to design an AI code review system maintainers can trust

Introduce your app on VIBPS

Built around one question: what happens when software becomes easy for almost anyone to create?

Explore apps