什么是良好的对齐数据?

自动数据综合研究

指令参数选择

Wei Liu 1  Weihao Zeng∗2  Keqing He3  Yong Jiang4  Junxian He5
1ShanghaiTech University  2Beijing University of Posts and Telecommunications
3Meituan  4Alibaba Group  5The Hong Kong University of Science and Technology
liuwei4@shanghaitech.edu.cnzengwh@bupt.edu.cn
junxianh@cse.ust.hk
Equal Contribution. Order determined by random dice rolling. Work done during WL and WZ’s visit to HKUST.
摘要

指令调优是一种标准技术,用于在初始预训练阶段后使大型语言模型与最终任务和用户偏好保持一致。 最近的研究表明数据工程在指令调整中的关键作用——如果选择得当,只需有限的数据即可实现卓越的性能。 然而,对于什么是好的指令调整数据以进行对齐,以及我们应该如何自动有效地选择数据,我们仍然缺乏原则性的理解。 在这项工作中,我们深入研究了用于对齐的自动数据选择策略。 我们从对照研究开始,跨三个维度测量数据:复杂性、质量和多样性,同时我们检查现有方法并引入增强数据测量的新技术。 随后,我们提出了一个简单的策略来根据测量选择数据样本。 我们提出了 Deita(Data-Efficient 指令调节 for Alignment 的缩写),这是一系列使用我们提出的方法自动选择的数据样本从 LLaMA 和 Mistral 模型进行微调的模型。 根据经验,Deita 的性能更好或与最先进的开源对齐模型相当,仅使用 6K SFT 训练数据样本 - 比基线中使用的数据少 10 倍以上。 当使用直接偏好优化 (DPO) 进行进一步训练时,使用 6K SFT 和 10K DPO 样本训练的 Deita-Mistral-7B + DPO 达到 7.55 MT-Bench 和 90.06% AlpacaEval 分数。 我们预计这项工作将提供自动数据选择工具,促进数据高效对齐。 我们发布我们的模型以及选定的数据集以供未来研究,以更有效地调整模型。111模型检查点和数据资源可在https://github.com/hkust-nlp/deita获取。

1简介

Refer to caption
图1: 数据选择方法的图示。 我们从三个维度衡量数据:复杂性、质量和多样性。 IR分别表示指令和响应。 对于进化复杂度进化质量,我们首先采用基于进化的方法,遵循Xu等人(2023),收集具有不同复杂性或质量的样本>,然后我们要求 ChatGPT(本文中的术语“ChatGPT”指的是 gpt-3.5-turbo-0613)对小型种子数据集的同一数据样本的变体进行排名和评分,并训练我们自己的复杂性和质量计分员根据这些分数。 在最后一步中,我们利用训练有素的评分器并采用评分优先、多样性感知的方法来选择“好的”数据样本,如我们在§3中详细介绍的。

在大语言模型的开发中,将大语言模型与人类偏好相结合是模型准确理解人类指令并生成相关响应的必要步骤。 大语言模型对齐的标准方法包括指令调优和基于人类反馈的强化学习 (RLHF) (Ouyang 等人,2022) 指令调优或监督微调 (SFT) 使用带注释的指令数据细化预训练模型,通常作为 RLHF 之前的基础步骤,以促进模型的初始对齐(Touvron 等人,2023b) 另一方面,RLHF 根据生成的响应的注释反馈,利用强化学习来训练模型。 虽然 RLHF 支撑了 ChatGPT (OpenAI,2022) 和 GPT-4 (OpenAI,2023) 的开发,但最近的研究表明,单独的指令调整可以提供有竞争力的结果(孙等人,2024;周等人,2023)

与传统的任务微调以数据量为重不同,过去的研究认为大语言模型中几乎所有的知识都是在预训练中获得的,而指令调优就是将现有的模型能力朝着期望的方向调整(Zhou等人,2023) 因此,一个相对较小的高质量数据集已被证明足以很好地对齐大语言模型(Taori 等人, 2023; Wang 等人, 2023; Zhou 等人, 2023; Lu 等人, 2023) ,数据集大小从数十万到仅 1000 个示例。 然而,早期研究中这些数据集的构建主要依赖于启发式自动化(例如从 ChatGPT 中蒸馏)或手动选择,目前尚不清楚什么定义了指令调整的良好数据示例,以及如何系统地管理有效的数据集以确保竞争性能用最少的数据量。

在这项工作中,我们试图定义指令调优的“好数据”的特征,在此基础上,我们的目标是以自动方式进一步推动指令调优的数据效率 为此,我们首先从三个关键维度探索各种方法来定量评估数据示例:复杂性质量多样性 我们的假设认为,最有效的指令调整数据集是那些复杂、高质量和多样化的数据集。 我们检查了广泛的数据测量基线并提出了新的指标,这些指标在指令调整后显示出与对齐性能更强的相关性。 Xu 等人 (2023) 中汲取灵感,我们引入了 Evol ComplexityEvol Quality,它们演化单个数据点以产生一系列示例的复杂性或质量各不相同,然后我们使用 ChatGPT 对其中的一小部分进行排名和评分,并训练一个评分器来预测这些分数,如图 1 所示。 这种基于进化的方法会自动生成根据复杂性或质量排序的示例,从而实现增强且更细粒度的数据测量。 结合我们通过模型嵌入距离的多样性度量,我们设计了一个简单的策略来从大型数据池中选择最有效的数据示例。 我们的数据选择训练策略简单有效,为数据高效的指令调整范例铺平了道路——可以自动选择更少的样本,从而产生与在更大的数据集上训练的模型相当甚至超越的性能。

我们提出了 Deita(Data-Efficient 指令调整 for Alignment 的缩写),这是根据 LLaMA (Touvron 等人,2023a; b) 和 Mistral 进行微调的一系列模型(Jiang 等人,2023) 使用我们提出的技术来最大化数据效率。 基于MT-bench (Zheng 等人, 2023)、AlpacaEval (Li 等人, 2023c)、Open大语言模型排行榜( Beeching 等人, 2023) 证明 Deita 能够超越或与最先进的指令相媲美,例如 Zephyr (Tunstall 等人, 2023)、Vicuna (Chiang 等人, 2023) 和 WizardLM (Xu 等人, 2023),同时使用的自动选择数据示例数量减少了 10 倍以上。 例如,Deita-Mistral-7B(我们基于 Mistral-7B 的模型)在使用普通 SFT 训练仅对 6K 数据样本进行训练时,实现了 7.22 MT-bench 和 80.78% AlpacaEval。 配备直接偏好优化后(DPO,Rafailov等人(2023)),Deita-Mistral-7B + DPO,用6K SFT和10K DPO样本训练,获得7.55 MT-Bench 和 90.06% AlpacaEval。 除了 Deita 模型检查点之外,我们还发布了轻便而有效的 SFT 数据集,以促进未来研究的一致性。

2 什么才是适合对齐的良好数据?

在本节中,我们将全面研究指令调优中“好数据”的特征。 我们首先定义数据选择问题(§2.1),在该问题下我们分析数据的不同特征。 然后我们介绍实验设置 (§2.2),探索各种指标来评估数据并检查它们在指令调整中的效果 (§2.3 - 2.5 )。

2.1 数据选择问题

为了研究用于对齐的最佳数据的特征,我们在数据选择的框架内进行分析。 在这种情况下,我们深入研究各种指标来评估数据,然后利用这些指标来选择数据样本的子集以进行指令调整。 所得到的对齐性能用作目标度量是否可以识别有效的指令调整数据示例的指标。 形式上,给定一个大型指令调整数据池 X={x1,x2,,xn},其中 xi 表示指令-响应对形式的单个数据样本。 我们的目标是使用 π 表示的选择策略从 X 中选择大小为 m 的子集 Sπ(m)m 是子集大小,与指令调优中消耗的计算量成比例相关,因此我们也将 m 称为数据预算 通常,我们定义一个指标来评估数据并根据该指标选择数据样本。 将指令调优后的对齐性能表示为Q,数据预算m的最优数据选择策略π满足:

π=argmaxπQ(Sπ(m)). (1)

在接下来的实证研究中,我们将通过根据某些指标选择Sπ(m)并对其进行指令调优,探索各种数据评估指标及其相应的数据选择策略。 接下来,我们详细介绍我们的实验设置。

2.2实验设置

在本节中,我们对单个指标进行对照研究以一次评估数据,并且我们遵循以下过程:(1) 根据给定指标从数据池中选择子集 Sπ(m),(2 ) 使用 Sπ(m) 对预训练模型进行指令调整,以及 (3) 评估所获得模型的指令跟踪能力。 给定数据测量指标,在本文中,我们使选择算法尽可能简单以保持其实用性(例如,选择具有最大复杂性分数的示例),同时将更高级的选择算法留作未来的工作。

