2026-11-20 · 22 min · agents · harness · reinforcement-learning · grpo · lora · trl · huggingface · coding-agents · qwen · swe-bench
A 2:23 narrated explainer, drawn in code. Every number and picture in it is this article's own; the sources are below.
› transcript
The launch chart says a small adapter takes Qwen's twenty-seven billion parameter model from twenty-nine percent to sixty-three. The model card now says thirty-nine. Nine of the base model's runs had died on a broken network tunnel. Hi, I'm Banjo. I read the adapter's tensors and three model cards. Same task under pi. The adapter greps, reads, edits, tests, and is done in eight calls. The base model keeps probing with inline Python until it runs out of its one hundred. I read the adapter's header by range request. All sixty-four layers get an adapter on the MLP. Only sixteen get attention adapters. The other forty-eight are linear attention, whose names the target list never matches. Training runs pi itself, in a sandbox, on bug fixes and terminal tasks. vLLM keeps the exact tokens the policy sampled. The task's tests decide right or wrong. Eight rollouts of each task are compared. And the new adapter is loaded by name. The reward is one for passing the tests, plus at most a tenth for using fewer tool calls. GRPO compares the group. When some fail, being right is the whole signal. Once all eight pass, they differ only in how many calls they took. Normalised, that tiny bonus becomes the entire signal. Short solutions are pushed up hard. Tool calls per solved training rollout fall steadily in every run. Under pi, the hard half of SWE-bench Pro goes from thirty-nine to about sixty-five percent. Terminal-Bench goes from about forty to fifty-six, and holds on held-out tasks. Thinking at full effort still solves a little more on SWE-bench Pro, not significantly, at about five times the tokens. On a 3090, in a harness with other tool names, it never called a pi tool and solved seventeen of eighteen runs. Under pi, on easy tasks, it missed three the base solved, each time stopping after three or four calls. A harness adapter makes the model decisive in one agent. Whether it is more accurate depends on the agent. A small LoRA, a reward for passing and then for brevity. Thanks for watching! Every source is in the full article. I'm Banjo. Bye!
Why read this
Essentialtop 10%Reads the adapter's tensors, recomputes every card's sign tests, catches the post's stale numbers, and runs the adapter in a harness it never saw.
- Original, source-checked analysis
- Open and runnable
- Widely used
Agents & harnessesNeeds a workstation GPUPractitioner model
How this was scored
- Is it new?
- 2 of 3: A real new idea, method or capability
- Can I trust it?
- 3 of 3: Reproduces the headline result, or shows from primary files it is wrong
- Can I run it?
- 3 of 3: Open, permissive, runs on reader hardware with instructions
- Will I understand it?
- 2 of 3: Mechanism from first principles with figures
- Can I act on it?
- 2 of 3: A concrete recipe, numbers or comparison
- Will it last?
- 1 of 3: Relevant for months
- Does it affect many?
- 2 of 3: A widely used model, tool or lab release
- Only here?
- 3 of 3: The only place this analysis exists
Score 80 of 100, ranked 27 of 773 rated articles. Each question is answered 0–3 by hand, and a 3 is rare. How articles are scored
The chart in Clément Delangue's post says Qwen3.8-27B goes from 29% to 63% on the hard half of SWE-bench Pro once you add a small adapter trained for one coding agent, pi. The model card it links to says 39.2% to 64.7%. Both are from Hugging Face's harness-hub team. The card is the newer one, and the ten-point difference in the base model's score is a network tunnel.
That correction is the most useful thing about this release, and I will come back to it. The release itself is a clean idea. Take an open model, take the agent program people already run it in, and train a LoRA by reinforcement learning inside that program, unmodified, until the model speaks its dialect. Hugging Face calls the result a harness adapter. There are three for Qwen3.8-27B (pi, OpenCode, Hermes Agent) and twelve earlier ones: nine for Liquid AI's LFM models, three for TwIL-8B.
I read the card, the earlier harness adapters blog post, the training script in TRL, pi's source, and the adapter's tensors through HTTP range requests. I also ran the adapter on an RTX 3090 against the base model, under pi and under a small harness of my own with different tool names, to see what nobody had published: what it does outside pi. The card promises a fuller recipe in a second post, harness-adapters-at-scale, which still returned 401 when I finished.
- task
- image-text-to-text
- library
- peft
- license
- apache-2.0
- safetensors
- 1 shard
- largest file
- 637.6 MB
- files
- 12
- downloads
- 2.8K
- likes
- 1.0K
repo last modified 2026-11-21
The post's chart is an older card

