Code Generation
~9 min readUpdated: November 2026

Qwen3.8-27B Pi-Adapted LoRA: Async-GRPO RL for Coding Agent Harnesses

Qwen3.8-27B Pi-Adapted Async-GRPO Coding Harness Architecture in Smoke Monkey

Qwen3.8-27B-pi-adapted (`harness-hub/Qwen3.8-27B-pi-adapted`) is an Apache-2.0 LoRA adapter trained via TRL Async-GRPO on 1,050 Harbor coding tasks to optimize Qwen3.8-27B specifically for the `pi` agent harness. With thinking disabled, it jumps from 39.2% to 64.7% on SWE-bench Pro (hard 51) while cutting generated tokens 4.5x.

Technical Review: Smoke Monkey Core Architecture Team
Tested on Node.js 18+ & BunTypeScript 5.x
Quick Answer & Executive Definition

Qwen3.8-27B Pi-Adapted LoRA: Async-GRPO RL for Coding Agent Harnesses: Qwen3.8-27B-pi-adapted (`harness-hub/Qwen3.8-27B-pi-adapted`) is an Apache-2.0 LoRA adapter trained via TRL Async-GRPO on 1,050 Harbor coding tasks to optimize Qwen3.8-27B specifically for the `pi` agent harness. With thinking disabled, it jumps from 39.2% to 64.7% on SWE-bench Pro (hard 51) while cutting generated tokens 4.5x. Designed as a zero-dependency, open-source TypeScript architecture under the MIT License with native Model Context Protocol (MCP) support and deterministic phase state machines.

Key Architectural Takeaways
Quick Implementation Exampleqwen3-8-pi-adapted-agent.ts
qwen3-8-pi-adapted-agent.tstypescript
import { createAgent } from '@smoke-monkey/harness';
const codingAgent = createAgent({
agentId: 'qwen38-pi-adapted-coder',
provider: 'custom',
baseUrl: 'http://localhost:8000/v1',
model: 'qwen3.8-pi',
workspacePath: process.cwd(),
permissions: {
read_file: 'allow',
write_file: 'allow',
run_command: 'ask',
},
sampling: {
temperature: 0.8,
topP: 1.0,
extra_body: {
chat_template_kwargs: { enable_thinking: false },
},
},
});
async function fixParserBug() {
const result = await codingAgent.run(
'Locate failing unit tests in tests/test_parser.py, patch the root cause, and run pytest to confirm zero regressions.'
);
console.log('Harness Output:', result.summary);
}
fixParserBug().catch(console.error);
Video Guides

Watch: Related Video Guides

DeepSeek's GRPO (Group Relative Policy Optimization) | Reinforcement Learning for LLMs

I Trained Qwen3-0.6B with GRPO — Building an Open Post-Training System

What Is Qwen3.8-27B-pi-adapted? Harness-Specific RL Fine-Tuning

Qwen3.8-27B-pi-adapted (harness-hub/Qwen3.8-27B-pi-adapted) is a rank-32 PEFT LoRA adapter trained with TRL Async-GRPO on 1,050 containerized coding and terminal tasks (scale800-harbor and termgrade-train-harbor) inside OpenEnv sandboxes. Rather than changing general knowledge, it adapts Qwen3.8-27B's tool-calling policy directly to the pi coding harness.

Instead of burning 34.8K hidden reasoning tokens per issue, the adapter learns concise ~160-token inter-call planning messages paired with targeted shell and edit tool calls. On SWE-bench Pro (hard 51), it prevents the 100-step budget exhaustion that caused 20 of the base model's 31 failures.

Paired Accuracy & Token-Efficiency Benchmarks

Evaluated under identical 100-step, 131,072-token context limits (temperature=0.8, top_p=1.0, text-only, enable_thinking: false), checkpoint step 160 matches or approaches maximum-effort xhigh thinking at a fraction of the compute.

