Magpie: Alignment Data Synthesis from Scratch by Prompting Aligned LLMs with Nothing
作者: Zhangchen Xu, Fengqing Jiang, Luyao Niu, Yuntian Deng, Radha Poovendran, Yejin Choi, Bill Yuchen Lin
分类: cs.CL, cs.AI
发布日期: 2024-06-12 (更新: 2024-10-07)
备注: Link: https://magpie-align.github.io/
💡 一句话要点
Magpie:通过提示对齐的LLM,从零开始合成对齐数据,提升模型性能。
🎯 匹配领域: 支柱二:RL算法与架构 (RL & Architecture) 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 大型语言模型对齐 指令数据合成 自回归生成 提示工程 监督微调
📋 核心要点
- 现有对齐数据创建方法面临人工成本高、提示范围有限等挑战,限制了公共数据集的规模和质量。
- Magpie利用对齐LLM的自回归特性,通过输入左侧模板自动生成指令和响应,实现大规模数据合成。
- 实验表明,使用Magpie合成的数据微调的模型,在某些任务上性能可与官方Llama-3-Instruct媲美。
📝 摘要(中文)
高质量的指令数据对于对齐大型语言模型(LLMs)至关重要。尽管像Llama-3-Instruct这样的一些模型开源了权重,但它们的对齐数据仍然是私有的,这阻碍了AI的民主化。现有开源数据创建方法由于高昂的人工成本和有限的提示范围,无法有效扩展,这可能会限制公共对齐数据集的多样性和质量。本文提出了一种自合成方法Magpie,用于大规模生成对齐数据,其核心思想是从对齐的LLM中直接提取数据。Magpie利用Llama-3-Instruct等对齐LLM的自回归特性,仅输入左侧模板即可生成用户查询。使用该方法,我们提示Llama-3-Instruct生成了400万条指令及其对应的响应。对提取的数据进行了全面分析,并选择了30万条高质量实例。通过使用Magpie数据微调Llama-3-8B-Base,结果表明,在某些任务中,微调后的模型性能与官方Llama-3-8B-Instruct相当,尽管后者通过监督微调(SFT)和后续的反馈学习增强了1000万个数据点。此外,仅使用Magpie进行SFT就可以超越先前用于SFT和偏好优化的公共数据集的性能,例如使用UltraFeedback进行直接偏好优化。这种优势在AlpacaEval、ArenaHard和WildBench等对齐基准测试中显而易见。
🔬 方法详解
问题定义:论文旨在解决高质量对齐数据稀缺的问题。现有方法依赖人工标注或有限的提示工程,成本高昂且难以扩展,导致公共对齐数据集的规模和多样性不足。这阻碍了AI的民主化,限制了研究人员对对齐技术的深入探索。
核心思路:论文的核心思路是利用已经对齐的LLM(如Llama-3-Instruct)的自回归能力,通过巧妙设计的提示工程,让模型自身生成高质量的指令和响应。这种方法避免了人工标注的成本,并能够大规模地合成数据。
技术框架:Magpie的整体流程如下:1) 设计左侧模板,即指令的前半部分,留出用户输入的位置;2) 使用Llama-3-Instruct等对齐LLM,输入左侧模板,让模型自动补全指令和生成响应;3) 对生成的数据进行过滤和筛选,选择高质量的实例;4) 使用筛选后的数据微调基础LLM,评估数据质量。
关键创新:Magpie的关键创新在于利用对齐LLM的自回归特性,实现了大规模、低成本的对齐数据合成。与现有方法相比,Magpie无需人工标注,也无需复杂的提示工程,而是直接从对齐LLM中提取知识。
关键设计:论文中没有详细描述具体的参数设置、损失函数或网络结构等技术细节。关键在于如何设计有效的左侧模板,以及如何对生成的数据进行高质量的筛选。筛选标准可能包括指令的清晰度、响应的质量、以及指令和响应之间的相关性。
🖼️ 关键图片
📊 实验亮点
实验结果表明,使用Magpie合成的30万条数据微调Llama-3-8B-Base,在某些任务上性能可与官方Llama-3-8B-Instruct(使用1000万条数据训练)媲美。此外,仅使用Magpie进行SFT,性能超越了使用UltraFeedback进行SFT和偏好优化的模型,在AlpacaEval、ArenaHard和WildBench等基准测试中表现出色。
🎯 应用场景
Magpie技术可应用于大规模生成高质量的对齐数据,用于提升LLM的指令遵循能力、对话能力和安全性。该技术有助于降低对齐数据的获取成本,促进AI的民主化,并为研究人员提供更多的数据资源,从而推动对齐技术的发展。此外,该方法也可以用于特定领域的LLM对齐,例如医疗、金融等。
📄 摘要(原文)
High-quality instruction data is critical for aligning large language models (LLMs). Although some models, such as Llama-3-Instruct, have open weights, their alignment data remain private, which hinders the democratization of AI. High human labor costs and a limited, predefined scope for prompting prevent existing open-source data creation methods from scaling effectively, potentially limiting the diversity and quality of public alignment datasets. Is it possible to synthesize high-quality instruction data at scale by extracting it directly from an aligned LLM? We present a self-synthesis method for generating large-scale alignment data named Magpie. Our key observation is that aligned LLMs like Llama-3-Instruct can generate a user query when we input only the left-side templates up to the position reserved for user messages, thanks to their auto-regressive nature. We use this method to prompt Llama-3-Instruct and generate 4 million instructions along with their corresponding responses. We perform a comprehensive analysis of the extracted data and select 300K high-quality instances. To compare Magpie data with other public instruction datasets, we fine-tune Llama-3-8B-Base with each dataset and evaluate the performance of the fine-tuned models. Our results indicate that in some tasks, models fine-tuned with Magpie perform comparably to the official Llama-3-8B-Instruct, despite the latter being enhanced with 10 million data points through supervised fine-tuning (SFT) and subsequent feedback learning. We also show that using Magpie solely for SFT can surpass the performance of previous public datasets utilized for both SFT and preference optimization, such as direct preference optimization with UltraFeedback. This advantage is evident on alignment benchmarks such as AlpacaEval, ArenaHard, and WildBench.