奖励模型(RM)经过训练,可在给定问题的情况下预测哪个人工生成的答案更优。
奖励模型在以下领域十分实用:
问答模型评估
在RLHF中用作奖励分数
所有模型均在以下数据集上训练,且跨数据集使用相同的拆分种子(若验证集不可用)
from transformers import AutoModelForSequenceClassification, AutoTokenizer
reward_name = "OpenAssistant/reward-model-deberta-v3-large"
rank_model, tokenizer = AutoModelForSequenceClassification.from_pretrained(reward_name), AutoTokenizer.from_pretrained(reward_name)
question, answer = "Explain nuclear fusion like I am five", "Nuclear fusion is the process by which two or more protons and neutrons combine to form a single nucleus. It is a very important process in the universe, as it is the source of energy for stars and galaxies. Nuclear fusion is also a key process in the production of energy for nuclear power plants."
inputs = tokenizer(question, answer, return_tensors='pt')
score = rank_model(**inputs).logits[0].cpu().detach()
print(score)验证集拆分准确率
| 模型 | WebGPT | Summary | SytheticGPT |
|---|---|---|---|
| electra-large-discriminator | 59.30 | 68.66 | 99.85 |
| deberta-v3-large | 61.13 | 72.23 | 99.94 |
| deberta-v3-base | 59.07 | 66.84 | 99.85 |
SytheticGPT 的选中-拒绝样本对可能存在某种表面模式,这使得区分哪个答案更好变得非常容易。