Metric / BenchmarkQwen3.8-27B (No Think)Qwen3.8-27B (xhigh Think)Pi-Adapted (No Think)Delta vs Base (No Think)
SWE-bench Pro (hard 51)39.2%74.5%64.7%+25.5 pts (p=0.0023)
Terminal-Bench 2.1 (86 tasks)39.5%—55.8%+16.3 pts (p=0.0013)
Terminal-Bench 2.1 (83 matched)41.0%54.2%56.6%+15.6 pts
SWE-bench Pro Median Turns59 (paired 18)74 (paired 27)23 / 27-61% turns
SWE-bench Pro Median Tokens9.6k48.8k6.9k / 9.4k4.5x fewer vs `xhigh`
Terminal-Bench Median Tokens2.9k16.5k1.5k / 3.7k4.5x fewer vs `xhigh`

On Terminal-Bench 2.1, enabling xhigh thinking on the adapted checkpoint yields the exact same 56.6% score while generating ~4x more tokens, proving the policy already internalized optimal trajectory selection into direct tool calls.

Critical vLLM Flag for Hybrid Attention Prefix Caching

Qwen3.8-27B uses hybrid linear/attention layers; serving with vLLM requires `--mamba-cache-mode align` alongside `--enable-prefix-caching`. Without it, every agent turn re-prefills the entire conversation history.

Production Serving with vLLM LoRA, PEFT Merge & llama.cpp GGUF

Engineers can load the LoRA dynamically in vLLM, run the F16 LoRA (Qwen3.8-27B-pi-lora-F16.gguf) over a Q8_0 base GGUF in llama.cpp, or merge weights into a 54GB BF16 checkpoint via PeftModel.merge_and_unload().

bash
# 1. Serve dynamically with vLLM + aligned Mamba prefix caching
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 131072

# 2. Or serve locally with llama.cpp Q8_0 + F16 LoRA
hf download ggml-org/Qwen3.8-27B-GGUF Qwen3.8-27B-Q8_0.gguf --local-dir .
hf download harness-hub/Qwen3.8-27B-pi-adapted-GGUF Qwen3.8-27B-pi-lora-F16.gguf --local-dir .
llama serve -m Qwen3.8-27B-Q8_0.gguf --lora Qwen3.8-27B-pi-lora-F16.gguf \
  --chat-template-kwargs '{"enable_thinking": false}' -c 65536 --port 9931 --alias qwen3.8-pi

Why Harness-Adapted LoRAs Matter for Smoke Monkey Workflows

Open-weights 27B models often stall in multi-step coding harnesses because base RL optimizes for verbose chain-of-thought rather than concise read_file / edit_file / run_command loops. Pairing Qwen3.8-27B-pi-adapted with Smoke Monkey Harness cuts per-issue wall-clock time and token bills by over 4x while keeping execution strictly inside the OpenAI Completions API (openai-completions) rather than stateful Responses endpoints.

Google Search Questions & Answers

Frequently Asked Questions

Q:Should I enable thinking mode when running Qwen3.8-27B-pi-adapted?

No. The adapter was trained with thinking off (`enable_thinking: false`). Enabling thinking generates ~4x more tokens on Terminal-Bench 2.1 with zero accuracy gain (both score 56.6%).

Q:Why does vLLM need --mamba-cache-mode align for Qwen3.8-27B?

Qwen3.8-27B combines hybrid recurrent/Mamba-style state with attention. Passing `--mamba-cache-mode align` enables prefix caching across multi-turn agent tool calls instead of recomputing the full history every turn.

Q:Which GGUF quantization should I pair with Qwen3.8-27B-pi-lora-F16.gguf?

The authors recommend `Q8_0` (`Qwen3.8-27B-Q8_0.gguf`) because the LoRA was trained against BF16 weights; lower-bit quants exhibit progressively larger policy drift.

Q:How was Qwen3.8-27B-pi-adapted trained?

It was trained for 160 steps using TRL Async-GRPO over 750 `scale800-harbor` and 300 `termgrade-train-harbor` tasks in Harbor/OpenEnv sandboxes, combining verifier correctness with a 0.1 tool-efficiency reward.

Related Alternatives & Comparisons

Related Architecture Guides

View all guides

Build with Smoke Monkey Harness

Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.

npm install smoke-monkey-harness