How a small pi agent add-on lets Qwen3.8 match its thinking mode without thinking

harness-hub's LoRA adapter for Qwen3.8-27B trains the model inside the pi coding agent with reinforcement learning. With thinking off it reaches the score of the highest thinking setting while writing 4.5 times fewer tokens. The training steps, the measurements and how to try it.

Paylaş
How a small pi agent add-on lets Qwen3.8 match its thinking mode without thinking

"Thinking mode" has become a familiar switch on AI models: turn it on and the model reasons at length before answering, solves harder problems and pays for it in thousands of extra words. Qwen3.8-27B-pi-adapted, published on Hugging Face on November 16, approaches that trade-off from another angle. A small add-on for Alibaba's open model Qwen3.8-27B gets the model used to working inside one specific coding agent. The result stands out: with thinking off, the model matches its own thinking mode at the highest setting and writes about 4.5 times fewer tokens per task.

The add-on comes from a team working on Hugging Face under the name harness-hub. Members of the organization include Hugging Face staff, and the training was done end to end with Hugging Face's open tools: the TRL training library, the OpenEnv environment server and Hugging Face's cloud sandboxes. The Qwen team released the base model; the add-on is this team's work. The model card says the full recipe will be shared in an upcoming blog post. The add-on is open under Apache 2.0.

The idea: fitting the model to the agent

A coding agent is a working setup built around a language model. The model reads files, runs commands, checks test results and picks the next step. Each agent has its own tool names, command format and habits. A general model works in all of them without being fully at home in any; like an experienced hire in their first week, it searches for the same file again and again and makes needless attempts.

pi is a minimal, extensible open source coding agent from Earendil. It leaves out features such as sub-agents and plan mode by default and lets users grow it with extensions and skills. harness-hub asked a simple question: what happens if the model is trained inside exactly this agent, with exactly its tools? The answer is a LoRA adapter. LoRA trains small extra tables added inside a large model instead of retraining the whole model. The base model stays as it is and the adapter sits on top as a separate file.

What the measurements show

All results were measured inside pi with one attempt per task and a 100-step budget, base model and adapter always under identical settings. With thinking off:

  • The 51 hardest SWE-bench Pro tasks: base model 39.2%, adapter 64.7%. The adapter solves 15 new tasks and loses 2 the base model solved.
  • Terminal-Bench 2.1 (86 tasks): from 39.5% to 55.8%, with 16 new solves and 2 losses.
  • Against thinking: at its highest thinking setting the base model scores 64.7% on SWE-bench Pro and 54.2% on Terminal-Bench 2.1. The adapter reaches 64.7% and 56.6% without thinking.

The bigger difference is the amount of work. On tasks both solve, the adapter needs fewer than half the base model's turns. Against the thinking base model on SWE-bench Pro, median generated tokens per task fall from 34,400 to 7,900 and model calls from 48 to 21. The card shows an Ansible bug as an example: the base model keeps searching and re-running snippets until it hits the 100-step limit, while the adapter finds the function, edits it, runs the tests and fixes the last case in 8 tool calls.

The team also notes that turning thinking on for the adapter adds no accuracy and multiplies tokens by about four, so thinking off is the recommended setup. These numbers cannot be compared with those on Qwen's own card, which uses other agents, larger budgets and the full SWE-bench Pro.

How it was trained

The method is reinforcement learning: the model attempts tasks, earns a reward when it solves one correctly and gradually strengthens the behavior that earns rewards. The team used TRL's experimental AsyncGRPO trainer. GRPO generates several attempts for the same task and learns by comparing them; the async version runs generation and training at the same time so neither waits for the other.

Tasks were packaged in Harbor format and served through OpenEnv. Each attempt runs in a Hugging Face cloud sandbox, in a container with pi installed and network access locked, and the agent's tool calls were screened by Hugging Face's safeagents. Training data came from two sources: 750 bug-fixing tasks from 22 Go and Python repositories (scale800) and 300 TermGrade terminal tasks, interleaved; 1,919 task groups were processed up to the released checkpoint.

The reward is based on the task's verifier, meaning the tests pass, plus a small tool-efficiency bonus with a weight of 0.1, so attempts that use fewer, better-aimed tool calls earn slightly more. Eight attempts were generated per task, each limited to 50 agent steps and 30 minutes. The LoRA has rank 32 and alpha 64 and covers all attention and feed-forward projections. The learning rate is 2e-5. Each agent used two NVIDIA B200 GPUs: one generating attempts with vLLM and one running the trainer.

The run was stopped at step 191 of 1,000 planned, and the released version is the step 160 checkpoint, chosen from SWE-bench Pro scores and an 18-task subset of Terminal-Bench 2.1. The team also measured the 68 Terminal-Bench tasks not used for that choice, where the score rises from 39.7% to 55.9%. The training script is open in the TRL repository as examples/async_grpo_harbor.

The team documented its own mistake

One of the most useful parts of the card is a correction. An earlier version reported 29.4% to 62.7% on SWE-bench Pro. Nine of the base model's attempts had failed because the public tunnel between the sandboxes and the model server dropped mid-run. The team now checks every attempt for this, reran all affected attempts on both sides and reports corrected numbers. It also checked whether agents touched test files and explains that grading resets test files to the official tests, so this cannot affect scores.

How to try it

The adapter can be served on top of the base model with vLLM, and the card gives the evaluation command and the lines to add to pi's configuration. One detail matters: pi must use the openai-completions API, because the adapter was not trained with the other one. A GGUF version is available for running locally with llama.cpp on top of a GGUF of the base model. The 27-billion-parameter base model still needs a strong GPU or plenty of memory; the adapter changes behavior, not size.

On the same day the team released an adapter for the OpenCode agent, where SWE-bench Pro rises from 35.3% to 51% with thinking off and tokens per task drop six to eightfold. The team has earlier pi, OpenCode, Hermes and Claude Code adapters for LFM and TwIL models as well. The idea is turning into a method: small, swappable specialist add-ons matched to the agent in use.

These are the team's own measurements; they have not yet been reproduced independently, and they apply inside the pi agent.

Sources: Hugging Face model card, TRL async_grpo_harbor, pi, Qwen3.8-27B