A LoRA adapter for Qwen/Qwen3.5-9B, trained with on-policy RL (GRPO) inside the OpenCode harness: the model solved tasks as an OpenCode agent (running code in a sandbox, reading results, answering), and was rewarded only for getting the final answer right.
Measured in the same harness against the untouched base model on the same tasks:
| Qwen3.5-9B (base) | + this adapter | |
|---|---|---|
| Data analysis, 150 held-out tasks × 3, pass@1 | 78.7% | 86.9% (+8.2 ± 4.0) |
| Data analysis, pass@3 | 88.0% | 90.7% |
| Tasks better / worse / same | 33 / 7 / 110 | |
| Tool calls per attempt | 4.56 | 4.40 |
| Early-stop failures (≤2 calls, wrong) | 0 | 0 |
± is the 95% interval of the paired per-task difference.
This is the second harness in the same project. The Hermes Agent version is rlaope/Qwen3.5-9B-hermes-grpo-lora. The base model starts at the same level in both harnesses (78.7% in OpenCode, 79.1% in Hermes on the same 150 tasks), and RL inside each harness gives a similar gain (+8.2 here, +6.7 in Hermes).
OpenCode (or a similar tool-calling coding agent) driving Qwen3.5-9B on data-analysis work: load files, inspect them, compute with Python, answer with a single value. It solves more of these tasks without learning to quit early.
vllm serve Qwen/Qwen3.5-9B \
--language-model-only \
--enable-auto-tool-choice --tool-call-parser qwen3_coder --reasoning-parser qwen3 \
--enable-lora --max-lora-rank 32 \
--lora-modules opencode-grpo=rlaope/Qwen3.5-9B-opencode-grpo-lora \
--override-generation-config '{"temperature": 0.6, "top_p": 0.95, "top_k": 20}'
Then add it to OpenCode as an OpenAI-compatible provider (baseURL: http://<host>:8000/v1, model opencode-grpo). These are the sampling settings used for every number above.
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3.5-9B", torch_dtype="bfloat16", device_map="auto")
model = PeftModel.from_pretrained(base, "rlaope/Qwen3.5-9B-opencode-grpo-lora")
tok = AutoTokenizer.from_pretrained("rlaope/Qwen3.5-9B-opencode-grpo-lora")
HarnessAsyncGRPOTrainer, rollouts served by vLLM with live LoRA hot-swap, OpenEnv 0.7.0 Harbor server. OpenCode itself is unmodified. A capture proxy between OpenCode and vLLM records the exact sampled token IDs and log-probs, so the trainer learns from what the model actually generated, not from re-tokenized text.opencode agent, OpenCode 1.18.30, same container image for base and adapter.These are worth knowing if you train another model inside OpenCode with OpenEnv:
completion_tokens without the thinking tokens (it puts those in reasoning_tokens). OpenEnv checks that the trajectory matches the captured tokens, so every Qwen3.5 rollout was rejected until both counts were added together.Qwen/Qwen3.5-9B