AivexaNewsSearch
AI news for builders and product teamsChecked every hour

Introducing harness adapters: adapt your favorite model to your harness to improve performance and cost

Collected Nov 20, 2026

Hugging Face published a reproducible recipe for training LoRA adapters that specialize a model for a specific agent harness and task distribution, rather than for general performance. The reference experiment uses Qwen3.8-27B with reinforcement learning run inside the harness itself, across three harnesses: pi, OpenCode and Hermes Agent. The headline motivating result: on Terminal-Bench 2.1, the base model under the pi harness scores 39% pass@1 at an average of 2.9K tokens per task; freezing those weights and adding an RL-trained LoRA adapter lifts it to 55% pass@1 while cutting average token use to 1.5K. The authors attribute most of that gain to the model reasoning less, calling fewer tools, and solving tasks on the first attempt more often.

The work extends earlier Hugging Face experiments on multi-harness RL and harness adapters, which had covered data-analysis and code-building tasks. This round pushes to 27B parameters, harder real-world software engineering tasks, and three harnesses, with the main goal of sharing a reusable recipe others can apply to their own task, harness and model combinations.

One adapter was trained per harness. Training, datasets and agent rollouts all run on the Hugging Face Hub in Jobs, using TRL's AsyncGRPOTrainer, OpenEnv and Harbor. The trainers ship with ready-made Docker images that have the target harness pre-installed: pi 1.5.2, OpenCode 2.2.7 and Hermes Agent v0.22.6. A proxy between the harness and vLLM records the exact tokens the harness produces, so training uses the real shipped agent loop rather than a reimplementation written against the framework's own interface. The authors place this in the same line of work as Agent Lightning v1.0 and SkyRL's Harbor integration.

Building the task set was a substantial part of the effort. RL needs tasks an agent can attempt, a verifier that scores each attempt, and evidence the verifier is right. A broad Hub search for Harbor-format environments returned roughly 59,000 tasks, which were filtered down to two training-oriented Hub sources plus a generated third set. SWE-smith injects bugs into real Python and Go repositories with LLM rewrites or mutations such as a flipped operator, and the catching tests become the task's tests; it adds volume. SWE-Gym, packaged as Harbor tasks in TaskTrove, converts real GitHub issues and their merged fixes into tasks; it adds realism. Tasksmith generates tasks from merged pull requests, with an LLM agent writing the instruction and tests and checks requiring the reference and a valid alternative to pass while the unfixed code and a known-wrong solution must fail. Targeting skills tested by Terminal-Bench 2.1, a hard subset of SWE-bench Pro, and DeepSWE, Tasksmith produced 24 tasks across 10 Python repositories from 30 merged pull requests. A metadata screen then dropped duplicates, non-training tasks, the 253 tasks in the target benchmarks, and tasks from repositories those benchmarks use.

Validation ran the semantic checks in openenv validate against every candidate in fresh trials: the reference solution must earn the maximum reward, doing nothing must score clearly lower, no canary may beat doing nothing, and replaying the reference must give the same reward. Each trial ran as its own Hugging Face Job. Of 1,127 Hub candidates, 858 passed; wrong-answer controls caught defects, including a Tasksmith task that accepted an incomplete implementation and a Terminal-Bench 2.1 verifier (regex-log) that accepted known-wrong answers. Most failures were infrastructure issues such as images that failed to start, and rejected tasks are kept in a separate split with the failing check recorded.

A separate difficulty filter matters because GRPO scores each attempt relative to other attempts at the same task, so a task every attempt solves or every attempt fails yields no learning signal. Qwen3.8-27B attempted each of 442 scored tasks four times, or eight times for a stratified sample. It solved 151 every time and 120 never; the 171 intermittent tasks form the qualified set. The model solves most Go tasks every time, fails all attempts on more than a third of SWE-smith Python tasks, and lands in the middle on 73% of SWE-Gym tasks. Overall, 1,127 tasks were filtered to 278 included directly, while 522 rejected tasks were repaired and made harder with Tasksmith and re-validated. The resulting dataset, harness-hub/agentic-coding-envs, holds 871 tasks from 35 repositories, capped at 40 tasks per repository.

