Macalinao StudioLearnAll enriched lessons ↗
College path · 7 sectionsSwitch to high school ↗

College / 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

College 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.

Group Relative Policy Optimization estimates relative advantages from multiple sampled completions for the same prompt, avoiding a separately learned critic in its original formulation. Keep the behavior policy that generated samples distinct from the current policy being optimized and from a reference policy used for regularization. Outcome rewards can be assigned at completion level, while loss terms involve token probabilities. Trainer variants differ in normalization and aggregation.

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

For rewards r_i, compute a within-group baseline μ. Centered rewards r_i−μ sum to zero. Standardizing by a group spread rescales the learning signal but does not add information about absolute quality. Reward scaling, group size and sample diversity influence the estimator. State whether standard deviation uses a population or sample convention; our hand calculations and Workbench use population variance with an epsilon safeguard.

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

For population variance, [0,1,1,2] yields σ²=0.5 and σ≈0.7071. Standardized advantages are approximately [−1.4142,0,0,1.4142]. In an equal-reward group, centered values vanish. Depending on implementation, such groups produce zero task advantage or are filtered; neither behavior should be confused with successful learning. Document epsilon, normalization axis and filtering policy when comparing trainer results.

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

A PPO-style term uses the minimum of ρA and clip(ρ,1−ε,1+ε)A. For positive A, excessive ratio increases are capped in the surrogate; for negative A, the lower side matters. This is not a global trust-region guarantee. In GRPO, token-level behavior/current-policy ratios must be interpreted together with completion advantages and the specified token/sequence reduction. Our fixture evaluates one positive-advantage term only.

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

Original GRPO includes a KL penalty toward a reference policy alongside the clipped policy objective. Behavior-policy ratios and reference-policy divergence are distinct quantities. Per-sample KL estimators, coefficient choices and token aggregation affect the actual trainer. A scalar penalty does not by itself guarantee harmless or truthful behavior. Evaluate task rewards, distribution drift and held-out quality separately rather than reporting only one training reward curve.

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

Record prompt distribution, group size, sampling settings, reward components, normalization, clipping, KL coefficient and loss reduction. Compare held-out correctness and reward-hacking cases alongside training reward. The original paper's algorithm and a current trainer configuration are not interchangeable descriptions. Our Workbench isolates reward standardization and a single clipped surrogate; it does not run reinforcement learning or model the full gradient estimator.

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.

An equal-reward group provides… Option 1: Infinite useful advantage. Option 2: No centered task-advantage signal. Option 3: Proof all outputs are correct.

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

Reveal worked solution

The correct choice is option 2: No centered task-advantage signal. Zero spread and zero centered differences do not create a ranking signal.

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 college path?

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