[Paper Review] Magpie: Alignment Data Synthesis from Scratch by Prompting Aligned LLMs with Nothing
Magpie automatically generates large-scale high-quality instruction data by prompting aligned LLMs with only pre-query templates, producing up to 4 million instructions and selecting 300K high-quality instances for fine-tuning open-weight models.
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.
Motivation & Objective
- Motivate democratizing LLM alignment data by reducing dependence on human-authored data or API access to production models.
- Propose a self-synthesis method that extracts diverse instructions directly from aligned LLMs using pre-query templates.
- Generate large-scale instruction datasets (Magpie-Air and Magpie-Pro) and multi-turn variants without seed prompts or seeds.
- Demonstrate that fine-tuning open-weight models with Magpie data can outperform baselines and approach official aligned models.
Proposed method
- Prompt aligned LLMs with only the pre-query template to induce autonomous instruction generation (no seed questions).
- Use the auto-regressive nature of aligned LLMs to generate diverse instructions until an end-of-sequence token is produced.
- Generate responses by querying the same LLM with the generated instructions to form instruction-response pairs.
- Create Magpie datasets (Magpie-Air and Magpie-Pro) and multi-turn variants (Magpie-Air-MT, Magpie-Pro-MT) without human intervention.
- Apply filtering and analysis to select high-quality instances for fine-tuning (e.g., 300K high-quality subset).
- Evaluate via fine-tuning open-weight models (Llama-3-8B-base, Qwen1.5-4B/7B) and assess on alignment benchmarks.

Experimental results
Research questions
- RQ1Can high-quality instruction data be synthesized at scale directly from aligned LLMs without seeds or seeds engineering?
- RQ2Do Magpie-generated datasets enable open-weight models to match or surpass performance achieved by models trained on public baselines or private data?
- RQ3What are the quality, coverage, and safety characteristics of Magpie data, and how do they affect downstream fine-tuning?
- RQ4Is Magpie cost-effective and scalable compared to traditional data creation pipelines?
Key findings
- Magpie can generate about 4 million instructions and responses, with a filtered high-quality subset of 300K for effective tuning.
- Fine-tuning Llama-3-8B-base with Magpie data yields better AlpacaEval 2 and Arena-Hard performance than model baselines using similar data size.
- Models fine-tuned with Magpie data can rival the official Llama-3-8B-Instruct model, despite the latter using over 10M data points for SFT and RLHF.
- Magpie data outperform several public instruction datasets (ShareGPT, Evol Instruct, UltraChat, OpenHermes, WildChat) and combinations with preference tuning on alignment benchmarks.
- Magpie data also improve performance when applied to Qwen base models, surpassing official instruction-tuned counterparts.
- Magpie achieves broad topic coverage and high-quality instructions with low safety risk (<1% potentially harmful) after filtering.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.