This was a live debugging exercise, not a design question.
First, walk through the code to understand the intended GRPO algorithm and identify deviations from the paper or standard implementations. Then, systematically check each component (sampling, advantage normalization, KL penalty, policy update) for common bugs such as incorrect normalization, missing detach, or sign errors. Finally, propose fixes and explain why they are correct, emphasizing numerical stability and correctness.
Pro tip: Mention that GRPO is similar to PPO but without a value function, so the advantage is computed as the normalized reward within each group; this shows you understand the algorithm's core idea and can spot deviations quickly.
Briefly explain the GRPO objective: for each prompt, sample a group of responses, compute rewards, normalize advantages within the group, and update the policy with a KL penalty against a reference model.
Check that multiple responses are sampled per prompt, rewards are computed correctly, and the group structure is maintained for advantage normalization.
Verify that advantages are normalized per group (e.g., subtract mean, divide by std) and that normalization is done correctly without leaking information across groups.
Ensure the KL penalty is computed against a reference policy (often detached), added with the correct sign and coefficient, and that the policy gradient update uses the correct loss (e.g., -advantage * log_prob) with proper masking.
For each identified bug, suggest a concrete fix and explain how it corrects the issue, then mentally run through a small example to validate the corrected code.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.