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

RLHF: Reward Models, PPO & GRPO1 / 7

Chapter 121 / 7

RLHF: Reward Models, PPO & GRPO

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

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

Complete the starter code in the editor. Any correct approach is accepted.

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