数据池:

为了研究大型数据池中的数据选择,我们构建了两个具有不同属性的数据池来模拟不同的实际设置:(1)Xsota,它是通过集成当前状态的数据集构建的艺术对齐大语言模型。 这代表了一个相对复杂、多样化、高质量的数据池的情况,我们的目标是进一步提高这种情况下的数据效率。 具体来说,我们按照 Lu 等人 (2023) 组合数据集 WizardLM (Alpaca)、WizardLM (ShareGPT)、UltraChat (Ding 等人, 2023) 和 ShareGPT (Chiang 等人, 2023),产生 30 万个样本的数据集; (2) Xbase,模拟可用数据池总体质量较低且冗余的情况。 这可能更接近人们在实践中遇到的实际场景。 对于 Xbase,我们使用了 Alpaca (Taori 等人,2023)、Dolly (Conover 等人,2023)、OAssit 的数据(Köpf 等人, 2023) 和 FLAN 2022 (Longpre 等人, 2023) 构建 10 万个样本的数据集。 这些开源指令调优数据集的这种基于质量的分离与Lu等人(2023)中的分析结果大致一致;李等人(2023b) 两个数据池的统计数据总结在表1中。

训练与评估:

在本节的研究中,除非另有说明,我们在指令调优数据集上对 LLaMA-1 13B 进行了干预。 我们假设数据预算 m 为 6K。 我们对所有参数使用相同的超参数,如附录 A 中详述。 为了评估对齐性能,我们利用 MT-Bench,这是一种具有挑战性的基准,通常用于评估指令跟踪能力。 MT-bench 包含跨多个领域的多轮对话,例如写作、推理、数学和编码。 采用 GPT-4 作为评判者,在 MT-bench 中对模型响应进行评分,结果发现与人类的一致性很高(Zheng 等人,2023)

Data Pool Dataset Source Sample Size
Xsota ShareGPT 58 K
UltraChat 105 K
WizardLM 143 K
Xbase Alpaca 52 K
Dolly 15 K
OAssit 10 K
FLAN 2022 23 K
Table 1: Statistics of data pools Xsota and Xbase. The Dataset Source indicates the source of the data used for sampling. The Sample Size represents the number of samples in the respective dataset.
Model Xsota Xbase
Random Selection 5.84 4.93
Instruction Length 5.89 4.00
Perplexity 4.06 1.89
IFD 5.91 2.46
Instag Complexity 6.18 4.98
Direct Scoring (Pool=50K) 5.16 4.87
Instruction Node (Pool=50K) 5.65 4.82
Evol Complexity (Pool=50K) 5.73 5.29
Evol Complexity 6.27 5.57
Table 2: MT-bench of different complexity metrics. All methods select 6K samples. “Pool=50K” denotes the data selection is conducted in a 50K-sized subset due to the cost of using ChatGPT to annotate the entire pool. We include the results of our method on the 50K data pool to make a fair comparison with baselines.

2.3 从复杂性的角度来看——进化复杂性

人们通常认为长、困难、复杂的数据样本更有利于指令调优(Zhao等人,2023;Cao等人,2023) 例如,Xu等人(2023)提示ChatGPT“进化”数据样本,故意增加其复杂性,从而产生了最先进的开源对齐模型WizardLM。 在本节中,我们系统地研究各种指标来评估数据的复杂性,并旨在确定对指令遵循能力贡献最大的复杂性概念。 具体来说,我们只考虑复杂性维度,并将选择策略πcomplexity定义为选择具有最高复杂性分数的m示例。

基线:

我们研究了几种现有的方法作为复杂性指标的基线:(1)随机选择随机选择示例; (2) 指令长度使用指令长度作为复杂度的度量; (3) 以零样本方式使用预训练模型计算出的响应的困惑度作为衡量标准,较大的困惑度分数通常意味着数据样本的难度; (4)直接评分 (陈等人,2023)直接提示ChatGPT对指令的难度和复杂度进行评分; (5) 指令节点 (Zhao等人, 2023)利用ChatGPT将指令转化为语义树,然后采用树中节点的数量作为复杂度度量; (6) Instag Complexity (Lu 等人, 2023) 首先利用 ChatGPT 根据语义和意图对样本进行标记,然后在 ChatGPT 标签上训练基于 LLaMA 的标记器来标记数据。 他们使用标签的数量作为复杂性的代表。 我们采用他们的公共标记器222https://github.com/OFA-Sys/InsTag是一个LLaMA-2 7B模型来标记数据。 (7) IFD (Li 等人, 2023a) 是一种基于响应损失计算的新的复杂性度量。 我们注意到直接评分和指令节点不可扩展,因为它们需要 ChatGPT 来注释整个数据池,这是昂贵的。 为了节省成本,我们首先从每个池中随机抽取 50K 个示例,并应用这两个基线。 这些基线的相应提示(如果适用)如附录E.1所示。

进化复杂性:

受到 Evol-Instruct 的启发,Evol-Instruct 利用 ChatGPT 使示例变得更加复杂,我们提出了 Evol Complexity,这是一种基于进化的复杂性度量。 具体来说,我们收集一个小规模种子数据集 D={(I1(0),R1(0)),,(IN(0),RN(0))},其中 (Ik(0),Rk(0)) 表示指令-响应对。 对于每个指令示例Ik(0),我们使用来自Xu等人(2023)<的In-Depth Evolving Prompt(提示请参阅附录E.2) /t3> 通过添加约束、深化、具体化和增加推理步骤等技术来增强复杂性。 经过 M 次迭代后,我们获得了 Ik{Ik(0),,Ik(M)} 的一组不同复杂度的指令。 这里我们将M设置为5,总共获得6种变化。

如图1左侧所示,我们让ChatGPT对这6个样本进行排序和打分(附录E.2中提示),得到复杂度得分c 与说明相对应。 我们强调,与直接评分不同,我们在一个提示中给 ChatGPT 全部 6 个样本 - 这些样本代表同一原始样本的不同进化阶段,这样的评分方案有助于 ChatGPT 捕获它们之间微小的复杂性差异,从而得出复杂性分数以实现样本之间更细粒度的复杂性区分。 我们发现这一点至关重要,否则 ChatGPT 往往会为大多数示例分配相似的分数,如附录 B 中所示。 在小种子数据集上获得 ChatGPT 分数后,我们使用这些分数训练 LLaMA-1 7B 模型,以预测给定输入指令的复杂性分数。 在多回合对话中,我们对每一回合单独评分,并将它们的总和作为最终得分。 在本文中,我们使用从 Alpaca (Taori 等人,2023) 中随机采样的 2K 个示例作为种子数据集。

结果:

2展示了使用各种复杂度指标从XsotaXbase中选择6K数据样本的结果。 我们的进化复杂性带来最佳的对齐性能。 我们观察到,虽然 Instag Complexity 在 Xsota 上表现良好,但在 Xbase 上的表现仅比随机选择稍好一些。 相比之下,Evol Complexity 在两个数据集上都实现了卓越的性能,表明在不同数据集池中具有很强的鲁棒性。 与严重依赖 ChatGPT 注释的方法(例如直接评分和指令节点)相比,我们的方法还具有显着的优势。 结果还表明,指令长度并不是对齐首选数据的良好指标。 有趣的是,困惑度(一种直观的复杂性衡量标准)产生的结果比随机选择基线差得多。 通过进一步的调查,我们发现具有大困惑度的样本通常表现出非常短的响应。

2.4从质量角度来看——Evol质量

正如 Zheng 等人 (2023) 所表明的那样,一般来说,能够提供准确、详细、有帮助的回答的大语言模型受到人们的青睐。 在本节中,我们进行了一项对照研究,以检查用于评估样本质量的各种指标。 Evol Complexity类似,我们设计了一种基于质量的选择策略πquality,使我们能够根据不同的测量选择具有最高质量分数的m样本。 接下来,我们将介绍检查的基线和我们新提出的质量评估方法。

基线:

我们检查了作为质量评估基线的现有方法:(1)随机选择随机选择示例。 (2)响应长度采用响应长度作为质量度量。 (3) 直接评分 (陈等人, 2023)提示ChatGPT直接评估对指令响应的准确性。 相关提示显示在附录E.3中。

进化品质:

以类似于Evol Complexity的方式,我们引入Evol Quality来增强质量测量的辨别力。 对于给定的数据样本(Ik(0),Rk(0)),我们提示ChatGPT以进化的方式提高响应的质量(提示的附录E.4)。 这主要涉及增强帮助性、增强相关性、丰富深度、培养创造力和提供额外的细节。 M 次迭代之后,对于相同的指令 Ik(0),我们为 Rk 获取一组涵盖各种质量的响应,表示为 {Rk(0),,Rk(M)} Evol Complexity 类似,我们将 M 设置为 5。

