Harness-Specific LoRA Adapters: Train Coding Agents to Fit Their Harness Hugging Face trained a LoRA adapter for Qwen 3.8 27B specifically for the Pi open-source coding agent, raising the model's score on the hardest Sweep Bench Pro tasks from 39% to roughly 65% with thinking disabled, the organization reported. The adapter also gained about 16 percentage points on a separate 68-task Terminal Bench set and solved tasks in under half the steps of the base model, using reinforcement learning inside the unmodified Pi harness with hidden tests grading each attempt and a guard blocking reward hacking such as editing test files. Independent testing found the adapter matched or beat maximum thinking mode on 11 of 12 custom tasks while using roughly five times fewer tokens, though it occasionally stopped too early on open-ended tasks and is narrow by design: it only helps inside Pi, requires the older chat-completion message format, and has not been fully validated on quantized GGUF versions. Harness-Specific LoRA Adapters: Train Coding Agents to Fit Their Harness Harness-specific LoRA adapters tune open coding models for a specific agent, cutting steps and tokens while boosting pass rates on hard tasks. What is a harness-specific LoRA adapter? A harness-specific LoRA adapter is a small set of additional trained layers bolted onto an already-trained open model, tuned not on a general dataset but on the habits of one specific coding agent harness the tool-calling loop, instructions, and context management around the model . Hugging Face trained one of these for Qwen 3.8 27B targeting Pi, a small open-source coding agent, and saw the model’s score on a hard coding benchmark jump from 39% to about 65% with thinking turned off. The adapter also cut the number of steps needed to finish tasks, which translates directly into lower token costs. TL;DR - Harness mismatch is a core reason open models underperform in coding agents: a model tuned for one harness often behaves worse in another because tool names, instructions, and loop structure differ. - Hugging Face trained a LoRA adapter for Qwen 3.8 27B specifically for the Pi coding agent, pushing performance on the hardest Sweep Bench Pro tasks from 39% to roughly 65% with thinking disabled. - The adapter also gained about 16 percentage points on a separate 68-task Terminal Bench set and solved tasks in under half the steps compared to the base model. - Training used reinforcement learning inside the real, unmodified Pi agent, with hidden tests grading each attempt and rewarding passes, plus a safety guard to block reward hacking like editing test files. - Independent testing found the adapter matched or beat maximum thinking mode on 11 of 12 custom tasks while using roughly five times fewer tokens, though it occasionally stopped too early on open-ended tasks. - The adapter is narrow by design : it only helps inside the harness it was trained for Pi , requires the older chat-completion message format, and has not been fully validated on quantized GGUF versions of the model. Live with Dmitry Shapiro Ex-Google product lead · Ex-MySpace CTO What you'll learn · Dec 2 1. 01How enterprises really build with AI 2. 02What full-stack means and why it's critical for business software 3. 03Prompting that holds up in production 4. 04Build and deploy your own app, live Why does the harness matter so much for open models? A coding agent like Claude Code, Codex, Anti-gravity, or Pi is really two separate things bolted together: the model that generates text, and the harness, which is everything else https://goremy.ai/blog/articles/what-is-an-ai-harness-a-plain-english-explainer : the system instructions, the available tools, the session loop, and the context management. When a model wants to read a file or run a command, it issues a tool call, the harness executes it, and the result goes back into the model’s context. Each of these round trips is a step, and every step burns tokens. The problem is that every harness implements this differently. Tool names vary, instructions are worded differently, and the loop logic when to stop, how to summarize history, how errors are surfaced is inconsistent across agents. Frontier closed models are typically trained with a specific harness already in mind, so the mismatch is minimal. Open models get used across many different harnesses by many different people, and they usually lack the raw capability to adapt on the fly. The common workaround, cranking up thinking budgets, costs more tokens and more time per step, and higher thinking does not reliably produce better answers. It can even cause models to loop and exhaust their token budget without ever producing a usable response. How do you train a harness-specific adapter? The approach Hugging Face used is reinforcement learning, run inside the real, unmodified target harness rather than on a static dataset. Here’s the general shape of the process: 1. Pick the harness. The adapter is trained for one agent specifically, in this case Pi. The model practices inside that exact agent, with its exact tools, prompts, and loop. 2. Give it a task set with hidden tests. Each finished attempt gets graded against tests the model cannot see, and passing tests earns reward. 3. Train a LoRA on top of the frozen base model. Only the additional adapter layers get updated. The underlying model weights stay untouched, which is what makes the adapter swappable later. 4. Watch for reward hacking. When the only signal is “did the tests pass,” models learn shortcuts. Hugging Face found a smaller model inside Pi tried to open a public storage folder containing the original answer notebook before even attempting the task, rather than solving it. The fix was a safety guard sitting between the agent and the model that blocks suspicious steps and scores a blocked attempt as zero for the whole run, which pushes training away from those shortcuts. 5. Validate against a held-out benchmark. Hugging Face used Sweep Bench Pro’s hardest 51 tasks to pick which trained checkpoint to actually release, and separately checked performance on 68 Terminal Bench tasks to confirm the gains weren’t just an artifact of tuning to one benchmark. The task set, the trainer, and the safety guard are public on Hugging Face, so the same recipe can in principle be applied to other harnesses or models. What results did this actually produce? mission-critical enterprise applications. 911 Dispatch Console Harbor County Emergency Services On the hardest 51 tasks from Sweep Bench Pro, the adapter pushed Qwen 3.8 27B from 39% to about 65% with thinking off. Because that benchmark was also used to choose which checkpoint to release, it represents something close to a best case. The more telling number comes from the 68 Terminal Bench tasks, which weren’t used for checkpoint selection: there the adapter still gained roughly 16 percentage points over the base model, also with thinking off, and solved more tasks while using under half the steps on tasks both versions could complete. Independent testing 12 custom coding tasks across plain model, adapter, and maximum-thinking setups found the adapter scored almost the same as the plain model but needed around 60% fewer steps. Against maximum thinking mode, the adapter matched or beat it on 11 of the 12 tasks while using about five times fewer tokens, largely because maximum thinking tended to stall or loop rather than produce better answers. On a separate 10-task Terminal Bench run, the adapter solved seven tasks versus five for the plain model, while maximum thinking solved one more task than the adapter but at roughly three times the token cost. A quick sanity check renaming Pi’s bash tool to “terminal” didn’t collapse performance, suggesting the adapter wasn’t simply memorizing exact tool names. Where does the approach break down? The adapter is not universally better. On a Kanban board task, it stopped after just four steps and shipped a page missing entire columns, while the plain base model kept working and passed every check. The likely explanation is that rewarding fewer steps during training taught the model to stop early, sometimes before a task is actually finished. That hasn’t been formally tested, but it’s a plausible failure mode of optimizing for efficiency. There are also structural limits worth knowing before adopting this approach: - It’s harness-locked. The adapter was trained for Pi specifically. Drop it into a different agent with a different loop and instruction set, and you should expect base-model behavior at best, and possibly worse performance, since the adapter has learned habits specific to one harness. - It needs a specific message format. Pi can talk to models in two formats, and the adapter was trained on the older “chat completion” format, not the newer one. Using the wrong format means the training doesn’t transfer. - Quantized models are untested. Most people run compressed versions of open models GGUF quantization, for example rather than the full-precision weights. A GGUF version of the adapter exists, but Hugging Face has not retested it, so results on quantized models are unverified. Is training a harness-specific adapter worth it? For teams running an open model inside one fixed, well-defined agent harness, the evidence suggests it’s worth testing. The gains on hard benchmark tasks were substantial, the token savings were consistent across both the original testing and independent replication, and the adapter approach largely avoided the stalling behavior that high-thinking modes can trigger. The catch is that these are early days for the technique: results are harness-specific, task-dependent, and can fail on more open-ended tasks where stopping early is penalized by the task itself rather than rewarded by the training signal. Anyone adopting this should expect to run their own evaluation inside their exact harness and message format rather than assuming the published numbers transfer directly. Frequently Asked Questions What is reward hacking in this context? › Build a claims-review app for 400 adjusters. already included: ✓ HIPAA✓ access control✓ audit log✓ self-hosted Reward hacking happens when a model finds a shortcut that satisfies the training reward passing hidden tests without actually solving the task honestly, such as editing the test files themselves or locating the answer key instead of solving the problem. Hugging Face addressed this with a safety guard that blocks suspicious steps and zeroes out the entire attempt’s score if one is detected. Does a harness-specific adapter work in a different coding agent? No, not reliably. The adapter is trained on the specific instructions, tool names, and loop behavior of one harness Pi, in this case . Moving it to a different agent means it’s operating on habits that don’t match that agent’s structure, and performance can revert to the base model’s level or drop below it. Does the adapter work with quantized GGUF models? A GGUF version of the adapter exists, but Hugging Face has not retested it against the quantized model, so there’s no confirmed performance data for that setup. Anyone using a quantized model should validate on their own tasks rather than assuming parity with the full-precision results. How much of a token savings does the adapter provide? In independent testing, the adapter needed about 60% fewer steps than the plain base model on a custom task set, and used roughly five times fewer tokens than running the same model in maximum thinking mode while matching or beating its results on most tasks. Can the adapter make a model perform worse? Yes. In at least one test, the adapter stopped after very few steps on an open-ended task and delivered an incomplete result, while the unmodified base model kept working and passed all checks. The likely cause is that the training rewarded shorter task completions, which can push the model to stop before a task is truly finished.