Skip to main content
skill Claude Code CX Codex Cursor

grpo-rlvr-training — Claude Code skill: what it does, how to install

Configures GRPO and RLVR training pipelines for tasks with verifiable outcomes. Useful when evaluating models with code execution, unit tests, or strict schemas.

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add wshobson/agents
/plugin install llm-finetuning@claude-code-workflows
Open on GitHub

What grpo-rlvr-training does

The skill produces validated configs for TRL's GRPOTrainer paired with vLLM generation. It sets reference values such as num_generations=8, a learning rate of 5e-7, and a KL penalty beta=0.01. It requires an algorithmic verifier like a test suite, JSON parser, or ground-truth grader.

A mandatory inspection gate runs the reward function across 50–100 sampled outputs before training starts. Uninspected reward functions cause models to exploit metrics without solving the task. The model must also have a nonzero base success rate; if it never succeeds, SFT is required first.

Start with the default GRPO recipe. When runs degrade, switch to variants: DAPO fixes entropy collapse on long reasoning traces, Dr.GRPO strips length bias, and GSPO provides sequence-level ratios for mixture-of-experts models.

What it helps with

  • Configure TRL GRPOTrainer with vLLM generation for single or multi-GPU setups
  • Define composite reward functions combining format parsing and correctness
  • Switch to DAPO, Dr.GRPO, or GSPO when baseline runs diverge or exploit length
  • Gate RL runs by testing reward functions against 50–100 sample completions

Example prompts for the agent

  • Set up a GRPO training config for a model that solves math problems with exact verification
  • The model is reward-hacking by generating overly long reasoning traces, switch to Dr.GRPO
  • Configure GRPOTrainer with unit-test verification using vLLM in colocate mode

How to install grpo-rlvr-training

1Plugin marketplace

/plugin marketplace add wshobson/agents
/plugin install llm-finetuning@claude-code-workflows

This installs the whole llm-finetuning plugin with all its skills

2Skills CLI (Vercel)

npx skills add wshobson/agents --skill grpo-rlvr-training -a claude-code

3Manually: put the files in place

~/.claude/skills/grpo-rlvr-training/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/grpo-rlvr-training/

From the same set213

The whole set →
typescript-advanced-types Seth Hobson Guides an agent through advanced TypeScript types, from generics to conditional and mapped types. Use it for typed libraries, API clients, or strict configuration objects. Claude Code CX Codex Cursor 92,169installs tailwind-design-system Seth Hobson Helps build design systems with Tailwind CSS v4, from theme tokens to component variants. Use it when a project needs shared UI patterns. Claude Code CX Codex Cursor 70,180installs brand-landingpage Travis D. Elliott This skill interviews you about the product and its visual direction, then builds a landing page through Stitch. Use it when there’s no established design yet. Claude Code CX Codex Cursor 39,476installs python-testing-patterns Seth Hobson This skill guides Python testing with pytest, fixtures and mocks. Use it when building a test suite or tracking down failing checks. Claude Code CX Codex Cursor 36,943installs python-performance-optimization Seth Hobson This skill profiles Python code to locate CPU and memory bottlenecks. Use it when an application responds slowly or consumes too many resources. Claude Code CX Codex Cursor 35,675installs nextjs-app-router-patterns Seth Hobson This skill covers Next.js App Router patterns for rendering, routing, and data fetching. Use it when starting an App Router project or moving from Pages Router. Claude Code CX Codex Cursor 32,529installs api-design-principles Seth Hobson Use this skill to plan or review REST and GraphQL APIs. It helps when writing a specification or setting API conventions for a team. Claude Code CX Codex Cursor 30,348installs code-review-excellence Seth Hobson This skill guides pull request reviews, catches logic and security issues, and helps teams give specific feedback. Use it for review standards or developer mentoring. Claude Code CX Codex Cursor 30,193installs

Similar

