Optimizing a reward model alone makes the policy drift into strange outputs that exploit the reward. InstructGPT keeps the policy close to the supervised model by subtracting a penalty for how far its log-probabilities move from the reference.
Implement kl_penalized_reward(reward, logp_policy, logp_ref, beta), which subtracts beta times the log-probability difference from the reward.
logp_policy - logp_ref means the policy has moved toward the response.The penalty is beta * (logp_policy - logp_ref); subtract it from the reward.
No results yet
Run your code to check it against the examples, or submit to run every test.