Harness Adapters: How Hugging Face Tunes Open Models to Your Agent Harness
Hugging Face trains RL-based LoRA "harness adapters" for Qwen3.8-27B, boosting accuracy and cutting tokens inside Pi, OpenCode, and Hermes agent harnesses.

What is a harness adapter?
A harness adapter is a small LoRA (low-rank adaptation) fine-tune trained with reinforcement learning to make an open model perform better inside one specific agent harness. Hugging Face built this approach for Qwen3.8-27B, training separate adapters for the Pi harness, the Hermes agent harness, and OpenCode. Instead of retraining the whole model, they freeze the base weights and train a lightweight set of extra parameters on top, tuned to the exact tool names, system prompts, and context-handling quirks of each harness. The result: higher task accuracy and sharply fewer tokens burned per task.
TL;DR
- Harness choice changes scores dramatically even with identical model weights: Hugging Face cited one case where the same model scored 62% under one harness and 33% under another, purely from scaffolding differences.
- Qwen3.8-27B with a Pi-trained adapter jumped from 40% to 64% on hard SWE-bench Pro tasks, and from 40% to 56% on Terminal Bench 2.1.
- Efficiency gains were as notable as accuracy gains: on Pi/Terminal Bench the adapter hit 55% accuracy using about 1,500 tokens per task versus roughly 2,900 for the base model, and across harnesses tool calls dropped 53 to 72% on tasks both versions solved.
- The gains come mostly from the model reasoning less and calling fewer tools, not from fundamentally new problem-solving ability; training curves showed correctness on training tasks stayed roughly flat while rollout length shrank.
- Training happened inside real Docker containers running the actual harness, unmodified, using a framework called Harbor (from the Terminal Bench team) plumbed into an RL environment via a token-capturing proxy, with an async GRPO trainer in TRL.
- Each adapter trained on just two B200 GPUs (one for inference serving, one for training), far below frontier-lab compute budgets.
- A combined “super adapter” stacking all three harness-specific LoRAs averaged 49% across six harness/benchmark combinations, up from a 39.5% base, and transferred surprisingly well: a Pi-trained adapter run under OpenCode scored 54%, beating OpenCode’s own specialist adapter at 52.4%.
Why does the same model perform so differently across harnesses?
A harness is the scaffolding around a model: the system prompt, the tool definitions, how context gets trimmed or summarized, how reasoning turns are kept or discarded. Qwen3.8-27B is trained as a generalist, good at a wide spread of tasks but not optimized for any particular agent loop. Drop it into Pi, OpenCode, or a Hermes-based harness and it has to improvise its way through unfamiliar tool names and context rules each time.
Hugging Face pointed out a concrete example: the Pi harness discards early reasoning turns as a task progresses, while OpenCode and Hermes keep them. That single difference means the model is effectively solving the same problem with a different memory of its own earlier thinking depending on which harness it’s running in. Multiply that by differences in tool naming conventions and prompt structure, and a model tuned for general use ends up navigating a different “walk” to the same destination in each harness. This is the same problem proprietary labs solve by shipping a model and its harness as one package. Anthropic has described doing this with Claude Code, OpenAI with Codex, and even DeepSeek has been reported experimenting with harness-specific tuning. Open model users typically get none of that coordination unless they build it themselves.
How does Hugging Face train these adapters?
The core method is reinforcement learning run inside the real harness, not a generic reimplementation of an agent loop. Each harness runs unmodified in a Docker container, exactly as it ships, inside a sandbox. A proxy sits in the middle, capturing the exact tokens the model generates during rollouts, and that trace feeds into a VLM-based training setup. The infrastructure is built on Harbor, a framework from the team behind Terminal Bench, with Hugging Face’s own integration turning it into a usable RL environment. Training itself uses an asynchronous GRPO trainer implemented in TRL (Hugging Face’s RL training library).
The training data matters as much as the method. The tasks are real software engineering problems: bugs injected into Python and Go repositories, actual GitHub issues, and tasks derived from merge/pull requests. Before training, the base model attempted each task multiple times, and any task it always solved or never solved got thrown out. That filtering matters for GRPO-style training: if every attempt on a task gets the same score, there’s no gradient signal to learn from. The method works best on tasks the model can sometimes solve, where the goal is to raise that hit rate toward consistency.
The reward signal combines a binary “did it pass verification” check with a small bonus for using fewer tool calls. That second piece explains why the adapters end up more efficient, not just more accurate. The efficiency isn’t a side effect, it’s something the reward function explicitly pushes toward.
What actually improved: smarter reasoning or just less of it?
The honest answer, based on the training curves Hugging Face published, is mostly the latter. Correctness on the training tasks stayed roughly flat over the course of training. What changed was rollout length: the model learned to stop overthinking and stop calling extra tools, converging on answers faster rather than reasoning its way to fundamentally better answers. That’s consistent with a broader trend across model releases, where labs have focused on trimming excess reasoning steps without sacrificing output quality (OpenAI’s move from GPT-5.0 to 5.1 followed a similar logic). It also suggests harness adapters would be worth benchmarking directly against other “shorter reasoning” fine-tunes of the same base model to see how much of the gain is harness-specific versus a general fix for overthinking.
How big are the real-world gains?
The numbers vary by harness, and Hugging Face cautions against comparing across harnesses directly since each starts from different default settings. Within each harness, though, the jumps are substantial:
- Pi: SWE-bench Pro hard tasks went from 40% to 64%; Terminal Bench 2.1 went from 40% to 56%.
- Hermes: SWE-bench Pro went from 29% to 43%; Terminal Bench went from 45% to 59%.
- OpenCode: one benchmark went from 35% to 51%; another from 48% to 52%.
Across the board, on tasks both the base model and the adapter solved, the adapters used 53 to 72% fewer tool calls. For anyone running local inference at limited tokens-per-second, or paying per tool call on a hosted harness, that efficiency gain translates directly into time and cost savings, independent of the accuracy bump.
Is it worth trying harness adapters if you don’t use Pi, Hermes, or OpenCode?
Possibly, yes. The most striking transfer result came from running the Pi-trained adapter inside OpenCode: it scored 54%, beating both the OpenCode base model (44.8%) and OpenCode’s own specialist adapter (52.4%). That suggests the training captures something more general about efficient tool use and reasoning discipline, not just harness-specific tricks. If your team runs a different harness entirely, the “super adapter” that stacks all three (averaging 49% across six harness/benchmark pairs) is a reasonable starting point to test before assuming you need a bespoke one. Hugging Face also notes results shift depending on whether a harness runs the model with thinking (extended reasoning) turned on or off, so any adoption should include testing both settings against your own evals rather than assuming one fixed configuration.
Frequently Asked Questions
What is the base model used in Hugging Face’s harness adapter research?
Qwen3.8-27B, an open model from the Qwen family, trained as a generalist and not customized for any specific agent harness by default.
What’s the difference between a harness adapter and fine-tuning the whole model?
A harness adapter is a LoRA: a small set of additional trainable weights layered on top of a frozen base model. It’s far cheaper to train and store than a full fine-tune, and multiple adapters (for different harnesses) can be swapped in or stacked without touching the base model.
Why do token counts drop so much with harness adapters?
The reward function used in training includes a bonus for solving tasks with fewer tool calls, and the training data filters out tasks the model always or never solves. This combination pushes the model toward resolving tasks faster, with shorter reasoning and fewer redundant tool invocations, rather than teaching it new problem-solving strategies.
How much compute does training a harness adapter require?
Hugging Face trained each adapter using two B200 GPUs, one running inference (VLM) and one running the training process. That’s modest compared to frontier-lab training budgets and within reach of a team with specific internal tasks to optimize for.
Can one harness adapter work well in a harness it wasn’t trained for?
4 hours from idea to a live business app.
Free live class · Wed, Dec 2
In at least one tested case, yes. An adapter trained for the Pi harness, when run inside OpenCode, slightly outperformed OpenCode’s own specialist adapter. A combined “super adapter” stacking all three harness-specific LoRAs also performed reasonably across harnesses it wasn’t individually tuned for, though below the specialist versions.