如图1中部所示,然后我们指示ChatGPT根据响应质量对这些响应进行排序和评分,从而获得每个响应对应的质量得分q (提示模板参见附录E.4)。 Evol Complexity类似,这种评分方法能够帮助ChatGPT辨别不同质量的响应之间的细微差别,从而提供更细致的质量分数区分,如附录B 我们利用从种子数据集导出的分数来计算 LLaMA-1 7B,使其能够根据提供的指令-响应对来预测质量分数。 种子数据集与 Evol Complexity 的数据集相同,具有来自 Alpaca 数据集的 2K 随机样本。

结果:

3给出了分别从XsotaXbase中选择前6K数据的实验结果。 所提出的Evol Quality方法始终表现出卓越的对齐性能。 我们注意到,具有较高质量方差 Xbase 的池更容易受到质量指标的影响,这是直观的,因为此类池中存在许多低质量的示例,并且会严重损害性能。 这一结果意味着质量是一个需要考虑的必要维度,尤其是在处理包含大量低质量示例的数据池时。 我们还观察到响应长度与最终对齐性能正相关,但对于已经高质量的数据集(例如 Xsota),其影响并不显着

Model Xsota Xbase
Random Selection 5.84 4.93
Response Length 5.94 5.65
Direct Scoring (Pool=50K) 5.61 4.44
Evol Quality (Pool=50K) 5.85 5.29
Evol Quality 6.19 5.67
Table 3: MT-bench of different quality measurements. All methods select 6K samples for training. “Pool=50K” denotes the data selection procedure is conducted in a 50K-sized subset due to the cost of ChatGPT to annotate the entire pool. We include the results of our method on the 50K data pool to make a fair comparison with the baselines.
Model Xsota Xbase
Random Selection 5.82 4.34
Instag Diversity 6.10 4.46
Repr Filter 6.17 4.68
Table 4: MT-bench scores of different diversity measurements. All methods select 6K samples for instruction tuning.

2.5 从多样性的角度来看——基于嵌入的方法

作为一般原则,先进的大语言模型应该善于处理人类的各种请求。 因此,用于指令调整的数据需要保持最大的多样性。 然而,现实世界的数据经常表现出冗余(Abbas等人,2023) 在本研究中,我们通过进行受控实验来探索数据多样性对对齐的影响,然后引入一种简单而有效的策略πdiversity来保持所选数据子集中的多样性和简洁性。

设置:

在这项工作中,我们提出了一种迭代方法来确保所选数据的多样性。 xiS 带来多样性时,迭代法会从样本池 X 中逐个挑选样本 xi 到选定的数据集 S 中。这个过程一直持续到达到预算 m 或列举完 X 中的所有 xi 为止。 为了澄清,我们将新考虑的样本 xi 带来的多样性好处表述为指示函数 𝟙[(xi,S)],仅当 (xi,S) 为 True 时才等于 1,并且否则为 0。 (我们稍后将定义)是评估xi相对于所选数据集S是否表现出多样性的函数。只有当𝟙[(xi,S)]等于1时,xi才会被添加到S中。其他设置详细信息请参见附录 A

基线:

除了随机选择之外,我们还进一步评估 Instag 多样性 (Lu 等人, 2023),该多样性经过迭代设计以确保所选数据集内的多样性。 它利用S标签集的增长作为定义函数的度量。 具体来说,它制定了t = |TSTxi|>|TS|,其中TS表示S中所有标签的集合,Txi 表示与xi关联的标签。

重复过滤器:

我们检查基于嵌入的方法,我们将其称为Repr Filter 具体来说,我们以样本xi与其S中最近邻居之间的距离作为定义的度量。 我们利用 LLaMA-1 13B 模型对句子进行编码并计算余弦距离 d,然后计算 d<τ,其中 τ(0,1) 是阈值超参数。 这意味着,当 xi 与其最近邻居之间的嵌入距离小于阈值时,我们认为示例 xi 可以增加 S 的多样性。 在数据选择过程中,我们首先根据复杂性和质量分数对数据池X进行排序,我们将在§3.1中详细说明,然后我们逐一检查每个样本并放入xiS(如果 d<τ),其中 S 初始化为空。 这个过程一直持续到 S 的大小达到数据预算 m 时为止。在本文的所有相关实验中,我们将阈值 τ 设置为 0.9,同时在附录 C.1 中提供了对 τ 和不同句子表示法的分析结果。

结果:

4分别展示了XsotaXbase中不同多样性策略的结果。 将随机选择与其他两种确保多样性的策略进行比较,使用随机选择的数据训练的模型明显低于其他模型,这证明了多样性的关键作用。 我们的方法在两个数据池上的表现都优于 Instag Diversity。

3 Deita——用于对齐的数据高效指令调节

基于我们在§2中的探索,我们提出了一种简单的方法来选择数据样本,考虑所有三个维度、复杂性、质量和多样性。 利用选定的子集,我们训练我们的模型 Deita ,尝试实现极其 Data-E 高效 I 调整A调整的指令。 下面,我们详细介绍我们的数据选择方法和模型。

3.1方法

算法1 分数优先、具有多样性意识的数据选择
1: Input: The data pool X, data budget m
2: Output: The selected subset SπDeita(m)
3: Initialize Empty Dataset SπDeita(m)
4: Sorting X with the combined complexity score and quality score s=qc;
5: Getting the sorted Pool X;
6: for Each Sample xX do
7: // d(x,S) denotes the distance between x and its nearest neighbor in S
8: if d(x,SπDeita(m))<τ then
9: SπDeita(m)SπDeita(m){x}
10: else
11: Continue
12: end if
13: XX{x}
14: if |SπDeita(m)| equals to m then
15: Break
16: end if
17: end for

分数优先、具有多样性意识的数据选择:

虽然有多种方法可以将复杂性、质量和多样性衡量标准结合起来,但我们的目标是使其尽可能简单实用。 直观上,希望选择具有高复杂性和质量分数的样本,但保持集合的多样性。 为此,我们提出了一种分数优先、多样化感知的数据选择策略,表示为πDeita 我们的策略采用了新的 evol 分数 s,通过将复杂性分数 c 与质量分数 q 相乘作为 scq 来结合复杂性和质量。 对于多轮对话,我们计算每一轮的分数,将它们相加以获得整个对话的最终分数。 接下来,我们使用 sX 中的所有样本进行排序,产生排序后的池 X=(x1,x2,,xn),其中 x0 表示具有最高 evol 的样本分数。 SπDeita1=(x0)开始,按照Repr Filter策略,迭代地从X/SπDeita中逐一选择数据,并丢弃SπDeita的冗余样本>。 通过集成 evol 分数和 Repr 过滤器,我们的方法保证了结果数据集的复杂性、质量和多样性。 我们的数据选择方法如图1右侧所示,并在算法1中进行了总结。

训练Deita

我们使用选定的数据集和 m 样本来训练 Deita 我们将结果模型表示为Deitam 在本文中,我们分别基于LLaMA-1-13B、LLaMA-2-13B和Mistral-7B训练Deita模型,训练细节在附录A中描述>。

3.2实验设置

我们分别用 6K 和 10K 示例的数据预算训练 Deita 模型。 我们从数据池Xsota中选择数据样本。 我们采用MT-Bench、AlpacaEval和Open大语言模型排行榜作为自动评估的基准。 开放大语言模型排行榜由四个分类任务组成:ARC (Clark 等人, 2018)、HellaSwag (Zellers 等人, 2019)、MMLU (Hendrycks)等人,2021),以及TruthfulQA (林等人,2022) 我们还在附录D中提供了人工评估结果。我们首先以 LLaMA-1-13B 作为主干,并将 Deita 与其他数据选择方法进行比较,例如 LIMA (Zhou 等人, 2023)、Alpagasus (Chen等人,2023)和TAGLM (卢等人,2023) 然后我们将基于 LLaMA-1-13B、LLaMA-2-13B 和 Mistral-7B 的 Deita 模型与其他性能最佳的开源模型(例如 Vicuna、WizardLM、Mistral-Instruct)进行比较(Jiang 等人, 2023) 和 Zephyr。 在本文中,我们主要关注使用 SFT 对齐的模型,而不使用偏好训练,因为我们的贡献在于 SFT 阶段的数据选择,同时我们也运行直接偏好优化(DPO,Rafailov 等人(2023) )在我们最好的 SFT 模型之上,报告更强的性能作为参考点。 对于 DPO 训练,我们随机采样了 Zephyr 中使用的 10K 个比较数据对,这些数据对最初是从 UltraFeedback 数据集 (Cui 等人, 2023) 获得的。

3.3结果