ai-prompt-research every-app This skill discovers questions people ask ChatGPT about your niche, shows how the model answers them, and reveals which sites it cites. Learn where your brand appears in AI responses and where competitors show up instead. Claude Code CX Codex Cursor +1 837installs huggingface-papers huggingface Pulls the paper ID out of a Hugging Face or arXiv link, reads the page as markdown, and fetches authors, models and datasets from the papers API. Claude Code CX Codex Cursor +1 2,200installs huggingface-llm-trainer huggingface Runs language and vision model fine-tuning on Hugging Face Jobs with TRL or Unsloth and converts checkpoints to GGUF without local GPUs. Claude Code CX Codex Cursor +1 2,200installs gke-ai-troubleshooting-node-unresponsive-timeout official google Diagnoses unresponsive GKE TPU and GPU nodes stuck in NodeStatusUnknown. Pinpoints kernel panics and missing kubelet heartbeats when node auto-repair is disabled. Claude Code Gemini CLI CX Codex 810installs mmx-cli MiniMax-AI Teaches your agent to use the MiniMax CLI directly from the terminal. Helps generate text, images, video, speech, and music inside coding workflows. Claude Code CX Codex Cursor +1 1,600installs minimax-music-gen MiniMax-AI A Claude Code skill that turns a description into an MP3 — vocals, instrumental or a cover — through the MiniMax Music API and the mmx tool. Claude Code CX Codex Cursor +1 1,600installs skill-creator official anthropics Creates and refines skills, then tests them with prompts, evaluations, and performance checks. Claude Code Claude.ai 414,180installs writing-for-agents Matt Pocock Guidance for writing skills and agent-facing documents. Use it when editing AGENTS.md, CLAUDE.md, or reference files reached from them. Claude Code 466,719installs

Questions about grpo-rlvr-training

How to install grpo-rlvr-training in Claude Code?

Run npx skills add wshobson/agents --skill grpo-rlvr-training -a claude-code in your terminal. You can also install it via /plugin install llm-finetuning@claude-code-workflows.

When should you choose GRPO over DPO?

Use GRPO when task success can be checked programmatically by tests or schemas. DPO applies when tuning for subjective style preferences between two valid completions.

Which GRPO variant fixes issues on mixture-of-experts models?

Use GSPO for MoE architectures. It switches the importance-sampling ratio to the sequence level because per-token ratios are unstable across expert routing.

Source text

SKILL.md · MIT
---
name: grpo-rlvr-training
description: 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.
---

# 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:

```python
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-7`** and **`beta=0.01`** are
  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.

This inspection is a Phase 1 gate input for
`/finetune` — the same 50–100-sample read that
catches a broken reward function here is what that
command checks for before it lets a GRPO brief
proceed.

Complete reward function implementations to
inspect against — exact-match, schema-validation,
unit-test-execution, a length-penalty wrapper, and
a rubric-as-reward judge pattern:
`references/reward-functions.md`.

## Variant Selection

The base recipe above is the default. Reach for a
variant only when a specific failure mode shows
up, not preemptively:

| Failure mode | Variant | Why |
|---|---|---|
| Entropy collapse / degenerate long chain-of-thought | **DAPO** | Decouples clip bounds and relaxes the KL penalty that over-regularizes exploration on long reasoning traces |
| Reward or output length trends up regardless of quality | **Dr.GRPO** | Removes GRPO's length-normalization bias so reward tracks correctness, not completion length |
| Training a mixture-of-experts model | **GSPO** | Moves the importance-sampling ratio to the sequence level instead of per-token — per-token ratios are unstable on MoE routing, so GSPO is required here, not optional |

Start with plain GRPO. Watch for the specific
symptom — collapsing entropy on long CoT, a
length-reward correlation, or MoE instability —
and only then swap in the matching variant above.
Don't pre-select a variant before the base recipe
has actually shown the failure mode.

## VLM RL Is Reference-Only

Vision-language RL is **not executed by this
plugin in v1** — it's documented here for
context, not as a runnable path. Tooling is
fragmented across ms-swift and EasyR1-derived
forks with no one-line TRL command yet, and naive
text-only GRPO applied to a VLM tends to
reward-hack by optimizing the text-reasoning trace
while ignoring the image — the model learns to
sound right without looking at the input. A VLM
RL run is a research spike outside this skill's
supported recipe, not a variant of The Recipe
above.

## References

- `references/reward-functions.md` — complete
  Python reward functions (exact-match
  correctness, schema validation, unit-test
  execution, a length-penalty wrapper, and a
  rubric-as-reward judge pattern) to inspect under
  The Inspection Rule before any training run.
- `references/grpo-memory.md` — memory sizing by
  target size class, vLLM sleep-mode and
  optimizer-state tactics, Unsloth's long-context
  RL chunking, and the DGX Spark bandwidth caveat
  for decode-heavy rollouts.

Related skills: `finetuning-method-selection`
routes here once a verifiable pass/fail signal
exists; `preference-optimization` is the sibling
skill for preference pairs rather than verifiable
rewards; `eval-harness-first` covers judge
calibration for any reward that isn't purely
code-checkable. On DGX Spark, defer to the
`dgx-spark-ops` plugin's skills, when installed,
for the memory/thermal remediation ladder this
skill's memory table doesn't cover.

© Seth Hobson · MIT · wshobson/agents

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor