< Will Bosler

GRPO Datasets ยท

Fine tuning a model with Group Relative Policy Optimisation (GRPO) requires more than a dataset of prompts and solutions. Most importantly, it requires a reward function. When constructing these datasets, this is where the majority of our time should be spent.

0:02 / 0:02

During training, the model generates its own responses. Each row provides a prompt and a solution against which those responses can be checked, such as an answer, a set of tests or a set of rules.

0:02 / 0:06

The reward function scores how well each response performed. GRPO then reinforces the responses that scored best within their group.

0:02 / 0:05

We have full control over how this score is defined. The reward can be a composite of several assessments of quality, with each judge scoring a single attribute.

0:02 / 0:09

Our task is to consider the outcome we want and ask how we can verify that it was achieved to the required standard. We then translate this into code that assesses each response.

Where a program can verify the result, it should. Examples include a regex for format, an exact match against the solution or unit tests for code. LLM judges are slower and incur token costs, so they should be used sparingly and reserved for attributes that cannot be verified programmatically.

Consider a row from the xLAM function calling dataset. The user's query becomes the prompt, and the gold tool calls become the solution read by the reward function.

0:02 / 0:05

The objective is to train the model to call the relevant tools. We propose three automatic judges. tools_parse checks that the output parses into tool calls, tools_name awards partial credit for selecting the correct tools and tools_correct checks that the calls match the gold calls. Each is instant, so all three can run on every response.

0:02 / 0:09

For each prompt, the model samples a group of responses and each is scored. A response's advantage is its reward relative to the rest of the group, so responses that score above the group are reinforced.

0:02 / 0:07

These judges must be calibrated to measure what we actually want. Otherwise, the model may learn to reward hack, producing responses we do not want that still score well against our judges.

Difficulty must also be calibrated. Prompts should be hard enough that the model learns, but not so hard that it never succeeds. If every response in a group fails, there is no signal to learn from.

0:02 / 0:11

Every row therefore requires a prompt, a trusted solution and room for the model to improve.

0:02 / 0:02