Back to Module 7.
Problem 7.1 (Clip four ratios).The ratios are
and the advantages are . Take . Compute the clipped ratios, the four values inside the of Definition 7.1, and the loss .
Solution
Solution to Problem 7.1.
The window is
. The clipped ratios are . Unclipped products
: . Clipped products:
. Term-by-term minima:
. The third ratio was inside the window, so clipping did nothing to it. The fourth term uses rather than : the rollout has negative advantage, and the surrogate refuses extra credit for pushing its ratio below . The mean of the minima is
. The loss is .
Problem 7.2 (Not a divergence).The KL penalty in Module 7 sums
on the sampled completion. Name two ways this differs from . What happens to the gradient of this term on a group whose advantages are all zero?
Solution
Solution to Problem 7.2.
The divergence weights the log-ratio by
and sums over the whole vocabulary at each position. The penalty in the notes weights nothing except the tokens that were actually sampled, and those tokens were sampled from the old policy, not from . It also sums over completion length, so a longer rollout produces a larger-magnitude term. When every advantage is zero, the policy-gradient term contributes nothing. The KL penalty is then the only gradient. Because the reference log probability is a constant, descending on the penalty pushes
down on the sampled tokens and can raise entropy until the samples stop being answers.
Problem 7.3 (Format cases).The generated ids contain
for <think>andfor </think>. Give Definition 7.2 for each case.
occurs, then later . occurs, then later . - Only
occurs. - The base tokenizer split the characters of
<think>into several ordinary ids, and neither special id occurs.
Solution
Solution to Problem 7.3.
- Reward
. The opening tag precedes the closing tag. - Reward
. The first closing tag precedes the first opening tag, so the order test fails. - Reward
. The closing id is absent, and the index lookup fails. - Reward
. The special ids never appear. This is why the format reward requires the reasoning tokenizer, or an explicit addition of those special tokens, before training starts.
Problem 7.4 (A suspicious curve).Training reward rises to
while greedy MATH-500 accuracy stays near the base model’s . Advantage mean is . Entropy has fallen below . What is the more plausible story, and which series would you read next?
Solution
Solution to Problem 7.4.
The advantage mean being
says the advantage code is still centering. The entropy collapse says the policy has become nearly deterministic. A high training reward with a flat held-out accuracy means those deterministic samples are collecting reward on the training questions and not generalizing. Read a batch of transcripts and the response length. A single template that happens to box training-set answers is the usual finding. Trust the held-out grade over the training reward.