DPO (Rafailov et al., 2023) skips the reward model and the RL loop. It shows that the optimal policy under a KL-constrained reward has an implicit reward, beta times the log-ratio against the reference. Preferences can then be learned directly from that margin.
Implement dpo_logit(logp_w, logp_l, ref_w, ref_l, beta), returning beta times the difference of the two log-ratios.
Compute the winner's log-ratio minus the loser's, then multiply by beta.
No results yet
Run your code to check it against the examples, or submit to run every test.