Model Data Size MT-Bench AlpacaEval(%)
Random 6K 5.84 73.91
Alpagasus (Pool=50K) 6K 5.61 71.21
LIMA 1K 4.29 41.98
TAGLM 6K 6.09 72.80
Deita-LLaMA1-13B6K 6K 6.46 77.08
表 5: 不同数据选择方法的比较,骨干是LLaMA-1-13B。 对于 Alpagasus,由于成本原因,我们无法使用 ChatGPT 对池中的所有示例进行评分,因此我们对 50K 随机示例进行评分并进行选择。 表示使用他们发布的LLaMA-7B标注器模型获得的结果进行公平比较。
Model Data Size / Alignment MT-Bench AlpacaEval(%)
Proprietary Models
GPT-4 8.99 95.28
Claude-v2 8.06 91.36
gpt-3.5-turbo 7.90 89.37
Open-sourced Models based on LLaMA-1-13B
Alpaca-13B 52K / SFT 4.53
WizardLM-13B 70K / SFT 6.35 75.31
Vicuna-13B-v1.3 125K / SFT 6.39 82.11
TAGLM-13B 6K / SFT 6.09 72.80
Random-Select 10K / SFT 6.03 71.52
Deita-LLaMA1-13B6K 6K / SFT 6.46 77.08
Deita-LLaMA1-13B10K 10K / SFT 6.60 78.01
Open-sourced Models based on LLaMA-2-13B
LLaMA2-13B-Chat >100K / SFT + >1M / RLHF 6.65 81.09
Vicuna-13B-v1.5 125K / SFT 6.57 78.80
Tülü 2 13B 326K / SFT 6.70 78.90
Tülü 2 + DPO 13B 326K / SFT + 60K / DPO 7.00 89.50
Random-Select 10K / SFT 5.78 65.19
Deita-LLaMA2-13B6K 6K / SFT 6.65 80.75
Deita-LLaMA2-13B10K 10K / SFT 6.79 81.09
Open-sourced Models based on Mistral-7B
Mistral-7B-Instruct-v0.1 6.84 69.65
Mistral-7B-Instruct-v0.2 7.60 93.65
zephyr-beta-sft 200K / SFT 5.32 75.12
zephyr-beta 200K / SFT + 60K / DPO 7.34 90.60
Random-Select 10K / SFT 5.89 56.90
Deita-Mistral-7B6K 6K / SFT 7.22 80.78
Deita-Mistral-7B10K 10K / SFT 7.32 81.67
Deita-Mistral-7B6K + DPO 6K / SFT +10K / DPO 7.55 90.06
表 6: MT-Bench 和 AlpacaEval 上不同指令调整模型的结果。 同一基本模型中最佳的仅 SFT 数字以粗体显示,而总体最佳数字则以下划线显示。 表示使用他们发布的LLaMA-7B标注器模型获得的结果进行公平比较。 Zephyr-beta-sft 是监督微调(SFT)阶段之后的官方检查点。 我们注意到该检查点的性能低于预期。 我们推测原因是该检查点不是他们论文中报告的最佳 SFT 检查点,因为该检查点用于进一步的 DPO 训练。

主要比较:

我们首先将Deita与表5中的其他数据选择方法进行比较,其中Deita-LLaMA16K明显优于其他方法大幅提高。 在表6中,我们分别使用我们选择的6K和10K数据训练LLaMA-1-13B、LLaMA-2-13B和Mistral-7B,并与其他最先进的SFT进行比较模型以及随机数据选择基线(随机选择)。 在所有三个骨干模型中,SFT 对齐的 Deita 模型优于几乎所有其他 SFT 对齐的模型。 基于 LLaMA-2 的 Deita 模型甚至优于经过 RLHF 训练和精心设计的人工注释的 LLaMA2-13B-Chat。 值得注意的是,基于 Mistral-7B 的 Deita-Mistral-7B10K 获得了 7.32 MT-Bench 分数,这是所有开放式平台中最先进的结果。 7B 和 13B 尺寸的源 SFT 模型。 同时,我们注意到Deita在AlpacaEval上的增益与MT-Bench上的增益并不一致。 为了分析MT-Bench和AlpacaEval之间的差异,我们在MT-Bench上绘制了8个子任务的标准雷达图,如图3所示。 它清楚地表明,Deita Mistral 模型由于编码、数学和推理等高级能力的增强而获得了较高的 MT-Bench 分数,而这些在 AlpacaEval 中并不突出。 当配备 DPO 训练时,我们的 Deita-Mistral-7B10K+DPO 变体达到 7.55 MT-Bench 和 90.06% AlpacaEval 分数,与训练的 zephyr-beta 相当数据增加了 30 倍,并且稍微落后于最近的 Mistral-7B-Instruct-v0.2 模型,该模型的对齐方法和数据不公开。

开放大语言模型排行榜结果:

我们将Deita与其他SOTA模型以及开放大语言模型排行榜上的随机数据选择基线(Random-Select)进行比较,结果如表7所示。 我们的 Deita SFT 模型虽然仅使用 6K 或 10K 数据进行训练,但在跨不同骨干网的 SFT 对齐模型中实现了最佳平均结果。 进一步的DPO训练使Deita-Mistra-7B的性能平均提升了5点左右,并有助于超越Zephyr。

Model Data Size / Alignment ARC HellaSwag MMLU TruthfulQA Average
Open-sourced Models based on LLaMA-1
LIMA 1K / SFT 59.22 84.25 49.60 46.20 59.82
WizardLM-13B 70K / SFT 57.25 80.88 52.92 50.55 58.96
Vicuna-13B-v1.3 125K / SFT 54.61 80.41 52.88 52.14 60.01
Random-Select 10K / SFT 55.80 79.95 47.35 57.44 60.14
Deita-LLaMA1-13B10K 10K / SFT 59.47 82.01 60.60 55.03 64.27
Open-sourced Models based on LLaMA-2
Vicuna-13B-v1.5 125K / SFT 57.08 81.24 56.67 51.51 61.63
Random-Select 10K / SFT 61.52 83.69 55.22 44.84 61.32
Deita-LLaMA2-13B10K 10K / SFT 58.87 82.08 55.33 54.57 62.71
Open-sourced Models based on Mistral-7B
Mistral-7B-Instruct-v0.1 54.52 75.63 55.38 56.28 60.45
zephyr-beta-sft 200K / SFT 57.68 81.98 61.04 43.00 60.93
zephyr-beta 200K / SFT + 60K / DPO 62.03 84.52 61.44 57.44 66.36
Random-Select 10K / SFT 55.38 79.16 58.73 53.59 61.72
Deita-Mistral-7B6K 6K / SFT 57.76 80.29 61.90 59.82 64.94
Deita-Mistral-7B6K+DPO 6K / SFT +10K / DPO 66.21 85.42 60.66 67.14 69.86
表 7: 开放大语言模型排行榜上的结果。 除非另有说明,默认情况下数据大小表示 SFT 中示例的数量。
Refer to caption
Figure 2: Data-scaling results on MT-Bench. The X-axis represents the # samples used.
Refer to caption
Figure 3: Radar plot of detailed scores for Deita models and major baselines on 8 subtasks on MT-Bench.

数据缩放:

为了研究不同数据选择策略的数据扩展效果,我们用不同数据预算 mXsota 子集进行实验。图 3 说明我们的 Deita 模型在不同数据量上始终提供最佳数据选择性能。 值得注意的是,Deita 训练 取得了与仅使用 3K 样本使用所有 300K 样本相当的结果,数据减少了 100 倍。 有趣的是,我们发现,在我们的数据选择方法下,随着所选数据数量的增加,最终性能最初呈现上升趋势,但最终下降。 这表明,即使对于像Xsota这样相对复杂、多样化、高质量的数据池,真正“适合对齐的好数据”的比例也是有限的。 这一现象证实了即使我们添加更多数据并使用更多计算,对齐的性能也不一定会提高,这意味着数据选择的重要性。

4结论

在本文中,我们彻底研究了什么是适合对齐的良好数据的问题。 我们的研究包括三项对照研究,涵盖三个维度:复杂性、质量和多样性。 在这些研究中,我们提出了自动数据选择的新方法,并根据所选数据训练我们的模型 Deita 实验结果表明,Deita 能够通过 10 倍训练样本实现优于或媲美最先进开源模型的性能。 我们发布选定的数据,以更有效地调整模型。

致谢

该项目得到了腾讯微信组的部分支持。

