grpo-rlvr-training
What it does
This feature trains an AI to perform tasks that can be automatically checked, like solving math problems or writing code. It uses a method called GRPO with reinforcement learning to ensure the AI learns to get it right.
When to use it
- βWhen you need the AI to solve math problems.
- βWhen you want the AI to write working code.
- βWhen the AI's task has a clear 'right' or 'wrong' answer.
Skill link
https://github.com/wshobson/agents/blob/main/plugins/llm-finetuning/skills/grpo-rlvr-training/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βTrain the AI to solve math equations and verify if the answer is correct.β
5 new skills a week. 1 minute to read.
How it works
The AI is given tasks and tries to solve them. A system automatically checks if the answer is correct. If it is, the AI is rewarded and learns to do better. If it's wrong, it tries again.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
GRPO & RLVR Training
This skill assumes finetuning-method-selection
already routed here because the target behavior
has a verifiable pass/fail signal β not
demonstrations (lora-qlora-recipes) or
preference pairs (preference-optimization).
What follows is when RL is the right tool, the
reference recipe, the mandatory reward-inspection
gate, and how to pick a GRPO variant when the
base recipe misbehaves.
Input: a routing decision (RLVR via GRPO)
plus a verifier (code executor, test suite,
schema checker, or grader) for the target task.
Output format: a validated GRPO config β the
kwarg values in references/grpo-memory.md and
the reward functions in
references/reward-functions.md, not free-form
advice β that llm-finetuning-training-engineer
consumes directly.
When RL Applies
GRPO+RLVR only pays off when task success is
algorithmically checkable β a unit test
passes, a parser accepts the output, a tool call
matches an expected schema, a math answer matches
a ground truth. If grading the output requires
human judgment or a subjective rubric, that's an
eval-harness and judge-calibration problem first
β see eval-harness-first β not a reason to skip
straight to RL.
Before opening a GRPO run, confirm the model can sometimes succeed on the target task already. RL sharpens an existing capability by reweighting toward the samples that already work; it does not install a capability from zero.
- The model never succeeds, even at low
temperature across many samples: the gap is
format or task understanding, not policy
refinement. Route back to SFT first
(
lora-qlora-recipes) and only return to this skill once the base success rate is nonzero. - The model succeeds sometimes, inconsistently: this is the GRPO sweet spot β proceed to The Recipe below.
The standing rule for the whole plugin: DPO for
taste, GRPO for reasoning. If the signal is a
preference between two acceptable outputs, that's
preference-optimization, not this skill.
The Recipe
The reference recipe is TRL's GRPOTrainer with
vLLM-backed generation:
from trl import GRPOConfig, GRPOTrainer
grpo_args = GRPOConfig(
output_dir="./outputs-grpo",
use_vllm=True,
vllm_mode="colocate", # single GPU; "server" for multi-GPU
num_generations=8, # floor β fewer starves the group-relative baseline
learning_rate=5e-7, # settled range for GRPO
beta=0.01, # KL coefficient vs the reference policy
per_device_train_batch_size=8,
gradient_accumulation_steps=4,
bf16=True,
logging_steps=10,
seed=3407,
)
trainer = GRPOTrainer(
model=SFT_CHECKPOINT,
args=grpo_args,
reward_funcs=[format_reward, correctness_reward], # references/reward-functions.md
train_dataset=prompts, # prompt-only β GRPO generates its own completions
processing_class=tokenizer,
)
trainer.train()
vllm_mode="colocate"runs generation and training on the same GPU β the default for a single-GPU box.vllm_mode="server"points at a separate vLLM server process and is the multi-GPU path β generation and training don't compete for the same device.num_generationsβ₯ 8 is a floor, not a suggestion: GRPO's advantage estimate is relative to the group mean, and fewer than 8 samples per prompt produces a noisy baseline.- Reward is composite β a format reward (did the output parse / match the required structure) plus a correctness reward (did the answer verify). A well-formed-but-wrong answer and a malformed one should not score identically; correctness alone loses that signal.
learning_rate=5e-7andbeta=0.01are the settled starting point; deviate only after the base run is stable and reward-inspected (below).
Memory sizing for this recipe by target size
class: references/grpo-memory.md.
The Inspection Rule
Run the reward function against 50β100 sampled outputs and manually read the results before starting the actual training run. This is a gate, not a one-time sanity check.
If the reward function's judgment disagrees with a human reading of that sample, fix the reward function first. Training against an uninspected reward, or tuning hyperparameters to compensate for one silently scoring the wrong thing, is how a run reward-hacks: the model optimizes cleanly toward the wrong target, and that doesn't surface as a training-loop bug.
β¦
FAQ
What does 'verifiable' mean?
It means a computer can tell for sure if the answer is right or wrong, without needing a human to judge.
When should I not use this feature?
If the task requires human opinion, like writing a poem or giving advice, this feature isn't ideal. It works best for tasks with objective answers.
What if the AI can't get anything right?
If the AI never gets it right, even with adjustments, it might need more basic training first. This feature is for improving a skill the AI already has a little, not for teaching something from scratch.
Details
Original description by the author
Train reasoning and verifiable-task behavior with GRPO and reinforcement learning from verifiable rewards (RLVR). Use when task success is algorithmically checkable (math, code, tool calls, structured output), when designing GRPO reward functions, or when a GRPO run diverges or reward-hacks.
repo: wshobson/agents
Popularity
- GitHub stars
- 41k
- Ranking position
- #6732
- License
- MIT
- Updated
- 10/15/2026
Comments
- β¦
More skills from this repository
screen-reader-testing
41kHas your agent test websites using screen readers to ensure they are accessible.
wcag-audit-patterns
41kHelps your agent audit websites for accessibility and fix issues according to WCAG guidelines.
multi-reviewer-patterns
41kEnables your agent to coordinate parallel code reviews, deduplicating findings and consolidating reports.
parallel-debugging
41kAllows the agent to debug complex issues with parallel investigations and root cause analysis.
Similar skills
add-model-provider
394kLets your agent connect a new AI model provider to OpenClaw using safe setup commands, keep API keys out of plain text, and run a live test.
acp-router
394kHelps your agent send a task to a coding assistant such as Claude Code or Cursor through OpenClaw, so the work runs in that tool.
browser-automation
394kTeaches your agent to control web pages step by step, including logins, tabs, and recovery when a page stops responding.