Show the full transcript (1,779 words)
Most of the models that we use today are usually trained with a specific harness in mind, which are these coding agents around the model, like Antigravity, Claude Code, or Codex. And more increasingly, these harnesses play a critical role when it comes to the performance of the models themselves. And this is one of the biggest problems with open models. People usually try them under different harnesses. And if a harness is not tuned for that model, it's not going to give you optimal performance.
But what if you could train a small, harness-specific adapter on top of these open models? This is the exact idea that a team at Hugging Face tried. And as shown, the results are pretty incredible because with one of these adapters, Qwen 3.8 27B went from 39% to about 65% on the harness coding tasks they tested it on.
Now, before I show you how it works, let me show you a quick demo. I gave Qwen inside Pi, which is a small open-source coding agent, a bug hunting task with thinking off. Without the adapter, the model took 62 steps of reading files and running commands, and it edited the test files which the task told it not to touch at all. Then I loaded the adapter tuned for Pi, and it fixed every bug cleanly in just eight steps. This is a substantial improvement.
So training a harness-specific LoRA adapter does help, but it's not universal, because in some of my own tests, I was seeing some really interesting results. In one of the tasks, it was giving up way too early. So in this video, I want to show you how you can train your own harness-specific adapter and what kind of improvements you can expect, because I think harnesses are becoming more important than the raw intelligence of the models.
Now, one really interesting impact that I was seeing was that the model doesn't really use that many tokens if you use a harness-specific adapter with it.
Okay, so let's talk about the harness. A coding agent like Antigravity, Claude Code, or Pi has two parts. One is the model that is generating the outputs in the form of text. And then the harness is everything around it, which includes the instructions that goes into the model, the tools, the loop, the session history, context management, everything else other than the model.
Now, when the model needs a file or a command, it asks for a tool, and the harness is going to run or execute those tool calls, and then simply return the results in the context of the model. We call each of these round trips as a step, and each step costs tokens. Now, every harness treats tools in a different way. They use different names, writes instructions, and run its loops very differently. So the same model is going to behave very differently across these agents.
Now, frontier models are usually trained with a specific harness in mind. However, when it comes to open-source models, people try them in different harnesses, and since they are smaller models, they usually don't have the intelligence to deal with the complexities of different harnesses. So the usual fix is to use high-thinking modes with harnesses that the models haven't seen. But this is going to not only cost more tokens, but it's going to take more time on every step, and more thinking does not always mean better responses.
A team at Hugging Face decided to train harness-specific LoRA adapters on top of already pre-trained or fully-trained local open models.
Now, you probably have seen this concept of LoRA adapters, which are additional layers that you bolt on to an already-trained model, and the idea is that you only modify these additional layers during fine-tuning. So the Hugging Face team took the exact same concept, but rather than fine-tuning it on a specific dataset, they fine-tuned it or trained it for a specific harness, and they call it harness adapter. So essentially, a harness adapter is a LoRA trained for one agent. In this case, we're going to be looking at a harness adapter trained for Pi.
But here's the best part. You can have a server running that keeps the base model loaded, and then you can simply swap adapters per agent or per harness.
Now, the question is, how do you teach a model the habits of one specific harness or agent? So let's talk about how you would train one of these yourself. Hugging Face used reinforcement learning or RL where the model practices tasks repeatedly inside the real, unchanged Pi agent. Then they use hidden tests which grades each finished attempt, rewarding passes and the task set and the trainer they used are public on Hugging Face, along with a safety guard I'll get into in a second. So you can follow the same recipe for your own agent.
But there is a caveat. What happens when the only thing you reward is passing those tests? So we run into reward hacking. So when you only reward passing tests, the model can learn shortcuts like editing test files or finding answers, which is a classical example of reward hacking. Reward hacking is a big problem with both small and large models, but smaller models are more susceptible. So one example is that they used a smaller model inside Pi, and it tried to basically read the answers before they even started training. So a task was rebuilding a data science notebook, and its first step opened the public Hugging Face storage folder which had the original notebook.
So they put a guard called SafeAgents between Pi and the model, and they blocked every suspicious step. So blocked steps scores zero for the whole attempt, which pushes training away from these shortcuts. But the question is, does all of this actually make the model better at coding? So let's look at their results on the hardest 51 tasks of SWE-bench Pro, which tests real bug fixes, where that jump to about 65% came with thinking off.
Now, the first catch is that they used SWE-bench Pro to pick which saved version to release. This is basically an optimal checkpoint for that specific benchmark. But then, they also looked at 68 Terminal-Bench tasks, and on those tasks, the adapter still gained about 16% points, which is pretty good. Against the base model with thinking off, the adapter solved more tasks and needed under half the steps on tasks both were able to solve, which is actually pretty great. So using a harness-specific adapter can save you a bunch of tokens and improve the performance.
Okay, this sounds great in theory, but how exactly does it look in practice? So I decided to run some my own experiments. So I took the same harness-specific adapter from Hugging Face specifically designed for Pi, and then we ran a vanilla, plain model inside Pi along with this additional adapter. And I gave it 12 coding tasks with three different setups. So which are the plain model, the adapter, and the maximum thinking. Each setup got one attempt for task, so I would treat these results as early signals. If you want to account for variance, you want to run each task multiple times. So against the plain model, the adapter scored almost the same, but it needed about 60% fewer steps to get there. Now, maximum thinking is where things went wrong. In one of my earlier videos, I covered that the Qwen model can get into these looping problem, where it exhaust all its token budget in thinking without producing any answers. So the adapter matched or beat maximum thinking on 11 of the 12 tasks while using about five times fewer tokens.
So this shows you that actually this can help use fewer tokens, if not better performance.
Now, my tasks are mostly full apps, so I also ran 10 tasks on the Terminal-Bench, which is closer to what they used to train this thing on. Here the adapter solved seven tasks while the plain model solved five. Maximum thinking solved one more task than the adapter, but it used about three times the tokens to get there. I also renamed Pi's bash tool to terminal to check whether the adapter had just memorized tool names, and it kept its score on three of the four tasks I re-ran.
Now, let's talk about some of the misses. The adapter did not win everything, because on a Kanban board task, it stopped after just four steps, with a page that was missing the columns, while the plain model kept going and passed every check. So my guess is that the bonus for the fewer steps teaches it to stop early, though I have not tested that, and that brings us to the bigger limits you should know about this approach. First, it only works inside Pi, because another agent changes the instructions and the loop. According to Hugging Face, in a different agent or different harness, you should expect the base model's behavior, or in some cases, even worse with this harness-specific adapter. Now, the second limit is the setup. You'll have to keep thinking off, since turning it on with the adapter only adds token. So Pi can talk to models in two formats, and it has to use the older one called Chat Completions, because the newer one was not part of this training. Last, most people run a compressed version of these models. Say you're using a quantized version like a GGUF, right, instead of the full model. Now there is a GGUF adapter, but Hugging Face has not re-tested it, so I would check it on your own tests first. This seems to be trained on the full model, not on a quantized version. So with the quantized version, you might see different results.
So can training a model for its harness get you as far as giving it maximum thinking? The answer is mostly yes, at least for Qwen inside Pi. On my tasks, it matched or beat maximum thinking almost everywhere, mainly because thinking kept stalling it out. On Terminal-Bench, maximum thinking solved one more task than the adapter at a much higher token cost.
Anyways, this was a quick wrap up of the experiments. I'll highly recommend to check it out. It's a very interesting approach, but I think these are early days, so we'll have to wait for more. Anyways, I hope you found this video useful. Thanks for watching, and as always, see you in the next one.