参考

  • Abbas et al. (2023) Amro Kamal Mohamed Abbas, Kushal Tirumala, Daniel Simig, Surya Ganguli, and Ari S. Morcos. Semdedup: Data-efficient learning at web-scale through semantic deduplication. In ICLR 2023 Workshop on Multimodal Representation Learning: Perks and Pitfalls, 2023. URL https://openreview.net/forum?id=u96ZBg_Shna.
  • Beeching et al. (2023) Edward Beeching, Clémentine Fourrier, Nathan Habib, Sheon Han, Nathan Lambert, Nazneen Rajani, Omar Sanseviero, Lewis Tunstall, and Thomas Wolf. Open llm leaderboard. https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard, 2023.
  • Bhatia et al. (2023) Kush Bhatia, Avanika Narayan, Christopher De Sa, and Christopher Ré. TART: A plug-and-play transformer module for task-agnostic reasoning. In Alice Oh, Tristan Naumann, Amir Globerson, Kate Saenko, Moritz Hardt, and Sergey Levine (eds.), Advances in Neural Information Processing Systems 36: Annual Conference on Neural Information Processing Systems 2023, NeurIPS 2023, New Orleans, LA, USA, December 10 - 16, 2023, 2023. URL http://papers.nips.cc/paper_files/paper/2023/hash/1ece70d2259b8e9510e2d4ca8754cecf-Abstract-Conference.html.
  • Cao et al. (2023) Yihan Cao, Yanbin Kang, and Lichao Sun. Instruction mining: High-quality instruction data selection for large language models. ArXiv preprint, abs/2307.06290, 2023. URL https://arxiv.org/abs/2307.06290.
  • Chen et al. (2023) Lichang Chen, Shiyang Li, Jun Yan, Hai Wang, Kalpa Gunaratna, Vikas Yadav, Zheng Tang, Vijay Srinivasan, Tianyi Zhou, Heng Huang, et al. Alpagasus: Training a better alpaca with fewer data. ArXiv preprint, abs/2307.08701, 2023. URL https://arxiv.org/abs/2307.08701.
  • Chiang et al. (2023) Wei-Lin Chiang, Zhuohan Li, Zi Lin, Ying Sheng, Zhanghao Wu, Hao Zhang, Lianmin Zheng, Siyuan Zhuang, Yonghao Zhuang, Joseph E Gonzalez, et al. Vicuna: An open-source chatbot impressing gpt-4 with 90%* chatgpt quality. See https://vicuna. lmsys. org (accessed 14 April 2023), 2023.
  • Clark et al. (2018) Peter Clark, Isaac Cowhey, Oren Etzioni, Tushar Khot, Ashish Sabharwal, Carissa Schoenick, and Oyvind Tafjord. Think you have solved question answering? try arc, the ai2 reasoning challenge, 2018.
  • Conover et al. (2023) Mike Conover, Matt Hayes, Ankit Mathur, Xiangrui Meng, Jianwei Xie, Jun Wan, Sam Shah, Ali Ghodsi, Patrick Wendell, Matei Zaharia, et al. Free dolly: Introducing the world’s first truly open instruction-tuned llm, 2023.
  • Cui et al. (2023) Ganqu Cui, Lifan Yuan, Ning Ding, Guanming Yao, Wei Zhu, Yuan Ni, Guotong Xie, Zhiyuan Liu, and Maosong Sun. Ultrafeedback: Boosting language models with high-quality feedback, 2023.
  • Dao (2023) Tri Dao. FlashAttention-2: Faster attention with better parallelism and work partitioning. ArXiv preprint, abs/2307.08691, 2023. URL https://arxiv.org/abs/2307.08691.
  • Ding et al. (2023) Ning Ding, Yulin Chen, Bokai Xu, Yujia Qin, Shengding Hu, Zhiyuan Liu, Maosong Sun, and Bowen Zhou. Enhancing chat language models by scaling high-quality instructional conversations. In Houda Bouamor, Juan Pino, and Kalika Bali (eds.), Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pp. 3029–3051, Singapore, 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.emnlp-main.183. URL https://aclanthology.org/2023.emnlp-main.183.
  • Hendrycks et al. (2021) Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob Steinhardt. Measuring massive multitask language understanding. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net, 2021. URL https://openreview.net/forum?id=d7KBjmI3GmQ.
  • Jiang et al. (2023) Albert Q. Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, Lélio Renard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothée Lacroix, and William El Sayed. Mistral 7B, 2023.
  • Köpf et al. (2023) Andreas Köpf, Yannic Kilcher, Dimitri von Rütte, Sotiris Anagnostidis, Zhi-Rui Tam, Keith Stevens, Abdullah Barhoum, Nguyen Minh Duc, Oliver Stanley, Richárd Nagyfi, et al. Openassistant conversations–democratizing large language model alignment. ArXiv preprint, abs/2304.07327, 2023. URL https://arxiv.org/abs/2304.07327.
  • Li et al. (2023a) Ming Li, Yong Zhang, Zhitao Li, Jiuhai Chen, Lichang Chen, Ning Cheng, Jianzong Wang, Tianyi Zhou, and Jing Xiao. From quantity to quality: Boosting llm performance with self-guided data selection for instruction tuning. ArXiv preprint, abs/2308.12032, 2023a. URL https://arxiv.org/abs/2308.12032.
  • Li et al. (2023b) Xian Li, Ping Yu, Chunting Zhou, Timo Schick, Luke Zettlemoyer, Omer Levy, Jason Weston, and Mike Lewis. Self-alignment with instruction backtranslation. ArXiv preprint, abs/2308.06259, 2023b. URL https://arxiv.org/abs/2308.06259.
  • Li et al. (2023c) Xuechen Li, Tianyi Zhang, Yann Dubois, Rohan Taori, Ishaan Gulrajani, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. Alpacaeval: An automatic evaluator of instruction-following models. https://github.com/tatsu-lab/alpaca_eval, 2023c.
  • Lin et al. (2022) Stephanie Lin, Jacob Hilton, and Owain Evans. TruthfulQA: Measuring how models mimic human falsehoods. In Smaranda Muresan, Preslav Nakov, and Aline Villavicencio (eds.), Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 3214–3252, Dublin, Ireland, 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-long.229. URL https://aclanthology.org/2022.acl-long.229.
  • Longpre et al. (2023) Shayne Longpre, Le Hou, Tu Vu, Albert Webson, Hyung Won Chung, Yi Tay, Denny Zhou, Quoc V. Le, Barret Zoph, Jason Wei, and Adam Roberts. The flan collection: Designing data and methods for effective instruction tuning. In Andreas Krause, Emma Brunskill, Kyunghyun Cho, Barbara Engelhardt, Sivan Sabato, and Jonathan Scarlett (eds.), International Conference on Machine Learning, ICML 2023, 23-29 July 2023, Honolulu, Hawaii, USA, volume 202 of Proceedings of Machine Learning Research, pp. 22631–22648. PMLR, 2023. URL https://proceedings.mlr.press/v202/longpre23a.html.
  • Lu et al. (2023) Keming Lu, Hongyi Yuan, Zheng Yuan, Runji Lin, Junyang Lin, Chuanqi Tan, Chang Zhou, and Jingren Zhou. # instag: Instruction tagging for analyzing supervised fine-tuning of large language models. arXiv e-prints, pp. arXiv–2308, 2023.
  • Muennighoff et al. (2023) Niklas Muennighoff, Nouamane Tazi, Loic Magne, and Nils Reimers. MTEB: Massive text embedding benchmark. In Andreas Vlachos and Isabelle Augenstein (eds.), Proceedings of the 17th Conference of the European Chapter of the Association for Computational Linguistics, pp. 2014–2037, Dubrovnik, Croatia, 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.eacl-main.148. URL https://aclanthology.org/2023.eacl-main.148.
  • OpenAI (2022) OpenAI. Chatgpt: Optimizing language models for dialogue. OpenAI Blog, 2022. URL https://openai.com/blog/chatgpt/.
  • OpenAI (2023) OpenAI. Gpt-4 technical report, 2023.
  • Ouyang et al. (2022) Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. In Advances in Neural Information Processing Systems, 2022.
  • Rafailov et al. (2023) Rafael Rafailov, Archit Sharma, Eric Mitchell, Stefano Ermon, Christopher D Manning, and Chelsea Finn. Direct preference optimization: Your language model is secretly a reward model. In Advances in Neural Information Processing Systems, 2023.
  • Ren et al. (2021) Jie Ren, Samyam Rajbhandari, Reza Yazdani Aminabadi, Olatunji Ruwase, Shuangyan Yang, Minjia Zhang, Dong Li, and Yuxiong He. ZeRO-Offload: Democratizing Billion-Scale model training. In 2021 USENIX Annual Technical Conference (USENIX ATC 21), pp. 551–564, 2021.
  • Sun et al. (2024) Zhiqing Sun, Yikang Shen, Qinhong Zhou, Hongxin Zhang, Zhenfang Chen, David Cox, Yiming Yang, and Chuang Gan. Principle-driven self-alignment of language models from scratch with minimal human supervision. Advances in Neural Information Processing Systems, 36, 2024.
  • Taori et al. (2023) Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. Stanford alpaca: An instruction-following llama model. https://github.com/tatsu-lab/stanford_alpaca, 2023.
  • Touvron et al. (2023a) Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and efficient foundation language models. ArXiv preprint, abs/2302.13971, 2023a. URL https://arxiv.org/abs/2302.13971.
  • Touvron et al. (2023b) Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, et al. Llama 2: Open foundation and fine-tuned chat models. ArXiv preprint, abs/2307.09288, 2023b. URL https://arxiv.org/abs/2307.09288.
  • Tunstall et al. (2023) Lewis Tunstall, Edward Beeching, Nathan Lambert, Nazneen Rajani, Kashif Rasul, Younes Belkada, Shengyi Huang, Leandro von Werra, Clémentine Fourrier, Nathan Habib, Nathan Sarrazin, Omar Sanseviero, Alexander M. Rush, and Thomas Wolf. Zephyr: Direct distillation of lm alignment, 2023.
  • Wang et al. (2022) Liang Wang, Nan Yang, Xiaolong Huang, Binxing Jiao, Linjun Yang, Daxin Jiang, Rangan Majumder, and Furu Wei. Text embeddings by weakly-supervised contrastive pre-training. ArXiv preprint, abs/2212.03533, 2022. URL https://arxiv.org/abs/2212.03533.
  • Wang et al. (2023) Yizhong Wang, Yeganeh Kordi, Swaroop Mishra, Alisa Liu, Noah A. Smith, Daniel Khashabi, and Hannaneh Hajishirzi. Self-instruct: Aligning language models with self-generated instructions. In Anna Rogers, Jordan Boyd-Graber, and Naoaki Okazaki (eds.), Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 13484–13508, Toronto, Canada, 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.acl-long.754. URL https://aclanthology.org/2023.acl-long.754.
  • Xu et al. (2023) Can Xu, Qingfeng Sun, Kai Zheng, Xiubo Geng, Pu Zhao, Jiazhan Feng, Chongyang Tao, and Daxin Jiang. Wizardlm: Empowering large language models to follow complex instructions. ArXiv preprint, abs/2304.12244, 2023. URL https://arxiv.org/abs/2304.12244.
  • Zellers et al. (2019) Rowan Zellers, Ari Holtzman, Yonatan Bisk, Ali Farhadi, and Yejin Choi. HellaSwag: Can a machine really finish your sentence? In Anna Korhonen, David Traum, and Lluís Màrquez (eds.), Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 4791–4800, Florence, Italy, 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1472. URL https://aclanthology.org/P19-1472.
  • Zhao et al. (2023) Yingxiu Zhao, Bowen Yu, Binyuan Hui, Haiyang Yu, Fei Huang, Yongbin Li, and Nevin L Zhang. A preliminary study of the intrinsic relationship between complexity and alignment. ArXiv preprint, abs/2308.05696, 2023. URL https://arxiv.org/abs/2308.05696.
  • Zheng et al. (2023) Lianmin Zheng, Wei-Lin Chiang, Ying Sheng, Siyuan Zhuang, Zhanghao Wu, Yonghao Zhuang, Zi Lin, Zhuohan Li, Dacheng Li, Eric Xing, et al. Judging llm-as-a-judge with mt-bench and chatbot arena. ArXiv preprint, abs/2306.05685, 2023. URL https://arxiv.org/abs/2306.05685.
  • Zhou et al. (2023) Chunting Zhou, Pengfei Liu, Puxin Xu, Srini Iyer, Jiao Sun, Yuning Mao, Xuezhe Ma, Avia Efrat, Ping Yu, Lili Yu, et al. LIMA: Less is more for alignment. In Advances in Neural Information Processing Systems, 2023.

