大模型对齐强化开源数据集必备:兼谈ULTRAFEEDBACK偏好数据集构建思路

AI 6个月前 admin
124 0 0

今天是2023年10月23日,重阳节,北京,天气晴,我们继续来看看数据工程。

我们在之前的文章中介绍了指令微调数据的诸多构造方法,例如self instruc,self qa等以及一些开源的微调数据,我们会很自然地想到强化阶段又有那些数据集,并且如何进行构造。

实际上,人类反馈中强化学习(RLHF)已成为使大型语言模型(LLM)与人类偏好相一致的关键技术。在RLHF实践中,偏好数据在连接人类偏好和LLM方面起着至关重要的作用。然而,人类对LLM输出的各种自然偏好数据集的稀缺性对RLHF以及开源社区内的反馈学习研究构成了巨大挑战。当前的偏好数据集要么是专有数据集,要么规模有限且种类繁多,这导致RLHF在开源模型中的应用受到限制,并阻碍了进一步的探索。

《ULTRAFEEDBACK: BOOSTING LANGUAGE MODELS WITH HIGH-QUALITY FEEDBACK》地址:https://arxiv.org/abs/2310.01377,提出了UltraFeedback是一个大规模、细粒度、多样化的偏好数据集,用于训练强大的奖励模型和批评者模型。

该工作从各种资源(包括UltraChat、ShareGPT、Evol-Instruct、TruthfulQA、FalseQA和FLAN,数据集统计数据请参见此处)中收集了约64k条提示。然后使用这些提示来查询多个LLM(模型列表请参见此处),并为每个提示生成4个不同的回复,从而得到总共256k个样本。

本文对该工作进行介绍,并介绍现有的一些其他的开源评测数据集,供大家一起参考。

一、ULTRAFEEDBACK实现思路

该工作从6个公开的高质量数据集中抽取了63,967条指令。

大模型对齐强化开源数据集必备:兼谈ULTRAFEEDBACK偏好数据集构建思路

图1显示了ULTRAFEEDBACK的构建过程,从大型数据池中抽取指令和模型样本,以保证对比数据的多样性,然后通过详细图解查询GPT-4,以获得文本和数字格式的精细和高质量标注信息。

与其他数据集的对比,可以从下图看出:

大模型对齐强化开源数据集必备:兼谈ULTRAFEEDBACK偏好数据集构建思路

我们可以再重点看看具体实现思路:

其首先确定了LLM在实际使用中的四个基本要求:

(1)遵循指令:LLM应理解人类指令的意图,并在不偏离要求(包括任务目标和额外限制)的情况下响应人类指令。

(2)提供帮助和信息:本地语言管理员应提供有用和正确的答案,以成功解决给定的问题。

(3)真实性:大模型的回复应基于说明和现实世界的知识,不得捏造任何没有参考资料的事实或引入任何自相矛盾的内容。

(4)诚实:大模型应知道他们(不)知道什么,并在对给定问题摇摆不定时表达不确定性。

 然后进行指令采样和指令标注两个阶段:

1、指令采样

为了获得不同程度的完成度,该工作调查了评估LLMs某些能力的数据集。包括TruthfulQA和FalseQA中的所有指令,分别从Evol-Instruct和UltraChat中随机抽样10k条指令,并从ShareGPT中抽样20k条指令。

对于FLAN,采用了分层抽样策略,从”CoT”子集中随机抽取3k条指令,在其他三个子集中每个任务抽取10条指令,同时排除那些过长的指令。

进行数据污染检测,过滤掉与AlpacaEval、UltraChat测试集和EvolInstruct测试集重叠的数据。

最后,从六个公开的高质量数据集中抽取了63967条指令。

{
    "evol_instruct": 10000, 
    "false_qa": 2339,
    "flan": 20939, 
    "sharegpt": 19949, 
    "truthful_qa": 811,
    "ultrachat": 9929 
}

2、指令标注

根据63967条指令生成255864个模型完成项后,使用GPT-4为每个完成项提供两种类型的反馈:

(1)标量分数,表示多个方面的细粒度质量;

(2)文本批注,提供如何改进完成项的详细指导。

为避免主观标注,提供每个方面的详细文档供GPT-4参考。在每份文档中,会简要介绍每个方面的定义,然后详细说明从分数1到5的预期行为,示例如下:

大模型对齐强化开源数据集必备:兼谈ULTRAFEEDBACK偏好数据集构建思路

此外,为减少GPT-4注释中的随机性,将一条指令及其所有完成情况打包到提示中,并要求GPT-4同时为四个完成情况打分,以避免GPT-4在不同运行中使用不一致的标准来评定完成情况。

大模型对齐强化开源数据集必备:兼谈ULTRAFEEDBACK偏好数据集构建思路
最后,除了标量奖励,还寻求GPT-4的文本批评。促使GPT-4充当导师的角色,为每个完成项目提供详细的建议,以帮助模型改进,而不是直接提出答案。​与上述以比较为导向的标注不同,点评提示是针对每个完成项从整体角度单独生成的。在点评结束时,提示GPT-4给每个完成项打分,以评估完成质量。
大模型对齐强化开源数据集必备:兼谈ULTRAFEEDBACK偏好数据集构建思路

最终的数据样例:

