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

GRPO with a RULER judge

RULER scores groups of student rollouts with an independent LLM judge. This example trains Qwen3-0.6B (which also generates the rollouts) with Qwen3-1.7B as the judge, on the local markdown-table-qa environment.

The judge must support response_format: json_schema, and native Surogate serving does not implement constrained structured output. So start an external, compatible judge, for example vLLM in its own environment on a third GPU:

bash
CUDA_VISIBLE_DEVICES=2 vllm serve Qwen/Qwen3-1.7B \
--port 8001 --max-model-len 16384

Once it is ready, run from the repository root with Surogate’s environment active:

bash
surogate grpo --train examples/ruler/train.yaml --infer examples/ruler/infer.yaml \
--orch examples/ruler/orch.yaml --infer-gpus 0 --trainer-gpus 1

The runner manages the native student server and the trainer; the external judge keeps running on its own. To use a judge service you already have, change ruler.judge.base_url and ruler.judge_model in orch.yaml, and export RULER_JUDGE_API_KEY if it requires authentication. Do not pass --judge-infer: it launches a native server, which cannot satisfy the judge’s schema request.

The config turns on verification, uses four rollouts per example, and sets ruler.mode: replace. Use add to combine the environment reward with the judge reward, or metric to log the judge score without changing the reward. The optional ruler.rubric gives the judge its criteria, and ruler.cost.input_per_million / output_per_million turn on cost estimates. A failed judge call raises an error instead of silently becoming a zero reward.

Training and evaluation both run on a short twenty-step schedule, and evaluation uses the environment’s verifier every ten steps. To check that the judge’s preferences agree with task correctness, compare ruler/score_mean with eval/markdown-table-qa/avg@4 in /tmp/grpo_metrics.jsonl. Trainer metrics are in outputs/ruler/metrics.jsonl.

A Qwen judge can spend its whole output budget thinking before it writes any JSON, so the example turns judge thinking off and allows 4096 completion tokens. If judge output gets truncated, increase the context and output budgets or reduce the group size. Keep rollouts_per_example >= 2, verification.enabled: true, and the orchestrator output inside the trainer output as run_default.

Next: the RULER section of the RL guide lists every ruler.* setting and the metrics to watch, and the GRPO example is the same task without a judge.