Configuration Parsing Warning:In adapter_config.json: "peft.task_type" must be a string

Qwen3.5-9B OpenCode GRPO LoRA

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).

What it is good for

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.

Usage

vLLM (recommended)

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.

PEFT

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")

Training

  • Method: asynchronous GRPO with TRL 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.
  • Tasks: 520 data-analysis tasks built from jupyter-agent/jupyter-agent-dataset (easy and medium, <1000 rows). The 150 evaluation tasks were excluded, along with every task that shares a Kaggle dataset with them, so there is no leakage. The training and evaluation tasks are the same as for the Hermes adapter.
  • Reward: 1 if the final answer is correct, 0 otherwise. No bonus or penalty for tool usage.
  • Hyperparameters: LoRA r 32, alpha 64, dropout 0, all attention, linear-attention and MLP projections; learning rate 1e-5; 8 rollouts per task; sampling temperature 1.0 during training; 200 optimizer steps.
  • Hardware: 2× RTX PRO 6000 Blackwell (96 GB): one for vLLM rollouts, one for the trainer. About 15 hours.

Evaluation

  • Harness: Harbor opencode agent, OpenCode 1.18.30, same container image for base and adapter.
  • Serving: identical vLLM build and sampling (Qwen recommended: temperature 0.6, top_p 0.95, top_k 20), 128k context.
  • Data analysis: 150 held-out tasks, 3 attempts each. No attempt was excluded for infrastructure failures in either run.

Things we had to fix to train inside OpenCode

These are worth knowing if you train another model inside OpenCode with OpenEnv:

  • Reasoning tokens. OpenCode's trajectory reports 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.
  • Sandbox memory. OpenCode itself runs inside the task sandbox and uses about 0.75 GB. With the dataset's 1 GB limit, about 19% of training rollouts and 8% of evaluation attempts were killed for running out of memory. Both the base and the adapter numbers above use a 4 GB limit.
  • Version. OpenCode 1.19.6 exits with an error (EPIPE) after writing a correct answer, which makes the trainer discard the rollout. 1.18.30 does not.

Limitations

  • Only data analysis was measured. Unlike the Hermes adapter, there is no Terminal-Bench check for this one, so a regression on other agent work is not ruled out.
  • A checkpoint at step 150 scored 86.2% (+7.6 ± 3.6). The 150 → 200 difference is within noise. By step 200, most training tasks were solved by all 8 rollouts, so there was little left to learn from this task set.
  • 2 of the 520 training tasks never ran (their data download timed out before the model was called) and were skipped.

Acknowledgements

  • Thanks to Sionic AI for the GPU time and infrastructure.
  • Method and task format follow Hugging Face's harness-hub work on training models inside agent harnesses.
  • Built on TRL, OpenEnv, Harbor, vLLM, and OpenCode.
Downloads last month
28
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for rlaope/Qwen3.5-9B-opencode-grpo-lora

Finetuned
Qwen/Qwen3.5-9B
Adapter
(1,142)
this model

Dataset used to train rlaope/Qwen3.5-9B-opencode-grpo-lora