附录 A设置详细信息

基于多样性的数据选择:

在§2.5的对照实验中,我们精心管理所选数据的复杂性和质量,对多样性的影响进行严格的分析,并促进各种方法之间的公平比较。 这是通过确保所选数据S的平均复杂度得分c和质量得分q的乘积与完整数据的各自平均值紧密一致来实现的pool X,通过限制最大值与平均值的偏差为 2。 通过这种方式,我们首先从数据池中选择样本的子集来构建新的池,其中样本具有相似的 cq 分数。 然后我们探索不同的多样性选择方法。

训练Deita

我们利用四/八个 NVIDIA Tesla A100 GPU 来训练 7B/13B 模型。 为了促进并行训练,我们采用了 DeepSpeed Zero-Stage 3 (Ren 等人, 2021) 和 FlashAttention-2 (Dao, 2023) 为了集成多轮对话,我们使用 Vicuna 风格的模板。 在本文的所有实验中,训练参数均设置最大输入长度为2048。 对于基于 LLaMA-1-13B 的 Deita 模型,我们将批量大小设置为 128,训练周期为 6,学习率为 1e-5,温暖比率为 0.03。 对于基于LLaMA-2-13B的Deita模型,我们将batch size设置为128,训练epochs设置为6,学习率设置为2e-5,warm Ratio设置为0.1 follow Lu 等人 ( 2023) 关于在 Mistral-7B 上构建的 Deita 模型,我们遵循 Tunstall 等人 (2023) 的超参数,批量大小为 512,学习率为 2e-5,暖比为0.1 使用余弦预热调度程序进行 SFT,批量大小为 32,学习率 5e-7,预热比率为 0.1,使用线性预热调度程序进行 DPO。 由于使用的训练数据明显较少,为了确保足够的训练,我们将 SFT 的 epoch 增加到 6,将 DPO 的 epoch 增加到 9。

附录 B案例研究

8和表9分别显示了使用我们提出的直接评分方法和排名与评分方法对复杂性和质量进行评分的实例。 对这些实例的分析表明,直接评分倾向于分配相似且过高的分数。 相比之下,我们的方法能够辨别不同样本之间复杂性或质量的细微变化,从而提供具有明显差异的分数。

Case A
Instruciton
Direct
Scroing
Ranking
& Scoring
Rate the given restaurant based on your experience. Restaurant: Pizzeria Garden 4 2
Using your experience as a guide, provide a comprehensive evaluation of Pizzeria
Garden, taking into account factors such as the quality of the food, the level of
service provided, the ambiance of the restaurant, and any other relevant aspects
that may contribute to your overall impression. Please provide a detailed analysis
that requires multiple steps of reasoning to arrive at a final rating.
8 3
Based on your extensive knowledge and expertise, please conduct a thorough and
intricate assessment of Pizzeria Garden, encompassing various elements such as
the excellence of the cuisine, the degree of attentiveness exhibited by the staff, the
atmosphere and mood of the establishment, and any other pertinent factors that
could influence your overall perception. Your evaluation should entail a meticulous
analysis that necessitates multiple layers of reasoning to arrive at a conclusive rating.
8 4
In order to provide a thorough and nuanced evaluation of Pizzeria Garden, we
require your extensive knowledge and specialized expertise. Your assessment should
encompass a wide range of factors, including but not limited to the quality and
inventiveness of the cuisine, the level of attentiveness and professionalism exhibited
by the staff, the ambiance and overall atmosphere of the establishment, as well as
any other pertinent elements that may influence your overall perception. Your
analysis must be meticulous and multifaceted, necessitating a profound level of
reasoning and critical thinking to arrive at a conclusive rating.
8 5
Case B
Instruction
Direct
Scroing
Ranking
& Scoring
Create a birthday wish for someone who loves animals. 8 1
Craft a heartfelt birthday message for an individual who has a deep affection
for a specific type of animal, such as dogs, cats, birds, or reptiles. Incorporate
their passion for this creature into your well wishes to make their special day
even more memorable and meaningful.
8 2
Compose a sincere and thoughtful birthday greeting for an individual who
holds a profound fondness for a particular species of fauna, be it canines,
felines, avians, or cold-blooded creatures. Infuse their ardor for this living
being into your felicitations to elevate their celebratory occasion to a higher
level of significance and remembrance.
7 4
Compose a sincere and introspective birthday greeting for an individual
who harbors a profound and enduring fondness for a particular species
of fauna, be it domestic canines, felines, avians, or reptiles. Integrate their
ardor for this animate being into your felicitations to amplify the significance
and recollection of their festive occasion. Furthermore, contemplate
incorporating individual reminiscences or minutiae about the selected genus
to further individualize the message and showcase your comprehension and
admiration of their passions.
8 6
表8: 通过不同方法生成复杂度分数的案例,包括直接评分和我们提出的排名和评分方法。
Instruction A
Find the title of a book about a political movement in the 1940s.
Response
Direct
Scroing
Ranking
& Scoring
The title of a book about a political movement in the 1940s is
”A Matter Of Resistance: The Struggle for Social Justice and Human
Rights in India’s 1940s”.
4.5 2
One book that delves into the political movement of the 1940s is
”A Matter Of Resistance: The Struggle for Social Justice and Human
Rights in India’s 1940s”. This book provides a detailed account of the
struggle for social justice and human rights during that time period.
It sheds light on the challenges faced by the people and the efforts
made to overcome them. The book is a valuable resource for anyone
interested in understanding the political climate of the 1940s.
4.5 3
One book that delves into the political movement of the 1940s is
”The Struggle for Social Justice and Human Rights in India\’s 1940s”.
This book offers a comprehensive account of the challenges faced by
the people during that time period and the efforts made to overcome
them. It provides valuable insights into the political climate of the
1940s, making it an excellent resource for anyone interested in gaining
a deeper understanding of this era. The book is highly recommended
for those who want to explore the political movement of the 1940s in
greater depth.
4.5 4
The Struggle for Social Justice and Human Rights in India\’s 1940s” is
a book that provides a detailed account of the political movement
during that time period. It offers a comprehensive analysis of the
challenges faced by the people and the efforts made to overcome them.
The book provides valuable insights into the political climate of the 1940s,
making it an excellent resource for anyone interested in gaining a deeper
understanding of this era. It covers various aspects of the political movement,
including the key players, their ideologies, and the impact of their actions.
Overall, ”The Struggle for Social Justice and Human Rights in India\’s 1940s”
is a must-read for those who want to explore the political movement of the
1940s in greater depth.
4.5 5
Instruction B
Generate three new lines for an incomplete poem.
Response
Direct
Scoring
Ranking
& Scoring
That filled the morning air
Spreading joy and cheer
As far as one could see.
4.5 2
Here are three new lines to complete the poem:
The flowers bloomed in the meadow,
Their colors vibrant and bright,
A scene of beauty, a true delight.
4.5 3
Here are three new lines to complete the poem:
The birds chirped their melody
Welcoming the day with glee
Nature’s beauty on full display.
4.5 4
The sun rose in the sky,
Its rays spreading warmth and light,
A new day dawning, full of promise and delight.
The birds joined in with their sweet melody,
A symphony of nature’s harmony,
Welcoming the day with joy and glee.
And as the world awakens, we see,
Nature’s beauty on full display,
A breathtaking sight, for all to see and say.
4.5 5
表 9: 通过不同方法生成质量分数的案例,包括直接评分和我们提出的排名和评分方法。

