Magpie: Alignment Data Synthesis from Scratch by Prompting Aligned LLMs with Nothing

Zhangchen Xu, Fengqing Jiang, Luyao Niu, Yuntian Deng, R. Poovendran, Yejin Choi, Bill Yuchen Lin

arXiv:2406.08464 · 2026-07-27 공개 · arXiv · PDF

fine-tuning sft llm-alignment alpacaeval data-generation instruction-data-synthesis llama-3-instruct auto-regressive-models

Abstract

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.

한국어 요약

한 줄 요약

Magpie는 Llama-3-Instruct를 사용해 400만 개의 인스트럭션 데이터를 자동 생성하고, 이 중 30만 개의 고질량 데이터로 모델 퍼포먼스를 향상시키는 방식을 제안한다.

핵심 기여도

핵심 아이디어

Magpie는 기존 인스트럭션 생성 방식과 달리, 사용자 쿼리 템플릿만 입력해 Llama-3-Instruct가 자동으로 인스트럭션을 생성하게 유도하는 방식을 제안한다. 이는 LLM의 자동 회귀적 성질을 활용한 것으로, [INST]와 [/INST] 사이의 템플릿만 제공하면 모델이 자연스럽게 사용자 질문을 생성한다. 이는 기존의 프롬프트 엔지니어링이나 시드 질문에 의존하지 않으며, 데이터셋의 다양성과 품질을 유지할 수 있다.

Magpie는 생성된 데이터셋을 필터링하고, 다턴, 도메인별, 다국어 데이터셋으로 확장할 수 있는 기능도 포함한다. 이는 기존 인스트럭션 생성 방법이 데이터 크기 증가에 따라 다양성이 감소하는 문제를 해결할 수 있는 핵심 아이디어이다.

기술적 접근법

주요 결과

의의 및 한계

Magpie는 인스트럭션 데이터 생성에 필요한 인간 노동을 제거하고, 기존 방식보다 훨씬 효율적으로 대규모 데이터를 생성할 수 있다. 특히, Llama-3-8B-Instruct 모델을 상회하는 성능을 보이는 점에서, 고질량 인스트럭션 데이터 생성의 새로운 가능성을 제시한다.

그러나, Magpie는 기존 인스트럭션 템플릿에 의존하므로, 템플릿이 제한적일 경우 생성 데이터의 범위도 제한될 수 있다. 또한, 생성된 데이터의 도메인 다양성이나 언어 다양성에 대한 심층 분석은 추가 연구가 필요하다.

실용적 활용

Magpie는 AI 모델의 대규모 인스트럭션 데이터 생성을 자동화할 수 있어, 연구자나 개발자가 저비용으로 고질량 데이터를 생성할 수 있도록 지원한다. 특히, 인스트럭션 템플릿이 공개된 LLM을 사용하는 경우, Magpie는 데이터셋 생성 및 모델 퍼포먼스 향상에 유용하게 활용될 수 있다.