Reward Model Training Loss (Bradley–Terry)

medium
Unit 20 · RLHF & Embeddings0/2 to milestone

In RLHF, a reward model learns from human preference pairs: it should give the chosen response a higher score than the rejected one. The standard loss is the Bradley–Terry pairwise loss:

Pro problem

Unlock this and every premium problem across all tracks — plus hidden-test grading, advanced AI engineering modules and new content every week.

Start 7-day free trial
solution.py · Python 3.13
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Reward Model Training Loss (Bradley–Terry) · TechGradify