Skip to content
SurogateSurogateDocs
↑↓ to move↵ to openesc to close

GRPO kits: one small model, one job, one GPU

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

KitWhat the model learnsBeforeAfterScored onOne L40SAdapter
countdownCountdown: reach a target number with + − × ÷, reasoning in plain text1.0%69.5%200 puzzles67 minHub ↗
phoneTurn a phone request into the right function calls (Google’s Mobile Actions)74.2%85.3%961 requests, exact match60 minHub ↗
guardSay whether a message breaks a written safety policy (Aegis 2.0)54.4%78.1%1,928 prompts, right verdict25 minHub ↗
extractRead a document and fill the JSON its schema asks for (30 types, 16 languages)67.6%87.8%500 documents, fields right27 minHub ↗
mcpAnswer questions by calling an MCP server’s tools: a 2B agent over a SQLite music store48.4%81.5%184 questions, right answer55 minHub ↗
researchAnswer multi-hop questions by searching a private document collection: a 2B pocket researcher26.0%63.6%300 questions, answer F1about 1 hHub ↗

Scores are greedy, thinking off, with the same prompt and token budget as training. Each is one run, not an average over seeds.

Run from the repository root, with the RL dependencies installed:

bash
CUDA_VISIBLE_DEVICES=0 surogate grpo-colocate \
--train examples/kits/extract/train.yaml \
--infer examples/kits/extract/infer.yaml \
--orch examples/kits/extract/orch.yaml

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

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

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.