附录C分析

C.1 Repr过滤器分析

我们使用 0.8 到 0.9 范围内的各种阈值 (τ) 和不同的句子编码方法进行实验,以评估它们对 Repr Filter 的影响。 我们探索了两种对句子进行编码的方法:一种涉及使用模型的表示,该模型将在数据选择后进行训练,而另一种则采用训练有素的句子嵌入模型,例如 E5-Large-V2 (Wang 等人, 2022 ) 我们将前一种方法称为基于模型方法,将后者称为基于语义<​​/t1>方法。 我们利用 LLaMA-1 13B 作为基于模型方法的表示,并使用 E5-Large-V2 来表示基于语义<​​/t1>方法。 对于基于语义<​​/t0>,由于模型的上下文长度有限,我们通过平均其标记的所有嵌入来对一个句子进行编码。

4 展示了我们的 Repr Filter 在不同阈值 τ 和不同句子表示上的结果。 研究结果证明了基于模型的编码方法在不同阈值下的稳健性,与基线方法相比保持了很大的优势。 相反,基于语义的方法的性能随着τ的调整而显着下降。 由于E5-Large-V2在MTEB基准(Muennighoff等人, 2023)中的优越性能,我们推测(Bhatia等人, 2023)的表示来自基于模型的方法不仅对句子中的语义信息进行编码,而且还反映了数据的某些特征以供后续指令调优,我们优先考虑其利用。

Refer to caption
图4: 设置不同 τ 并利用 Xsota 中不同句子表示的结果

附录D人类评估

Deita-LLaMA16k vs. Win Tie Lose
Vicuna 12% 77% 11%
Random Selection 34% 43% 23%
表 10: 人类评估结果。 Vicuna 代表 Vicuna-13B-v1.3 型号。 Deita 和随机选择训练都使用 6K 样本,而 Vicuna 则使用 125K 样本进行训练。 主干模型是LLaMA1-13B。

设置:

由于问题具有挑战性,很难在 MT-Bench 上进行人类评估,因此我们利用 LIMA 测试数据集并随机抽取 100 个数据集作为我们的评估提示。 最初,我们尝试在 MTurk 上发布我们的评估,并进行严格的选择设置,如 Li 等人 (2023b) 中所述。 然而,我们遇到了挑战,因为即使设置了严格的设置,MTurkers 的答案也表现出不一致。 此外,我们观察到 MTurkers 很难很好地遵循指示。 因此,我们招募了 4 名同事研究人员作为我们评估的注释者。 为了确保公正性并隐藏模型偏差,每个注释者都被分配了 50 个样本,但不知道两个响应的来源。 按照 Zhou 等人 (2023) 中概述的方法,为每个问题生成一个答案。 在整个评估过程中,注释者会并排看到来自不同模型的两个回答,并被要求从三个选项中指出他们的首选答案:(1) 答案 A 明显更好,(2) 答案 B 明显更好,或 (3)两者都没有明显好转。 成对比较是盲目进行的,答案对随机洗牌以隐藏其来源。 为了确保人工评估的可靠性,我们进行了注释者间一致性测试。 根据 Zhou 等人 (2023) 概述的方法,我们从评估中随机选择 50 个世代对,并使用平局折扣精度计算作者-注释者一致性分数。 我们的研究结果得出的一致性分数为 77%,该分数相当高,并且与 Zhou 等人 (2023) 中报告的一致性水平一致。 标注界面及提示信息如图5所示。

结果:

我们将 Deita-LLaMA16K 与随机选择基线和 Vicuna-13B-v1.3 进行比较。 在表10中,我们观察到人类偏好与 MT-Bench 上的 GPT-4 评分评估密切相关。 我们的数据选择策略在人类评估方面比随机选择具有显着优势。 Deita-LLaMA16K 在人类评估方面与 Vicuna-13B-v1.3 表现相当,大多数响应被注释者认为是平局。 然而,我们注意到 Deita-LLaMA16K 的训练数据比使用 125K 训练样本的 Vicuna-13B-v1.3 少 20 倍。

Refer to caption
图5: 我们的标注提示和界面的一个示例。

附录E提示示例

E.1 复杂性基线

11显示了直接评分和指令节点等基线使用的提示作为复杂性指标。

E.2 进化复杂性

提示增加复杂性

Prompt Template
Direct Scoring
We would like you to evaluate and rate the difficulty and complexity of the following
question. You should give an overall score on a scale of 1 to 10, where a higher score
indicates higher difficulty and complexity. You must just give a score without any
other reasons.
Question: <Instruction>
Score:
Instruction Node
You need to rewrite the following ”instruction” to a TREE through Semantic Parsin
in the natural language processing field and only count the total node number of the
TREE. You must just give node number without any other reasons.
Instruction: <Instruction>
Node number:
表 11: 复杂度基线对应的提示模板,包括直接评分和指令节点。
Prompt Templates
adding constraints
I want you act as a Prompt Rewriter.
Your objective is to rewrite a given prompt into a more complex version to
make those famous AI systems (e.g., ChatGPT and GPT4) a bit harder to handle.
But the rewritten prompt must be reasonable and must be understood and
responded by humans.
Your rewriting cannot omit the non-text parts such as the table and code in
#Given Prompt#:. Also, please do not omit the input in #Given Prompt#.
You SHOULD complicate the given prompt using the following method:
Please add one more constraints/requirements into #Given Prompt#
You should try your best not to make the #Rewritten Prompt# become verbose,
#Rewritten Prompt# can only add 10 to 20 words into #Given Prompt#.
‘#Given Prompt#’, ‘#Rewritten Prompt#’, ‘given prompt’ and ‘rewritten prompt’
are not allowed to appear in #Rewritten Prompt#
#Given Prompt#:
<Here is instruction>
#Rewritten Prompt#:
deepening
I want you act as a Prompt Rewriter.
Your objective is to rewrite a given prompt into a more complex version to
make those famous AI systems (e.g., ChatGPT and GPT4) a bit harder to handle.
But the rewritten prompt must be reasonable and must be understood and
responded by humans.
Your rewriting cannot omit the non-text parts such as the table and code in
#Given Prompt#:. Also, please do not omit the input in #Given Prompt#.
You SHOULD complicate the given prompt using the following method:
If #Given Prompt# contains inquiries about certain issues, the depth and
breadth of the inquiry can be increased. or
You should try your best not to make the #Rewritten Prompt# become verbose,
#Rewritten Prompt# can only add 10 to 20 words into #Given Prompt#.
‘#Given Prompt#’, ‘#Rewritten Prompt#’, ‘given prompt’ and ‘rewritten prompt’
are not allowed to appear in #Rewritten Prompt#
#Given Prompt#:
<Here is instruction>
#Rewritten Prompt#:
表 12: 提示用于增加指令的复杂性,包括添加约束和深化。
Prompt Templates
concretizing
I want you act as a Prompt Rewriter.
Your objective is to rewrite a given prompt into a more complex version to
make those famous AI systems (e.g., ChatGPT and GPT4) a bit harder to handle.
But the rewritten prompt must be reasonable and must be understood and
responded by humans.
Your rewriting cannot omit the non-text parts such as the table and code in
#Given Prompt#:. Also, please do not omit the input in #Given Prompt#.
You SHOULD complicate the given prompt using the following method:
Please replace general concepts with more specific concepts. or
You should try your best not to make the #Rewritten Prompt# become verbose,
#Rewritten Prompt# can only
add 10 to 20 words into #Given Prompt#.
‘#Given Prompt#’, ‘#Rewritten Prompt#’, ‘given prompt’ and ‘rewritten prompt’
are not allowed to appear in #Rewritten Prompt#
#Given Prompt#:
<Here is instruction>
#Rewritten Prompt#:
increasing reasoning steps
I want you act as a Prompt Rewriter.
Your objective is to rewrite a given prompt into a more complex version to
make those famous AI systems (e.g., ChatGPT and GPT4) a bit harder to handle.
But the rewritten prompt must be reasonable and must be understood and
responded by humans.
Your rewriting cannot omit the non-text parts such as the table and code in
#Given Prompt#:. Also, please do not omit the input in #Given Prompt#.
You SHOULD complicate the given prompt using the following method:
If #Given Prompt# can be solved with just a few simple thinking processes,
you can rewrite it to explicitly request multiple-step reasoning.
You should try your best not to make the #Rewritten Prompt# become verbose,
#Rewritten Prompt# can only
add 10 to 20 words into #Given Prompt#.
‘#Given Prompt#’, ‘#Rewritten Prompt#’, ‘given prompt’ and ‘rewritten prompt’
are not allowed to appear in #Rewritten Prompt#
#Given Prompt#:
<Here is instruction>
#Rewritten Prompt#:
表 13: 提示用于增加指令的复杂性,包括具体化和增加推理步骤。