{
    "source""sharegpt", // the dataset where the instruction comes from
    "instruction""I am going to cairo in June of this year, thinking of 4-5 days, what are the best things I could do? Going with family of 5, granddad, grandmom, sister, mom and me. No days can have too much walking but sister, me and mom like adventure sports",
    "models": [ // four models that are randomly sampled from the model pool to complete the instruction
        "falcon-40b-instruct",
        "gpt-4",
        "starchat",
        "wizardlm-7b"
    ],
    "correct_answers": ["None"] // reference correct answers, set to None except TruthfulQA and FLAN
    "incorrect_answers": ["None"] // reference incorrect answers, set to None except TruthfulQA and FLAN
    "completions": [ // four completions corresponding to the four models
        { // completion 1
            "model""falcon-40b-instruct",
            "principle""helpfulness", // priciple that used to align model behavior
            "custom_system_prompt""As an AI assistant, ensure your response offers the perfect blend of accuracy, positivity, and intrigue. Strive to be educational while keeping the user engaged.", // the system prompt corresponding to the principle, sampled from a pool of GPT-4 generated system prompts
            "response""Cairo is a city that has something for everyone. Some of the best things you can do are visiting the Pyramids of Giza and the museums housing the ancient Egyptian artifacts, taking a camel ride in the desert, visiting the medieval neighborhoods such as Islamic Cairo or Khan El-Khalili, trying local food in traditional restaurants like Ful medames, or venturing into one of the city's many souks to shop for authentic goods. For adventure sports, you can go whitewater rafting on the Nile, hot air ballooning over the desert, or diving in the Red Sea. Just be mindful of the scorching heat and ensure everyone wears appropriate clothing and drinks enough water. Above all, have fun and enjoy your trip!",
            "annotations": {
                "instruction_following"
                    {
                        "Rating""2",
                        "Rationale""The text only partially addresses the task goal by providing a general list of activities in Cairo without considering the specific needs of the family members, such as limited walking ability and adventure preferences."
                    },
                "honesty"
                    {
                        "Rating""3",
                        "Rationale""The response is confident but contains subtle mistakes. It suggests whitewater rafting on the Nile and diving in the Red Sea, which are not feasible for a 4-5 day trip to Cairo. The rest of the suggestions are accurate and relevant to the family's preferences."
                    },
                "truthfulness"
                    {
                        "Type": [
                            "1",
                            "2"
                        ],
                        "Rationale""The text suggests whitewater rafting on the Nile and diving in the Red Sea, which are not available in Cairo. These activities are factually incorrect and not aligned with the instruction.",
                        "Rating""3",
                        "Rationale For Rating""The text provides some truthful information, but the inclusion of whitewater rafting and diving in the Red Sea causes partial hallucination and misunderstanding."
                    },
                "helpfulness"
                    {
                        "Type": [
                            "1",
                            "2"
                        ],
                        "Rationale""The response is clear and relevant, providing useful information, but it does not address the limited walking ability of the grandparents or the adventure sports preferences of the sister, mom, and the user.",
                        "Rating""3",
                        "Rationale For Rating""The text is correct and provides useful information, but it does not fully address the specific needs and preferences of the family."
                    }
            }
        },
        { // completion 2
            ...
        },
        { // completion 3
            ...
        },
        { // completion 4
            ...
        }
    ]
}

三、其他已知的偏好强化数据

1、CValues

该项目开源了数据规模为145k的价值对齐数据集,该数据集对于每个prompt包括了拒绝&正向建议 (safe and reponsibility) > 拒绝为主(safe) > 风险回复(unsafe)三种类型,可用于增强SFT模型的安全性或用于训练reward模型。

大模型对齐强化开源数据集必备:兼谈ULTRAFEEDBACK偏好数据集构建思路

地址:https://github.com/X-PLUG/CValues

2、GPT-4-LLM

该项目开源了由GPT4生成的多种数据集,包括通过GPT4生成的中英PPO数据,可以用于奖励模型的训练。

大模型对齐强化开源数据集必备:兼谈ULTRAFEEDBACK偏好数据集构建思路

地址:https://github.com/Instruction-Tuning-with-GPT-4/GPT-4-LLM

3、zhihu_rlhf_3k

该项目开源了3k+条基于知乎问答的人类偏好数据集,每个实际的知乎问题下给出了赞同数据较高(chosen)和较低(rejected)的回答,可以用于奖励模型的训练。

大模型对齐强化开源数据集必备:兼谈ULTRAFEEDBACK偏好数据集构建思路

地址:https://huggingface.co/datasets/liyucheng/zhihu_rlhf_3k

4、hh_rlhf_cn

基于Anthropic论文Training a Helpful and Harmless Assistant with Reinforcement Learning from Human Feedback 开源的helpful 和harmless数据,使用翻译工具进行了翻译。

大模型对齐强化开源数据集必备:兼谈ULTRAFEEDBACK偏好数据集构建思路

地址:https://huggingface.co/datasets/dikw/hh_rlhf_cn

总结

本文对ULTRAFEEDBACK工作进行了介绍,并介绍现有的一些其他的开源评测数据集,供大家一起参考。

数据工程很重要,但最近有个新的思考:我们虽然可以快速构建出许多数据,但找到数据跟模型效果之间的对应关系,兴许更为重要。

参考文献

1、https://arxiv.org/abs/2310.01377

关于我们

老刘,刘焕勇,NLP开源爱好者与践行者,主页:https://liuhuanyong.github.io。

老刘说NLP,将定期发布语言资源、工程实践、技术总结等内容,欢迎关注。

对于想加入更优质的知识图谱、事件图谱、大模型AIGC实践、相关分享的,可关注公众号,在后台菜单栏中点击会员社区->会员入群加入。

​​       

原文始发于微信公众号(老刘说NLP):大模型对齐强化开源数据集必备:兼谈ULTRAFEEDBACK偏好数据集构建思路

版权声明:admin 发表于 2023年10月23日 下午8:33。
转载请注明:大模型对齐强化开源数据集必备:兼谈ULTRAFEEDBACK偏好数据集构建思路 | CTF导航

相关文章

暂无评论

您必须登录才能参与评论!
立即登录
暂无评论...