许可证: 其他
许可证名称: 天工社区许可证
许可证链接: >-
https://github.com/SkyworkAI/Skywork-Reward/blob/main/misc/Skywork%20Community%20License.pdf
数据集:
- nvidia/HelpSteer2
语言:
- 英文
评估指标:
- 准确率
基础模型:
- Skywork/Skywork-Reward-Gemma-2-27B-v0.2
库名称: transformers
通过决策树视角解读语言模型偏好
- 作者 李敏
- 博客: https://rlhflow.github.io/posts/2025-01-22-decision-tree-reward-model/
- 模型:
- 代码仓库: https://github.com/RLHFlow/RLHF-Reward-Modeling/tree/main/decision_tree
- 技术报告: 即将发布
RewardBench排行榜(2025年1月)
排名 |
模型 |
基础模型 |
方法 |
综合得分 |
对话 |
困难对话 |
安全性 |
推理能力 |
1 |
决策树奖励模型-Gemma-2-27B |
Gemma-2-27B |
决策树 |
95.4 |
96.9 |
91.4 |
93.9 |
99.2 |
2 |
INF-QRM-Llama3.1-70B |
Llama-3.1-70B |
序列分类器 |
95.1 |
96.6 |
91.0 |
93.6 |
99.1 |
3 |
决策树奖励模型-Llama-3.1-8B |
Llama-3.1-8B |
决策树 |
94.5 |
96.6 |
89.5 |
93.2 |
98.6 |
4 |
QRM-Gemma-2-27B |
Gemma-2-27B |
序列分类器 |
94.4 |
96.6 |
90.1 |
92.7 |
98.3 |
5 |
Skywork-Reward-Gemma-2-27B-v0.2 |
Gemma-2-27B |
序列分类器 |
94.3 |
96.1 |
89.9 |
93.0 |
98.1 |
6 |
Llama-3.1-Nemotron-70B-Reward |
Llama-3.1-70B |
自定义分类器 |
94.1 |
97.5 |
85.7 |
95.1 |
98.1 |
7 |
Skywork-Reward-Gemma-2-27B |
Gemma-2-27B |
序列分类器 |
93.8 |
95.8 |
91.4 |
91.9 |
96.1 |
8 |
TextEval-Llama3.1-70B |
Llama-3.1-70B |
生成式 |
93.5 |
94.1 |
90.1 |
93.2 |
96.4 |
9 |
MetaMetrics-RM-v1.0 |
- |
自定义分类器 |
93.4 |
98.3 |
86.4 |
90.8 |
98.2 |
10 |
Skywork-Critic-Llama-3.1-70B |
Llama-3.1-70B |
生成式 |
93.3 |
96.6 |
87.9 |
93.1 |
95.5 |
11 |
QRM-Llama3.1-8B-v2 |
Llama-3.1-8B |
序列分类器 |
93.1 |
96.4 |
86.8 |
92.6 |
96.8 |
12 |
Skywork-Reward-Llama-3.1-8B-v0.2 |
Llama-3.1-8B |
序列分类器 |
93.1 |
94.7 |
88.4 |
92.7 |
96.7 |
使用代码
使用模型前请确保安装以下依赖:
transformers==4.45.2
torch>=2.5.0
flash-attn>=2.6.3
注意: 此代码需要NVIDIA安培架构或更新的GPU
from transformers import AutoModelForSequenceClassification
import torch
from transformers import AutoTokenizer
model_name = "Decision-Tree-Reward-Gemma-2-27B"
repo_id = f"RLHFlow/{model_name}"
device = "cuda"
model = AutoModelForSequenceClassification.from_pretrained(repo_id, trust_remote_code=True, torch_dtype=torch.bfloat16, attn_implementation="flash_attention_2", device_map=device)
tokenizer = AutoTokenizer.from_pretrained(repo_id, use_fast=True)
model.load_decision_tree(repo_id, filename="decision_tree.pkl")
prompt = "简有12个苹果。她给朋友马克4个苹果,然后又买了1个苹果,最后将所有的苹果平均分给自己和她的2个兄弟姐妹。每个人能得到几个苹果?"
response1 = "1. 简最初有12个苹果,给马克4个。12 - 4 = 8。简现在有8个苹果。\n2. 简又买了1个苹果。8 + 1 = 9。简现在有9个苹果。\n3. 简将9个苹果平均分给自己和2个兄弟姐妹(共3人)。9 ÷ 3 = 3。每人得到3个苹果。"
response2 = "1. 简最初有12个苹果,给马克4个。12 - 4 = 8。简现在有8个苹果。\n2. 简又买了1个苹果。8 + 1 = 9。简现在有9个苹果。\n3. 简将9个苹果平均分给2个兄弟姐妹(共2人)。9 ÷ 2 = 4.5。每人得到4个苹果。"
output = model.compare(prompt, response1, response2, tokenizer, device)
print("回复1奖励值")
print(dict(zip(output["attributes"], output["rewards"][0])))
print("回复2奖励值")
print(dict(zip(output["attributes"], output["rewards"][1])))
print("模型偏好")
print(output["preference"])
许可证
注意: 本模型基于天工模型微调,遵循以下许可协议:
天工模型的社区使用需遵守天工社区许可证。天工模型支持商业用途。如计划将天工模型或其衍生品用于商业目的,必须遵守天工社区许可证中的条款和条件。
待办事项