Implement the Bradley–Terry pairwise reward-model loss in PyTorch

RLHF & Preference Optimization1 / 7

Chapter 121 / 7

RLHF & Preference Optimization

Implement the Bradley–Terry pairwise reward-model loss in PyTorch

Easy
Target interface
bt_loss(reward_chosen: torch.Tensor, reward_rejected: torch.Tensor)

Implement the function/class skeleton in the editor. Any correct approach is accepted.

Hints0 / 2
Reference solution
Your own code stays in the editor.