Macalinao StudioLearnAll enriched lessons ↗
High school path · 7 sectionsSwitch to college ↗

High school / LONGER LESSON 09

GRPO: compare completions, not teams

Compute group advantages, handle zero variance, and distinguish clipping from KL control.

Preparation: Mean and spread; likelihood ratios for college.

Plan 20–35 minutes with the activities; this is a study estimate, not a timed requirement. Both paths have complete narration. Your notes and progress are kept separately for each level.

Section 01 / 07

A group answers one prompt

High-school path. Compute group advantages, handle zero variance, and distinguish clipping from KL control.

Preparation: Mean and spread; likelihood ratios for college. Work through one section at a time. Predict the experiment result before changing its controls, then explain what the example leaves out.

Give one question to a model several times and collect different completions. Score each completion using the same rule. The group in GRPO is this set of answers to one prompt, not a team of people or a collection of unrelated tasks. Comparing answers within the group gives a local baseline. The score rule still matters: a model can learn to exploit a poor scoring rule without learning the behavior you wanted.

Worked step 1. Sample four completions for the same prompt.

Worked step 2. Apply one fixed rubric to obtain rewards [0,1,1,2].

Worked step 3. Keep the prompt, completions and reward provenance together.

Try it yourself. Would averaging rewards from four unrelated prompts create the same within-prompt comparison?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. No. Prompt difficulty and reward scales could differ. The group baseline here is defined among completions to one prompt.

Section 02 / 07

Center the rewards

The rewards zero, one, one and two have average one. Subtract one from each: minus one, zero, zero and plus one. The first answer is below the group average and the last is above it. Centering does not say the middle answers are perfect. It says they match the local average. If the whole group is poor, the best relative answer can still be poor in an absolute sense.

Worked step 1. Mean of [0,1,1,2] is one.

Worked step 2. Centered rewards are [−1,0,0,1].

Worked step 3. Their sum is zero.

aᵢ=(rᵢ−μ)/(σ+ε)

Subtract the group mean from each reward and divide by group standard deviation plus a small safeguard.

Try it yourself. Does centered reward zero mean an answer is objectively correct?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. No. It means its reward equals this group average. Correctness depends on the scoring rule and the answer itself.

Section 03 / 07

Normalize and handle identical scores

The squared centered values are one, zero, zero and one. Their average is one half, whose square root is about 0.707. Dividing gives standardized values about minus 1.414, zero, zero and plus 1.414. If every answer receives the same score, there is no spread and no relative ranking signal. Adding a tiny safeguard avoids division by zero; it does not magically create useful differences.

Worked step 1. Average squared deviation is 0.5.

Worked step 2. Standard deviation is √0.5≈0.7071.

Worked step 3. With equal rewards [1,1,1,1], all centered advantages are zero.

Try it yourself. What should you investigate if nearly every group has identical rewards?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. Check whether the reward is too coarse, the task is too easy or hard, or sampled completions lack diversity. Numerical stabilization alone does not solve the missing signal.

Section 04 / 07

Clipping limits a surrogate incentive

The model compares how likely an action is now with how likely it was when sampled. If that ratio changes too far, clipping limits part of the training incentive. It is not a hard wall around every model probability. The sign of the advantage matters: increasing a good action and decreasing a bad action are different directions. Keep the ratio calculation separate from the reward calculation.

Worked step 1. Let A=1, clip width=0.2 and ratio=1.5.

Worked step 2. The raw term is 1.5; the clipped term is 1.2.

Worked step 3. The surrogate minimum is 1.2.

min(ρA, clip(ρ,1−ε,1+ε)A)

Take the smaller of the raw ratio-times-advantage and the clipped-ratio-times-advantage.

Try it yourself. Does this mean every probability ratio is forcibly kept below 1.2?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. No. Clipping changes the optimization objective. It is not a direct constraint on every parameter or probability.

Section 05 / 07

Reference regularization has another job

A reference policy is a saved comparison point. A KL-related penalty discourages the new model from drifting too far in distribution from that reference. This is different from comparing the current policy with the policy that generated the training samples. One controls reference drift; the other corrects or limits changes relative to sampled behavior. Confusing them makes an experiment difficult to interpret.

Worked step 1. Label the sampled behavior policy old.

Worked step 2. Label the updated trainable policy current.

Worked step 3. Label the regularization anchor reference; old and reference need not be the same.

Try it yourself. Which comparison asks whether the current model has drifted from an anchor?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. Current versus reference. Current versus old behavior serves a different role in the policy-ratio term.

Section 06 / 07

Audit the reward before trusting the curve

Design two answers that earn the same score for different reasons. One might be correct and concise, while another exploits a formatting rule. Ask whether the scoring system can tell them apart. Then inspect a group of real completions rather than just its average. A rising reward can be encouraging, but it does not prove better reasoning unless the reward and independent tests actually measure that behavior.

Worked step 1. Write one desired behavior and one possible scoring shortcut.

Worked step 2. Create a held-out test that distinguishes them.

Worked step 3. Track reward and independent correctness together.

Try it yourself. What does higher reward with lower held-out accuracy suggest?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. Investigate reward mismatch, overfitting or exploitation. The reward is a measurement tool, not a definition of reasoning quality.

Section 07 / 07

Mastery and transfer

Bring the pieces together. First answer the checkpoint without the worked solutions. Then explain the mechanism in your own words, using one numerical example from this lesson.

A GRPO group contains… Option 1: Different answers to one prompt. Option 2: Unrelated employee tasks. Option 3: One answer from each language.

Pause here and choose an answer before continuing. The checkpoint explanation follows.

Reveal worked solution

The correct choice is option 1: Different answers to one prompt. The comparison is within one prompt.

Transfer task. Change one assumption in the worked example. State your prediction, calculate or test it in Workbench, then explain whether the result supports your prediction.

Reveal worked solution

Self-check rubric. Name the changed assumption, keep the other inputs fixed, show at least one intermediate calculation, and distinguish what the toy example guarantees from what would require a trained model or a real measurement.

Sources and scope

Original worked examples and teaching text, grounded in these primary references. Numerical fixtures explain mechanisms; model quality and hardware performance require separate measurements. Both levels share key examples, with different explanations and checkpoints.

Reset this high school path?

This removes only this path’s notes, progress and experiments from this browser.