The card's "Evaluation checks" section carries two corrections. The first is the one that moves the headline:
An earlier version of this card reported 29.4% → 62.7% on SWE-bench Pro. Nine of the base model's rollouts there had failed because the public tunnel between the sandboxes and the model server went down mid-run.
They reran every affected rollout on both sides. The base model went from 29.4% to 39.2% (20 of 51 tasks), the adapter from 62.7% to 64.7% (33 of 51). The gain shrank from 33 points to 25.5. It is still large. But a benchmark run where the sandbox loses its connection to the model counts as a model failure unless someone checks, and here the failures fell mostly on one side. Anyone comparing agent runs across a network should log transport errors separately from task failures; the card now does.
The second correction is about thinking mode. pi had capped each model call at 16k output tokens, which cut long reasoning short; rerun at 32k, both base and adapter reach 74.5% with thinking on. The thinking-off numbers were not affected.
The "55–62% fewer tool calls" panel also maps onto the card, loosely. The card's work table gives median turns on the tasks both models solve: 23 against 59 on SWE-bench Pro (61% fewer) and 8 against 18 on Terminal-Bench 2.1 (56% fewer). The card's own results figure prints 60% and 56%.
A harness is a dialect
A coding agent is a loop. It sends the model a system prompt and a list of tools, parses the reply for tool calls, runs them, appends the output, and asks again. Lilian Weng's framing of the loop around the model covers the general shape, and Prime Agent is an example of an agent that drops the tool-call schema altogether. What matters here is that every agent picks its own tool names, argument shapes, prompt and stopping rule, so the same weights face a different problem in each one.
pi's is small. I read earendil-works/pi (the npm package is @earendil-works/pi-coding-agent, at 1.5.2): its default tools are exactly four, read, bash, edit and write, set in settings-manager.ts as DEFAULT_TOOL_NAMES. edit takes a path and an array of {oldText, newText} replacements. Qwen3.8's chat template turns a tool call into XML (<tool_call><function=bash><parameter=command>…), and the server's parser turns it back into JSON for pi.
AI agent toolkit: unified LLM API, agent loop, TUI, coding agent CLI
- license
- MIT
- branch
- main
- forks
- 15.9K
- open issues
- 284
- source
- 35.3 MB
- commit date
- 2026-11-22
GitHub REST API, 2026-11-23 — branch, createdAt, description, forks, license, openIssues, pushedAt, stars
The base model's scores show how much the wrapper matters. The three Qwen3.8-27B cards evaluate the same base weights, with the same settings, on the same 51 SWE-bench Pro tasks: 39.2% under pi, 35.3% under OpenCode, 29.4% under Hermes Agent. On Terminal-Bench 2.1 the order flips: 39.5%, 46.4%, 44.7%. Nothing changed but the program around the model. The KAT-Coder report names this overfitting to a harness's action format and context structure. Hugging Face's own multi-harness RL guide found the same thing on a 2.6B model (62.1% under Mini-SWE-Agent, 33.2% under Claude Code), and the harness effect measured it on cost.
The base model's characteristic failure under pi is visible in the card's example trajectory. It does not fail by writing a wrong patch. It fails by not stopping.
The card counts it. On SWE-bench Pro, 20 of the base model's 31 failed attempts ended because it used up its 100 model calls; none of the adapter's did. A good part of what RL taught is when to commit to an edit and when to stop.
What the adapter file contains
The card says "a LoRA adapter". A LoRA leaves each weight matrix (shape ) frozen and learns two thin ones beside it:
adapter_config.json sets and , so the update is scaled by 2, on seven target names: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj. Each adapted matrix costs new parameters.
To see what was trained without downloading 638 MB, I read the first eight bytes of adapter_model.safetensors (the header length, 76,408) and then the JSON header itself by range request. It lists 512 tensors, all F32. They add up to 159,383,552 parameters, which is 0.574% of the base model's 27,781,427,952 (the parameter count the Hub API reports for Qwen/Qwen3.8-27B). At four bytes each that is the 637.5 MB the file weighs; the F16 GGUF version is 0.32 GB.
The surprise is where they sit. Every one of the 64 layers has gate_proj, up_proj and down_proj adapters. Only 16 layers have attention adapters: 3, 7, 11 and so on to 63.
Qwen3.8-27B is a hybrid. Its config sets full_attention_interval: 4, and layer_types lists 16 full_attention layers and 48 linear_attention ones. I range-read the header of the base shard that holds layers 0 to 3. A full-attention layer has self_attn.q_proj (12288 × 5120: 24 heads of 256, doubled for the output gate), k_proj and v_proj (1024 × 5120 each) and o_proj (5120 × 6144). A linear-attention layer (Gated DeltaNet) has none of those names. Its projections are linear_attn.in_proj_qkv (10240 × 5120), in_proj_z, in_proj_a, in_proj_b and out_proj. PEFT matches target modules by name, the names do not match, and so three quarters of the model's token mixing gets no adapter at all. By my count that is 5.56 billion parameters of linear-attention projections the RL run never touched.
The split, from the header: 138,412,032 parameters (86.8%) in the MLPs, 20,971,520 in the 16 attention blocks. The MTP layer the base model ships for speculative decoding has no adapter tensors either, nor does the vision tower. My guess, which I have not tested, is that serving the adapter with MTP speculation would accept fewer drafts, since the draft head still predicts the base model's next token.
Whether leaving out the 48 linear-attention blocks' projections was a choice or a side effect of copying a target list from a dense model, the card does not say. The earlier blog post trained its LFM adapters "on every linear layer (all-linear)"; this card lists seven names. It worked anyway, which says something about where an agent's habits live: mostly in the MLPs and the full-attention layers, or at least enough of them there to move 15 tasks.
How it was trained
The recipe is TRL's AsyncGRPO with the agent running inside the loop. The training script is examples/async_grpo_harbor in TRL. Tasks are Harbor tasks served through OpenEnv; each rollout runs pi, unmodified, in its own sandbox. pi's model requests go to the trainer's vLLM through a proxy that keeps the exact token ids and log-probabilities the policy sampled, so the trainer learns on what pi actually saw. tokin is a different implementation of the same need, and its article explains why re-tokenising a chat transcript does not give back the sampled ids.
| from the card | |
|---|---|
| Method | AsyncGRPO (TRL), LoRA r = 32, alpha = 64 |
| Tasks | 750 scale800 bug-fixing tasks (22 repositories, Go and Python, from SWE-smith and SWE-Gym) interleaved with 300 TermGrade terminal tasks |
| Rollouts | 8 per task, temperature 0.8, thinking off, up to 50 agent steps and 1,800 s each |
| Batch | 16 micro-batches of up to 65,536 tokens per step; rollouts up to 16 policy versions stale |
| Steps | 160 for this checkpoint, 1,919 task groups; the run was stopped at step 191 of 1000 planned |
| Learning rate | 2e-5 |
| Hardware | 2× B200 per harness: vLLM on one, the trainer on the other |
So roughly 15,352 rollouts went into this checkpoint (1,919 groups of 8), at most about a million tokens per gradient step. That is small for RL on a 27B model, and it is why a LoRA makes sense. The earlier blog post describes the serving side for its LFM runs: one vLLM holds the base weights once, each trainer loads its new adapter version into it by name after a gradient step, and rollouts started on the previous version finish on it.
The reward, and why the bonus is bigger than it looks
The card gives the reward as the verifier's correctness "plus a tool-efficiency bonus of weight 0.1". TRL's script spells out the shape:
TOOL_BUDGET = 15.0
def tool_efficiency(n_tool_calls):
return max(0.0, min(1.0, 1.0 - n_tool_calls / TOOL_BUDGET))
# in harbor_reward(): the bonus only on a correct rollout
if eff is not None and correctness >= 1.0:
reward += W_TOOL_EFFICIENCY * effThe script's default is W_TOOL_EFFICIENCY = 0.3; the card says this model used 0.1. With the script's TOOL_BUDGET of 15 (the card gives the weight but not the budget, so I am assuming it was kept), a correct rollout scores between 1.0 and 1.1, one with 15 or more calls gets no bonus, and a wrong one scores 0. The worked groups below use those values.
GRPO does not use the reward directly. It normalises within each group of 8 rollouts of the same task: the advantage of rollout is . Two groups show what that does (my arithmetic, population standard deviation):
- Three of eight correct, with 6, 9 and 12 tool calls: rewards 1.06, 1.04, 1.02 and five zeros. Advantages 1.33, 1.29, 1.25 and −0.77. The bonus barely matters; being right is everything.
- All eight correct, with 5, 6, 8, 8, 10, 12, 15 and 20 calls: rewards 1.067, 1.06, 1.047, 1.047, 1.033, 1.02, 1.0 and 1.0. Advantages +1.36, +1.08, +0.52, +0.52, −0.03, −0.59, −1.43 and −1.43. A bonus worth at most a tenth of a point becomes the entire signal, at full strength.
That second case is how a "small" efficiency term halves the turn count. Once the policy solves a task reliably, every further update on that task is about doing it in fewer calls. The multi-harness RL article worked through the same effect on an earlier version of this reward.
The earlier blog post adds the guard rail. Every tool call in training passes through safeagents, a reverse proxy that runs rule-based detectors before pi executes the call: writing the verifier's reward file, editing test files, curling a host that appears nowhere in the conversation, reading /tests/grader. A blocked call is replaced by a notice, the rollout scores 0, and since the token ids pass through untouched, GRPO pushes the attempt down. The post's example is from step 0 of a TwIL-8B run, before any update: the model went looking for the Hugging Face bucket the task's data came from instead of computing the answer. The card lists safeagents in this run's environment; it does not report how many calls it blocked.
What it buys under pi