12和表13显示了用于增强复杂性的提示,例如添加约束、深化、具体化和增加推理步骤。

提示排名和评分

14显示了用于对不同复杂度的指令进行排序和评分的提示。

Prompt Templates
Rank & Score
Ranking the following questions according to the difficulty and complexity. Score 1-5.
You can give a score of 6 if the question is too complex for you to answer it. You should
respond with the format:\n [1] Score: 1\n [2] Score: 2\n
[1] <Instruction 1>
[2] <Instruction 2>
[3] <Instruction 3>
[4] <Instruction 4>
[5] <Instruction 5>
表 14: 提示用于对不同复杂度的指令进行排名和评分。
Prompt Templates
Direct Scoring
We would like to request your feedback on the performance of AI assistant in response
to the given question displayed following.
##Tips:Please rate according to the accuracy of the response to the instruction and
the input. Each assistant receives a score on a scale of 0 to 5, where a higher score
indicates higher level of the accuracy. You must just give a score without any other
reasons.
##Question:
<Instruction>
##Response:
<Response>
##Score:
表 15: 质量基线的相应提示模板,包括直接评分。

E.3质量基线

15显示基线使用的提示,例如直接评分作为质量指标。

E.4 进化质量

提示提高质量

16和表17显示了提高质量的提示,例如增强帮助性、增强相关性、丰富深度、培养创造力和提供附加细节。

提示排名和评分

18显示了用于对不同质量的指令进行排名和评分的提示。

Prompt Templates
enhancing helpfulness
I want you to act as a Response Rewriter
Your goal is to enhance the quality of the response given by an AI assistant
to the #Given Prompt# through rewriting.
But the rewritten response must be reasonable and must be understood by humans.
Your rewriting cannot omit the non-text parts such as the table and code in
#Given Prompt# and #Given Response#. Also, please do not omit the input
in #Given Prompt#.
You Should enhance the quality of the response using the following method:
Please make the Response more helpful to the user.
You should try your best not to make the #Rewritten Response# become verbose,
#Rewritten Response# can only add 10 to 20 words into #Given Response#.
‘#Given Response#’, ‘#Rewritten Response#’, ‘given response’ and ‘rewritten response’
are not allowed to appear in #Rewritten Response#
#Given Prompt#:
Give three tips for staying healthy.
#Given Response#:
<Response>
#Rewritten Response#:
augmenting relevance
I want you to act as a Response Rewriter
Your goal is to enhance the quality of the response given by an AI assistant
to the #Given Prompt# through rewriting.
But the rewritten response must be reasonable and must be understood by humans.
Your rewriting cannot omit the non-text parts such as the table and code in
#Given Prompt# and #Given Response#. Also, please do not omit the input
in #Given Prompt#.
You Should enhance the quality of the response using the following method:
Please make the Response more relevant to #Given Prompt#.
You should try your best not to make the #Rewritten Response# become verbose,
#Rewritten Response# can only add 10 to 20 words into #Given Response#.
‘#Given Response#’, ‘#Rewritten Response#’, ‘given response’ and ‘rewritten response’
are not allowed to appear in #Rewritten Response#
#Given Prompt#:
Give three tips for staying healthy.
#Given Response#:
<Response>
#Rewritten Response#:
enriching depth
I want you to act as a Response Rewriter
Your goal is to enhance the quality of the response given by an AI assistant
to the #Given Prompt# through rewriting.
But the rewritten response must be reasonable and must be understood by humans.
Your rewriting cannot omit the non-text parts such as the table and code in
#Given Prompt# and #Given Response#. Also, please do not omit the input
in #Given Prompt#.
You Should enhance the quality of the response using the following method:
Please make the Response more in-depth
You should try your best not to make the #Rewritten Response# become verbose,
#Rewritten Response# can only add 10 to 20 words into #Given Response#.
‘#Given Response#’, ‘#Rewritten Response#’, ‘given response’ and ‘rewritten response’
are not allowed to appear in #Rewritten Response#
#Given Prompt#:
Give three tips for staying healthy.
#Given Response#:
<Response>
#Rewritten Response#:
表 16: 用于提高响应质量的提示,包括增强帮助性、增强相关性和丰富深度。
Prompt Templates
fostering creativity
I want you to act as a Response Rewriter
Your goal is to enhance the quality of the response given by an AI assistant
to the #Given Prompt# through rewriting.
But the rewritten response must be reasonable and must be understood by humans.
Your rewriting cannot omit the non-text parts such as the table and code in
#Given Prompt# and #Given Response#. Also, please do not omit the input
in #Given Prompt#.
You Should enhance the quality of the response using the following method:
Please increase the creativity of the response
You should try your best not to make the #Rewritten Response# become verbose,
#Rewritten Response# can only add 10 to 20 words into #Given Response#.
‘#Given Response#’, ‘#Rewritten Response#’, ‘given response’ and ‘rewritten response’
are not allowed to appear in #Rewritten Response#
#Given Prompt#:
Give three tips for staying healthy.
#Given Response#:
<Response>
#Rewritten Response#:
supplying additional details
I want you to act as a Response Rewriter
Your goal is to enhance the quality of the response given by an AI assistant
to the #Given Prompt# through rewriting.
But the rewritten response must be reasonable and must be understood by humans.
Your rewriting cannot omit the non-text parts such as the table and code in
#Given Prompt# and #Given Response#. Also, please do not omit the input
in #Given Prompt#.
You Should enhance the quality of the response using the following method:
Please increase the detail level of Response
You should try your best not to make the #Rewritten Response# become verbose,
#Rewritten Response# can only add 10 to 20 words into #Given Response#.
‘#Given Response#’, ‘#Rewritten Response#’, ‘given response’ and ‘rewritten response’
are not allowed to appear in #Rewritten Response#
#Given Prompt#:
Give three tips for staying healthy.
#Given Response#:
<Response>
#Rewritten Response#:
表 17: 提示用于提高响应的质量,包括培养创造力和提供额外的细节。
Prompt Templates
Rank & Score
Rank the following responses provided by different AI assistants to the user’s question
according to the quality of their response. Score each response from 1 to 5, with 6
reserved for responses that are already very well written and cannot be improved further.
Your evaluation should consider factors such as helpfulness, relevance, accuracy, depth,
creativity, and level of detail of the response.
Use the following format:
[Response 1] Score:
[Response 2] Score:
#Question#: <Instruction>
#Response List#:
[Response 1] <Response 1>
[Response 2] <Response 2>
[Response 3] <Response 3>
[Response 4] <Response 4>
[Response 5] <Response 5>
表 18: 提示用于对不同质量的响应进行排名和评分。