Four short runs of up to 50 steps tested whether the filters change learning: unvalidated, validated, unqualified, and qualified task sets of 32 tasks each, all under OpenCode with up to 48 model calls, one 8×H200 Job, and verifier pass/fail as reward. For the final adapters, the team used TRL's stable AsyncGRPOTrainer, which does not wait for all rollouts before taking the next optimization step, attaching LoRA with the all-linear flag and turning thinking mode off during rollouts. The reward combined verifier correctness with a 0.1 tool-efficiency bonus. A learning-rate sweep found 1e-5 barely moved training correctness, 1e-4 collapsed rollouts (turns per rollout fell from 18 to 6 with entropy rising), and 5e-5 improved it but later destabilized, so final runs used 2e-5. Each adapter trained on 2×B200 GPUs, one for the vLLM server and one for training, with the token budget maxed out; as the model improved it fit more groups per step, diversifying each update's signal. The final mixture was 750 tasks from the harness-adapters RL environments and 300 from termgrade, interleaved by repository family so each step mixes many projects. A safeagents plugin, published as harness-hub/qwen-safeagents-plugin, blocked misbehavior during training, and blocked tool calls fell steadily across training steps.

Merging came next. The three adapters' weight updates have cosine similarity of about 0.01–0.02 with each other, so they barely interfere and are strong candidates for combining. Concatenating along the rank dimension (PEFT's combination_type="cat") gives a rank-96 super-adapter that applies the sum of the three updates. Because prior merging work finds scaled updates help, the team compared weights of ⅓, ½ and 1 on all 89 Terminal-Bench 2.1 tasks under each harness. The plain sum made agents very short (13 tool calls per task versus 49 for the base model); Hermes peaked at 62.8% but pi fell back to base-model level. The ½ weight gave the best balance and was used to build the final super-adapter from checkpoints at pi step 160, hermes step 160 and opencode step 150.

Results: with thinking off, the super-adapter beats the base model on all six harness–benchmark pairs, mean pass@1 39.5% to 49.0%, with 71 tasks newly solved against 34 lost. Despite never being trained with thinking on, it is the strongest model evaluated with thinking on: against base thinking at the same effort it wins five of six pairs and ties the sixth (mean 55.5% to 63.5%, 67 newly solved versus 37 lost). The largest gains are on SWE-bench Pro, +16 points under hermes and +20 under opencode. Specialist adapters remain the better choice when thinking is off: each harness's own adapter leads on four of six pairs, most visibly under pi (64.0% versus 46.0% on SWE-bench Pro, 56.5% versus 48.2% on Terminal-Bench). The super-adapter is also far more efficient: with thinking off, on tasks both it and the base model solve, it makes 53–73% fewer tool calls and generates 44–60% fewer tokens per task. Training totaled 598 steps, 78,114 samples and 167M tokens, with no clear sign of saturation and training correctness roughly flat even as tasks are solved in fewer steps. The authors note the ½ weight was chosen on Terminal-Bench with step-120 adapters, so those numbers are slightly optimistic. All artifacts, including adapters, GGUFs, RL tasks and the safeagents plugin, are collected in a Hugging Face collection.

This suggests a practical shift for teams deploying agents: accuracy and cost are partly properties of the harness-model pairing, not of the model alone, and a relatively small LoRA run on in-domain tasks can move both at once. The efficiency numbers are arguably the more portable finding, since fewer tool calls and tokens translate directly into lower inference spend. A likely trade-off is specialization: a harness adapter or even the merged super-adapter will not automatically transfer to a different harness, and the recipe depends on well-validated verifiers, which the report shows can silently accept wrong answers. Inference: teams with a stable harness and a clear task distribution stand to gain most, while those still changing agent frameworks may find the maintenance cost outweighs the gain.

Why it matters: developers building agent products can now train a model to their own harness and workload rather than accept general-purpose defaults, with reported gains in both pass rates and token cost. The published dataset, trainer configuration, Docker setup and adapter-merging approach lower the barrier to reproducing this, though the effort hinges on quality-controlled tasks and verifiers. For product teams, the headline is that harness-specific tuning can cut inference spend materially, making it worth measuring harness and model together rather than separately.

Read at Hugging Face Blog

Based on reporting from the original publisher. Visit the source for full context and later updates.

Publisher excerpt