模型简介
模型特点
模型能力
使用案例
🚀 天工评判系列模型介绍
由 天工智能(SkyworkAI) 对齐团队开发的 天工评判 - Llama3.1 - 70B 和 天工评判 - Llama3.1 - 8B 是先进的评判模型,擅长进行成对偏好评估。这些模型能够对输入的一对内容进行比较和评估,对它们的相对质量或适用性给出细致的判断。凭借对语言和上下文的深入理解,天工评判系列模型为包括数据改进、评估和奖励建模等各种应用提供了有价值的见解。
✨ 主要特性
- 成对偏好评估:能够精准比较和评估输入对,给出细致的相对质量或适用性判断。
- 多源数据训练:使用多种高质量数据集进行微调,包括清理后的开源数据、内部人工标注数据、合成评判数据和评判相关聊天数据。
- 广泛应用价值:为数据改进、评估和奖励建模等多种应用提供有价值的见解。
📦 训练详情
天工评判 - Llama3.1 - 70B 和天工评判 - Llama3.1 - 8B 分别基于 Meta 的 Llama - 3.1 - 70B - Instruct 和 Llama - 3.1 - 8B - Instruct 构建。这些模型使用了多种高质量数据集进行微调,具体如下:
- 清理后的开源数据:我们使用了 HelpSteer2、OffsetBias、WildGuard (对抗性) 和 Magpie DPO 系列(Ultra、Pro (Llama - 3.1)、Pro、Air)的高质量子集。更多详情,请参考我们的 天工奖励偏好 - 80K - v0.1 数据集。此外,我们还将一些开源的高质量评判数据集,如 Open - Critic - GPT 整合到训练过程中。
- 内部人工标注数据:这包括对单个回复在多个维度上的逐点评分,以及两个回复之间的成对比较。每个维度都包含了评分的理由。需要注意的是,手动标注的数据获取成本非常高。我们只有几百个手动标注的数据点,且全部为中文,因此进行单评分的能力可能不是特别强。
- 合成评判数据:我们采用了与 自学 类似的方法。具体来说,我们使用了两种方法为给定的指令生成较差的回复:1) 创建一个类似的指令,然后为这个新指令生成回复。2) 在高质量回复中引入细微错误。
- 评判相关聊天数据:我们整合了评判相关的聊天数据,以保持模型的对话能力。
训练采用指令微调方法,专注于成对偏好评估和一般聊天任务。我们进行了全面的验证过程,以确保我们的训练数据集不包含 RewardBench 测试集的任何信息,从而保证评估结果的完整性。
📚 生成模型的 RewardBench 排行榜
我们使用 官方测试脚本 在 RewardBench 上对我们的模型进行了评估。
截至 2024 年 9 月,天工评判 - Llama3.1 - 70B 在 RewardBench 上的所有规模生成模型中 排名第一,而天工评判 - Llama3.1 - 8B 在参数少于 10B 的生成模型中排名第一。(注:星号 (*) 表示开源模型。)
模型 | 对话 | 困难对话 | 安全性 | 推理能力 | 综合得分 |
---|---|---|---|---|---|
天工评判 - Llama3.1 - 70B * | 96.6 | 87.9 | 93.1 | 95.5 | 93.3 |
Salesforce/SFR - LLaMa - 3.1 - 70B - Judge - r | 96.9 | 84.8 | 91.6 | 97.6 | 92.7 |
Salesforce/SFR - nemo - 12B - Judge - r | 97.2 | 82.2 | 86.5 | 95.1 | 90.3 |
天工评判 - Llama3.1 - 8B * | 93.6 | 81.4 | 91.1 | 89.8 | 89.0 |
Salesforce/SFR - LLaMa - 3.1 - 8B - Judge - r | 95.5 | 77.7 | 86.2 | 95.1 | 88.7 |
facebook/Self - taught - Llama - 3 - 70B | 96.9 | 84.0 | 91.1 | 82.5 | 88.6 |
google/gemini - 1.5 - pro - 0514 | 92.3 | 80.6 | 87.9 | 92.0 | 88.2 |
openai/gpt - 4o - 2024 - 08 - 06 | 96.1 | 76.1 | 88.1 | 86.6 | 86.7 |
openai/gpt - 4 - 0125 - preview | 95.3 | 74.3 | 87.6 | 86.9 | 86.0 |
openai/gpt - 4 - turbo - 2024 - 04 - 09 | 95.3 | 75.4 | 87.6 | 82.7 | 85.2 |
Anthropic/claude - 3 - 5 - sonnet - 20240620 | 96.4 | 74.0 | 81.6 | 84.7 | 84.2 |
meta - llama/Meta - Llama - 3.1 - 70B - Instruct * | 97.2 | 70.2 | 82.8 | 86.0 | 84.0 |
NCSOFT/Llama - 3 - OffsetBias - 8B * | 92.5 | 80.3 | 86.8 | 76.4 | 84.0 |
💻 使用示例
基础用法
以下是一个获取两个对话评判结果的示例代码:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
# An Example Case
prompt = "Jane has 12 apples. She gives 4 apples to her friend Mark, then buys 1 more apple, and finally splits all her apples equally among herself and her 2 siblings. How many apples does each person get?"
responseA = "1. Jane starts with 12 apples and gives 4 to Mark. 12 - 4 = 8. Jane now has 8 apples.\n2. Jane buys 1 more apple. 8 + 1 = 9. Jane now has 9 apples.\n3. Jane splits the 9 apples equally among herself and her 2 siblings (3 people in total). 9 ÷ 3 = 3 apples each. Each person gets 3 apples."
responseB = "1. Jane starts with 12 apples and gives 4 to Mark. 12 - 4 = 8. Jane now has 8 apples.\n2. Jane buys 1 more apple. 8 + 1 = 9. Jane now has 9 apples.\n3. Jane splits the 9 apples equally among her 2 siblings (2 people in total). 9 ÷ 2 = 4.5 apples each. Each person gets 4 apples."
# feed a natural language prompt to generative model
prompt_template = """Please act as an impartial judge and evaluate the quality of the responses provided by two AI assistants to the user question displayed below. You should choose the assistant that follows the user\'s instructions and answers the user\'s question better.
Your evaluation should consider factors such as the helpfulness, relevance, accuracy, depth, creativity, and level of detail of their responses. Avoid any position biases and ensure that the order in which the responses were presented does not influence your decision. Do not allow the length of the responses to influence your evaluation. Do not favor certain names of the assistants. Be as objective as possible.
Please directly output your final verdict by strictly following this format: "[[A]]" if assistant A is better, "[[B]]" if assistant B is better.
[User Question]
{input}
[The Start of Assistant A's Answer]
{response_a}
[The End of Assistant A's Answer]
[The Start of Assistant B's Answer]
{response_b}
[The End of Assistant B's Answer]
"""
user_message = prompt_template.format(input=prompt, response_a=responseA, response_b=responseB)
conversation = [{"role": "user", "content": user_message}]
model_name = "Skywork/Skywork-Critic-Llama3.1-70B"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
input_ids = tokenizer.apply_chat_template(
conversation,
tokenize=True,
add_generation_prompt=True,
return_tensors="pt").to(model.device)
generation = model.generate(
input_ids=input_ids,
max_new_tokens=2048,
do_sample=False,
pad_token_id=128009,
temperature=0)
completion = tokenizer.decode(
generation[0][len(input_ids[0]):],
skip_special_tokens=True,
clean_up_tokenization_spaces=True)
print(completion)
# Output:
# The generative model should output "[[A]]"
📄 声明与许可协议
声明
我们在此声明,天工模型不得用于任何对国家或社会安全构成威胁的活动,或从事非法行为。此外,我们要求用户在未进行适当的安全审查和记录的情况下,不要将天工模型部署到互联网服务中。我们希望所有用户都能遵守这一原则,以确保技术进步在规范和合法的环境中进行。
我们已尽最大努力确保模型训练过程中使用的数据合规。然而,由于模型和数据的复杂性,尽管我们付出了巨大努力,仍可能存在不可预测的风险和问题。因此,如果因使用天工开源模型而出现任何问题,包括但不限于数据安全问题、舆论风险,或因模型被误导、滥用、传播或不当使用而产生的任何风险和问题,我们将不承担任何责任。
许可协议
天工模型的社区使用需要遵循 天工社区许可协议。天工模型支持商业使用。如果您计划将天工模型或其衍生产品用于商业目的,必须遵守 天工社区许可协议 中的条款和条件。
📞 联系我们
如果您有任何问题或反馈,请随时通过 shiwen.tu@kunlun-inc.com 或 liang.zhao@kunlun-inc.com 联系我们友好的团队。该项目由赵亮领导。
📝 引用
如果您觉得我们的工作有帮助,请使用以下 BibTeX 条目引用我们:
@misc{skyworkcritic2024,
title={Skywork Critic Model Series},
author={Shiwen, Tu and Liang, Zhao and Liu, Chris Yuhao and Zeng, Liang and Liu, Yang},
year={2024},
month={September},
howpublished={\url{https://huggingface.co/Skywork}},
url={https://huggingface.co/Skywork},
}