All the card's numbers are one attempt per task under pi, thinking off, a 100-step budget, temperature 0.8 and top-p 1.0, with base and adapter under identical settings. They are explicitly not comparable with Qwen's own card, which uses other harnesses, maximum thinking, larger budgets and the full SWE-bench Pro.
The paired table is careful work. On SWE-bench Pro (hard 51), +25.5 ± 14.2 points: 15 tasks newly solved, 2 lost. On Terminal-Bench 2.1, 86 tasks graded, +16.3 ± 9.1: 16 newly solved, 2 lost. The p-values are exact sign tests on the tasks that changed outcome, and I recomputed them from the counts: 0.0023 and 0.0013, matching the card.
Two caveats the card states itself. Step 160 was picked by watching SWE-bench Pro and an 18-task subset of Terminal-Bench during training, so the SWE-bench number is not held out. The clean figure is the third row: on the 68 Terminal-Bench tasks not used for selection, 39.7% to 55.9%, 13 gained and 2 lost, p = 0.0074. And part of the gain is finishing inside the limits, as the budget count above shows.
The widget below puts all three Qwen3.8-27B adapters on one footing. Each dot is a task. The groups are arithmetic on each card's pass rates and its gained and lost counts, and each "both solve" count matches the task count in that card's work-per-task table, which is a nice internal check.
Thinking, priced
The card's headline tip is about reasoning, not the harness: with thinking off, the adapter roughly matches the base model thinking at maximum effort. On Terminal-Bench 2.1 (the 83 tasks all four runs graded) it is 56.6% against 54.2%. On SWE-bench Pro it is 64.7% against 74.5%; on the 17 tasks only one of them solves, the split is 6 to 11, p = 0.33. Ten points behind, not significant on 51 tasks, and cheaper: the base model with thinking generates a median 48.8k tokens per SWE-bench Pro task against the adapter's 9.4k, about five times as many, over 61 model calls against 21.
The card's work table shows where the tokens go. Against the base model without thinking, the adapter writes more visible text (3.5k content tokens per solved SWE-bench task against 0.6k: about 160 tokens of plain reasoning per turn against about 10) and takes far fewer turns. It learned to think out loud a little between calls, instead of either not at all or a 35k-token block. Turn thinking on for the adapter and it reaches the same 74.5% as the base model thinking, at several times the tokens.
Three adapters, three results
pi is the best of the three. The OpenCode adapter goes from 35.3% to 51.0% on SWE-bench Pro (11 gained, 3 lost, p = 0.057) and from 46.4% to 52.4% on Terminal-Bench (13 gained, 8 lost, p = 0.38). The Hermes adapter goes from 29.4% to 43.1% (p = 0.092) and from 44.7% to 58.8% (p = 0.029). I recomputed all six sign tests; they match the cards. Of the four non-pi results, only Hermes on Terminal-Bench clears 0.05. The OpenCode card leans on its 66-task held-out subset instead (+13.6 points, p = 0.035), which is fair, but on the full 84 tasks eight losses against thirteen gains is close to a coin.
The efficiency gains hold everywhere. On the tasks both solve, the OpenCode adapter needs 13 turns against 48 on SWE-bench Pro, the Hermes adapter 22 against 59. That is the part of the reward every run optimised once tasks were reliably solved.
So, for the family as a whole: harness adapters reliably make the model shorter and more decisive inside the harness they were trained in. Whether they make it more accurate depends on the harness, and with 51 to 86 tasks at one attempt each, a 6-point gain cannot be told from noise.
What it loses elsewhere
None of the three cards evaluates an adapter outside its own harness, or on any non-agent benchmark. A reader asked exactly this under the blog post on November 18 (would the model get confused if pi renamed a tool or one of its arguments?) and there was no answer when I read it. So I ran it.
The setup, on an RTX 3090 with llama.cpp v1.0.0: unsloth's Qwen3.8-27B-UD-Q4_K_XL.gguf as the base, with and without the adapter's F16 LoRA GGUF, thinking off, temperature 0.8 and top-p 1.0 as on the card, a 32,768-token window. That is not the card's setup (BF16 in vLLM, which the card says the GGUF was never re-checked against), so read it as what you get on one consumer card, not as a reproduction.
The tasks are six small Python repositories I wrote for this, each with a planted bug and a stdlib unittest suite: a size parser modelled on the card's human_to_bytes example, a paginator whose bug sits in a helper module, an LRU cache, interval merging, semver comparison and a quoted key-value parser. The prompt is the same everywhere: the tests fail, fix the source, do not touch the tests. A run is solved if the pristine tests pass afterwards. Each task ran three times per model per harness, 72 runs in all, every one inside a bubblewrap sandbox.
Two harnesses. One is pi 1.5.2, the adapter's own. The other is a loop of about 110 lines of Python I wrote with nothing in common with pi but the task: its tools are run_command, show_file, replace_text, create_file and task_complete, with argument names (cmd, filename, search) pi never uses, its own system prompt, and a 40-call budget. It counts every call to a tool that does not exist, and specifically any call named read, bash, edit or write.
| 18 runs each | solved | median tool calls, solved runs | mean tool calls, all runs |
|---|---|---|---|
| pi, base | 18 | 6 | 6.33 |
| pi, adapter | 15 | 4 | 4.83 |
| my harness, base | 16 | 8 | 12.17 |
| my harness, adapter | 17 | 7 | 7.0 |
The adapter never called a pi tool in the foreign harness. Zero calls to tools that do not exist, zero malformed arguments, zero unparseable calls, over 126 tool calls. The base model's two failures there were both the card's failure mode in miniature: 40 model calls without finishing, on the LRU cache and on semver. The adapter used 126 tool calls across its 18 runs against the base's 219. Whatever pi-specific prior the LoRA learned, a different set of names in the request overrides it.
Under pi the picture flips on accuracy. The base model solved all 18; the adapter solved 15. Its three misses (the size parser twice, the paginator once) look alike: three or four tool calls, one shell command, an edit, and a confident stop. The tests still failed when it stopped. Three misses on three tasks that changed outcome is a sign-test p of 0.25, so this is not evidence that the adapter is worse at pi on easy tasks. It is a look at the other side of the efficiency reward: a policy paid for finishing in fewer calls will sometimes finish before it has checked. On SWE-bench Pro that trade is a large net win. On a task the base model already solves in six calls, there is little to win and something to lose.
Perplexity barely moves. On 40 chunks of 2,048 tokens of wikitext-2 the base scores 5.8167 ± 0.06786 and the adapter 5.8307 ± 0.06803; on Python standard-library source, 1.6529 and 1.6530. A 0.574% low-rank update trained for 160 steps did not disturb what the model knows about text or code, at least as far as next-token likelihood can see.
The confound the cards leave open is still open. The training tasks are bug fixes in 22 repositories and terminal chores; the evaluations are bug fixes in other repositories and terminal chores. My tasks are too easy to separate "better at fixing bugs" from "better at pi": both models solve nearly all of them. What they do show is that the adapter is not tied to pi's vocabulary, and that its habit of stopping early travels with it.
Running it
The adapter is Apache-2.0. The card's vLLM command serves the base model with the LoRA on top:
vllm serve Qwen/Qwen3.8-27B \
--enable-lora --max-lora-rank 32 \
--lora-modules qwen3.8-pi=harness-hub/Qwen3.8-27B-pi-adapted \
--language-model-only --enable-prefix-caching --mamba-cache-mode align \
--enable-auto-tool-choice --tool-call-parser qwen3_xml --reasoning-parser qwen3 \
--default-chat-template-kwargs '{"enable_thinking": false}' \
--max-model-len 131072Three details in it are easy to miss. --mamba-cache-mode align is what makes prefix caching work on this hybrid model; without it, the card says, every agent turn re-reads its whole history. (Where eight harnesses put the cache breakpoint covers what pi itself does to keep its prefix stable.) Thinking is off by default because that is how the adapter was trained. And pi's provider entry needs "api": "openai-completions": without it pi uses the Responses API, which the adapter was never trained or evaluated with. That last one is the whole article in miniature. An adapter fitted to one path through one program is fitted to that path.
On a single 24 GB card the route is llama.cpp: a Qwen3.8-27B GGUF plus the 0.32 GB F16 LoRA GGUF, --lora on the command line. The card recommends a Q8_0 base (28.6 GB, so not on a 3090) and warns that "lower-bit quants drift further" from the BF16 weights the LoRA was trained on. The GGUF version has not been re-evaluated. I ran the UD-Q4_K_XL base (17.7 GB) with the LoRA on a 3090 at a 32,768-token window: nvidia-smi read 18,823 MiB after loading the base alone and 19,143 MiB with the adapter. Merging is a few lines of PEFT and gives an ordinary 54 GB BF16 checkpoint any engine can serve.
Where I land
The idea is right, and cheap enough that people will do it for their own agents. The blog's argument is that the sessions you already run with your agent are the raw material for its next adapter, and the pipeline it describes (scrub, rebuild each session as a verifiable task, train inside your harness behind a rule-based guard) is all open.
The pi result is real: two benchmarks, both significant, one of them on held-out tasks, with the traces published. The other two adapters are mostly an efficiency story, and I would describe them that way. My own runs answer the first worry I had: the adapter does not need pi's tool names, and it costs nothing measurable in perplexity. I would still want one number before swapping it in permanently: a real benchmark, SWE-bench Pro or Terminal-Bench, under a harness it was not trained in, since my tasks are too easy to show a gain. And I would want to know whether leaving 48 of the 64 layers' token mixing out of the adapter was a decision or an accident, and what an all-linear adapter would have done.
And the correction is worth keeping. A tunnel failed in the middle of an eval, nine rollouts died, and the first chart went out with them counted as model failures. The team found it, reran both sides, and wrote it down on the card. That is the bar for agent evals. Most launches do not clear it.
Sources and arithmetic
Read: the three Qwen3.8-27B adapter cards, the November 6 blog post and its comments, TRL's examples/async_grpo_harbor at main, pi's source at the current main, the scale800 dataset card. Measured from files: the adapter's tensor names, shapes, dtype and parameter count from the safetensors header (range request on commit 80d05c9), the base model's layer layout from its config and one shard header, all six sign tests and every task split in the widget from the cards' own counts. Arithmetic: the GRPO advantages and the 5.56B untouched-parameter count. Ran: the RTX 3090 comparison in "What it loses elsewhere" (llama.cpp v1.0.0, commit b1b770d, pi 1.5.2, 72 agent runs and four perplexity runs). The harness, the six tasks and the scorer were written for this article; the counts and perplexities are from its log.