GRPO kits: one small model, one job, one GPU
EngineSurogate EngineA kit is a task, a reward and three configs. Each one teaches a small Qwen3.5 model (0.8B, or 2B for the two agent kits) a single job
with GRPO on one GPU (surogate grpo-colocate). Before training, it scores the untouched
model on a held-out set the model never trains on, so you get the before and after
numbers from the run itself.
| Kit | What the model learns | Before | After | Scored on | One L40S | Adapter |
|---|---|---|---|---|---|---|
| countdown | Countdown: reach a target number with + − × ÷, reasoning in plain text | 1.0% | 69.5% | 200 puzzles | 67 min | Hub ↗ |
| phone | Turn a phone request into the right function calls (Google’s Mobile Actions) | 74.2% | 85.3% | 961 requests, exact match | 60 min | Hub ↗ |
| guard | Say whether a message breaks a written safety policy (Aegis 2.0) | 54.4% | 78.1% | 1,928 prompts, right verdict | 25 min | Hub ↗ |
| extract | Read a document and fill the JSON its schema asks for (30 types, 16 languages) | 67.6% | 87.8% | 500 documents, fields right | 27 min | Hub ↗ |
| mcp | Answer questions by calling an MCP server’s tools: a 2B agent over a SQLite music store | 48.4% | 81.5% | 184 questions, right answer | 55 min | Hub ↗ |
| research | Answer multi-hop questions by searching a private document collection: a 2B pocket researcher | 26.0% | 63.6% | 300 questions, answer F1 | about 1 h | Hub ↗ |
Scores are greedy, thinking off, with the same prompt and token budget as training. Each is one run, not an average over seeds.
Run a kit
Section titled “Run a kit”Run from the repository root, with the RL dependencies installed:
CUDA_VISIBLE_DEVICES=0 surogate grpo-colocate \ --train examples/kits/extract/train.yaml \ --infer examples/kits/extract/infer.yaml \ --orch examples/kits/extract/orch.yamlThe environment loads from environments/<name>, so there is nothing else to install.
Datasets download from Hugging Face on first use. You’ll find the scores in the
orchestrator log (Evaluated ... Avg@1=) and the adapter in
outputs/kits/<kit>/. Use a fresh output directory for each run.
Engine version: 1.5.17 or later. It has the two fixes the kits need, evaluation with
chat_template_kwargs (#379) and 128
rollouts in flight on one GPU (#381),
and it caps eval requests in flight so a whole-set eval isn’t refused
(#387).
Hardware: the published numbers are from one 48 GB L40S. Any single supported GPU
with room for the model (0.8B, or 2B for mcp and research), its LoRA and 128 rollout slots works; lower
max_num_seqs in infer.yaml (inference config) on a smaller card.
What every kit does the same way
Section titled “What every kit does the same way”- Held-out evaluation before step 0 and every 20 steps (every 10 for mcp and research), on rows the
model never trains on (
eval_base_model: true). - LoRA rank 16 on the attention and MLP projections (
q/k/v/o_proj,gate/up/down_proj), BF16. On Qwen3.5 that leaves the Gated DeltaNet mixers frozen;lora_target_modules: ["all"]adapts them too. Learning rate 1e-4, constant, except mcp and research: 5e-5 with cosine decay (see the next section). - Online difficulty filtering: prompts where all 8 rollouts score 0, or all score 1, teach nothing, so they are resampled. When the base model is already good (phone, extract), later steps get slower, because most prompts are already solved.
- A reward you can read: each environment is one short Python file.
Lessons from building them
Section titled “Lessons from building them”- More steps are not always better. phone peaked at step 20 (85.3%) and scored 83.8% at step 40. guard scored higher at step 40, but the part of its answer that earned no reward had degraded, so it ships at step 20. Keep the best checkpoint, and read its answers, not only the score.
- Score the answer, not the format. mcp’s first scorer paid only for an answer in
<answer>tags, so the base model scored 0% while it was finding most answers in plain sentences. Training then mostly taught the tag. Read the base model’s answers before you trust a low “before”. - A reward that pays only the final answer can starve it. That first mcp run, with a constant 1e-4, made more and more tool calls until it ran out of turns before answering, and collapsed after step 20. A lower, decaying learning rate held.
- Give reasoning room to finish. countdown collapsed when answers were cut at 1,024 tokens. At 1,536 it climbed steadily.
- Check prompt lengths against the context. The server refuses a prompt longer than
sequence_len. The guard kit counts tokens with the model’s tokenizer and drops the few training rows that are too long.
Make your own kit
Section titled “Make your own kit”Copy the closest kit and write an environment whose load_environment() returns
your train and held-out sets and a reward function (see
environments/doc-extract), and point
orch.yaml at it. Start with 20 steps, and read the step-20 evaluation before you
spend more GPU time.
Next: RL Environments explains how to write the environment and reward, and Single-GPU GRPO covers the runner’s settings and limits.