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

## Abstract

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 pre-query 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 further introduce extensions of Magpie for filtering, generating multi-turn, preference optimization, domain-specific and multilingual datasets.
We perform a comprehensive analysis of the Magpie -generated data. To compare Magpie -generated data with other public instruction datasets (e.g., ShareGPT, WildChat, Evol-Instruct, UltraChat, OpenHermes, Tulu-V2-Mix, GenQA), we fine-tune Llama-3-8B-Base with each dataset and evaluate the performance of the fine-tuned models. Our results indicate that using Magpie for supervised fine-tuning (SFT) solely can surpass the performance of previous public datasets utilized for both SFT and preference optimization, such as direct preference optimization with UltraFeedback. We also show that in some tasks, models supervised fine-tuned with Magpie perform comparably to the official Llama-3-8B-Instruct, despite the latter being enhanced with 10 million data points through SFT and subsequent preference optimization. This advantage is evident on alignment benchmarks such as AlpacaEval, ArenaHard, and WildBench.

## 1 Introduction

Large language models (LLMs) such as GPT-4 (Achiam et al., ) and Llama-3 (Meta, ) have become integral to AI applications due to their exceptional performance on a wide array of tasks by following instructions. The success of LLMs is heavily reliant on the data used for instruction fine-tuning, which equips them to handle a diverse range of tasks, including those not encountered during training. The effectiveness of instruction tuning depends crucially on access to high-quality instruction datasets. However, the alignment datasets used for fine-tuning models like Llama-3-Instruct are typically private, even when the model weights are open, which impedes the democratization of AI and limits scientific research for understanding and enhancing LLM alignment.

To address the challenges in constructing high-quality instruction datasets, researchers have developed two main approaches. The first type of method involves human effort to generate and curate instruction data (Databricks, ; Köpf et al., ; Zhao et al., ; Zheng et al., ; ), which is both *time-consuming* and *labor-intensive* (Liu et al., ). In contrast, the second type of methods uses LLMs to produce synthetic instructions (Ding et al., ; Yin et al., ; Li et al., ; Sun et al., ; Taori et al., ; Wang et al., ; ; Xu et al., ; ; Li et al., ). Although these methods reduce human effort, its success heavily depends on prompt engineering and the careful selection of initial seed questions. The *diversity* of synthetic data tends to decrease as the dataset size grows. Despite ongoing efforts, the scalable creation of high-quality and diverse instruction datasets continues to be a challenging problem.

Is it possible to synthesize high-quality instructions at scale by directly extracting data from advanced aligned LLMs? A typical input to an aligned LLM contains three key components: the pre-query template, the query, and the post-query template. For instance, an input to Llama-2-chat could be “
 Hi! 
”, where 
 is the pre-query template and 
 is the post-query template. These templates are predefined by the creators of the aligned LLMs to ensure the correct prompting of the models.
We observe that when we only input the pre-query template to aligned LLMs such as Llama-3-Instruct, they self-synthesize a user query due to their auto-regressive nature. Our experiments indicate that these random user queries are of high quality and great diversity, suggesting that the abilities learned during the alignment process are effectively utilized.

Figure: Figure 1: This figure illustrates Magpie, the process of self-synthesizing alignment data from aligned LLMs (e.g., Llama-3-8B-Instruct) to create a high-quality instruction dataset. In Step 1, we input only the pre-query template into the aligned LLM and generate an instruction along with its response using auto-regressive generation. In Step 2, we use a combination of a post-query template and another pre-query template to wrap the instruction generated from Step 1, prompting the LLM to generate the response. This completes the construction of the instruction dataset. Magpie efficiently generates diverse and high-quality instruction data, which can be further extended to multi-turn (Magpie-MT), preference optimization (Magpie-DPO), domain-specific, and multilingual datasets.
Refer to caption: x3.png

Based on these findings, we developed a self-synthesis method to construct high-quality instruction datasets at scale, named Magpie (as illustrated in Figure 1). Unlike existing methods, our approach does not rely on prompt engineering or seed questions. Instead, it directly constructs instruction data by prompting aligned LLMs with a pre-query template for sampling instructions. We also demonstrated the extensibility of Magpie in generating multi-turn, preference optimization, domain-specific, and multilingual datasets.
We applied Magpie to the Llama-3-8B-Instruct and Llama-3-70B-Instruct models, creating two instruction datasets: Magpie-Air and Magpie-Pro, respectively.

Our Magpie-Air and Magpie-Pro datasets were created using 206 and 614 GPU hours, respectively, without any human intervention or API access to production LLMs like GPT-4.
The statistics and advantages of Magpie datasets compared to existing ones are summarized in Table 4 in Appendix A. We perform a comprehensive analysis of these two datasets in Section 3, allowing practitioners to filter and select data instances for fine-tuning models according to their particular needs.

To compare Magpie data with other public instruction datasets (e.g., ShareGPT (Chiang et al., ), WildChat (Zhao et al., ), Evol Instruct (Xu et al., ), UltraChat (Ding et al., ), OpenHermes (Teknium, ; ), GenQA (Chen et al., ), Tulu V2 Mix (Ivison et al., )), we conducted supervised fine-tuning (SFT) of the Llama-3-8B-Base model with each dataset and assess the performance of the fine-tuned models on alignment benchmarks such as AlpacaEval 2 (Li et al., ), Arena-Hard (Li et al., ), and WildBench (Lin et al., ).
Our results show that models supervised fine-tuned with Magpie achieve superior performance, even surpassing models that utilize both SFT and direct preference optimization (DPO) (Rafailov et al., ) with UltraFeedback (Cui et al., ). Notably, Magpie-aligned models outperform the official Llama-3-8B-Instruct model on AlpacaEval 2, despite the latter being fine-tuned with over 10 million data points for SFT and subsequent preference optimization.
Not only does Magpie excel in SFT alone compared to prior public datasets, but also delivers the best results when combined with preference optimization methods such as DPO.
By leveraging Magpie extensions to generate high-quality preference optimization datasets, Magpie-aligned Llama-3 models
can even outperform GPT-4-Turbo(1106) on AlpacaEval 2.
These findings show the exceptional quality of instruction data generated by Magpie, enabling it to outperform even the official, extensively optimized, and proprietary LLMs.

## 2 Magpie : A Scalable Method to Synthesize Alignment Data

Chat Templates of Aligned LLMs.
For an aligned LLM (e.g., Llama-3-8B-Instruct), the input sequence can be represented as $x=T_{pre-query}\oplus q\oplus T_{post-query}$. Here, $q$ is the user query (e.g., "What material should I use to build a nest?"), while $T_{pre-query}$ and $T_{post-query}$ are pre-query and post-query templates.
The pre-query template shows up before the user query, and the post-query template is defined as the conversation template between the user query and the LLM response.
These templates are defined by the model provider to ensure the correct prompting.
For example, for Llama-3-8B-Insturct model, $T_{pre-query}$ = 
user
, and $T_{post-query}$ =

assistant
.

### 2.1 Magpie Pipeline

Overview of Magpie.
In what follows, we describe our lightweight and effective method, Magpie, to synthesize alignment data from aligned LLMs.
An instance of instruction data consists of at least one or multiple instruction-response pairs.
Each pair specifies the roles of instruction provider (e.g., user) and follower (e.g., assistant), along with their instruction and response.
As shown in Figure 1, Magpie consists of two steps: (1) instruction generation, and (2) response generation.
The Magpie pipeline can be fully *automated without any human intervention*, and can be readily adapted for the generation of multi-turn, preference, and domain-specific datasets, as detailed in Section 2.2.
We describe each step in the following.

Step 1: Instruction Generation.
The goal of this step is to generate an instruction for each instance of instruction data.
Given an open-weight aligned LLM (e.g., Llama-3-70B-Instruct), Magpie crafts a pre-query template in the format of the predefined instruction template of the LLM.
Note that the auto-regressive LLM has been fine-tuned using instruction data in the format of the pre-query template.
Thus, the LLM autonomously generates an instruction when the pre-query template crafted by Magpie is given as an input.
Magpie stops generating the instruction once the LLM produces an end-of-sequence token.
Sending the crafted query to the LLM multiple times leads to a set of instructions.
We note that compared with existing synthetic approaches (Ding et al., ; Li et al., ; Taori et al., ; Wang et al., ; ; Xu et al., ; ), Magpie does not require specific prompt engineering techniques since the crafted query follows the format of the predefined instruction template.
In addition, Magpie autonomously generates instructions without using any seed question, ensuring the diversity of generated instructions.

Step 2: Response Generation.
The goal of this step is to generate responses to the instructions obtained from Step 1.
Magpie sends these instructions to the LLM to generate the corresponding responses.
Combining the roles of instruction provider and follower, the instructions from Step 1, and the responses generated in Step 2 yields the instruction dataset.

Applicability of Magpie on Different LLMs. Magpie can be readily deployed to state-of-the-art open-weight language models including but not limited to Llama-3 (Meta, ), Llama-3.1 (Dubey et al., ), Qwen2 (Yang et al., ), Gemma-2 (Team et al., ), and Phi-3 (Abdin et al., ). Please refer to Appendix A for detailed support and corresponding datasets.

Remark. Magpie generates high-quality instructions even when the instruction loss is masked during alignment. We hypothesize that LLMs retain an implicit memorization of instruction distributions. We leave it as a potential future research problem.

### 2.2 Magpie Extensions

Dataset Filtering.
Magpie allows practitioners to select instruction data from the raw dataset generated from the above two steps based on their needs.
In Appendix C, we explores potential filter configurations with eight available metrics for users to customize their own Magpie datasets. We also provide 6 off-the-shelf filter configurations and discuss their performance in Appendix F.4.

Generating Multi-Turn Instruction Datasets. Magpie can be readily extended to generate multi-turn instruction datasets. To construct a multi-turn dataset (denoted as Magpie-MT), we initially follow Steps 1 and 2 to generate the first turn of instruction and response. For subsequent turns, we append the pre-query template to the end of the full prompt from the previous round of communication.
We observe that the model may occasionally forget its role as the user, especially for the 8B model. To mitigate this, we employ a system prompt designed to control the behavior of the LLM and reinforce its awareness of the multi-round conversation context.
The full prompt for building the instructions of Magpie-MT can be found in Figure 14 in Appendix G. We follow the procedure in Step 2 of Section 2.1 to generate responses to form the multi-turn instruction dataset.

Generating Preference Optimization Datasets.
Leveraging the diverse and high-quality instructions produced by Magpie, we present a simple and effective method for generating preference optimization data, inspired by Meng et al. () and Tran et al. ().
We first select a small proportion of high-quality instructions from the raw dataset generated by the Magpie pipeline, ensuring diverse task categories. For each selected instruction, we sample responses from the aligned LLM $k$ times, using a temperature of $T<1$. We then employ a reward model (RM) to annotate scores for these responses. The response with the highest RM score is labeled as the chosen response, while the one with the lowest RM score is designated as the rejected response.

Generating Domain-Specific and Multilingual Datasets. In certain scenarios, users may wish to fine-tune LLMs using domain-specific or multilingual instruction data to enhance performance within specific domains or languages. To address this need, we introduce a lightweight method to control both the task category and the language of generated instructions. Our approach involves guiding LLMs through a tailored system prompt, specifying that the model is a chatbot designed for a particular domain and outlining the types of user queries it might encounter. Figure 2 shows how to control generating math and Chinese instructions using system prompts.
More examples of system prompts designed to control the generation of code, translation, and multilingual instructions are illustrated in Figure 15 in Appendix G.

Furthermore, we note that domain-specific and multilingual instruction data can also be generated using models that are tailored to particular fields. Magpie demonstrates broad applicability beyond diverse chat models, extending to specialized code models (e.g., DeepSeek-Coder-V2 (Zhu et al., )) and math models (e.g., Qwen2-Math-7B-Instruct (Yang et al., )). By leveraging the unique strengths and specializations of different models, Magpie can create a rich and diverse corpus of instructions. Examples of Magpie-generated instructions from different domain-specific models and multilingual models are provided in Appendix H.

Figure: Figure 2: This figure illustrates how to control generating math and Chinese instructions using system prompts. The system prompt in Chinese translates to: "You are an AI assistant designed to provide accurate and concise answers to users’ questions in Chinese." The user’s response in Chinese translates to: "I want to learn about some basic concepts and historical development trends of AI."
Refer to caption: x4.png

## 3 Dataset Analysis

To demonstrate the effectiveness of Magpie compared with baseline methods for generating diverse high-quality alignment datasets, we apply Magpie to the Llama-3-8B-Instruct and Llama-3-70B-Instruct models (Meta, ) to construct two instruction datasets: Llama-3-Magpie-Air (hereafter referred to as Magpie-Air) and Llama-3-Magpie-Pro (hereafter referred to as Magpie-Pro), respectively.
Examples of instances in both datasets can be found in Appendix H.
In this section, we present a comprehensive analysis of the Magpie-Air and Magpie-Pro datasets, including topic coverage, difficulty, quality, similarity of instructions, and the quality of the responses. We also provide the safety analysis and cost analysis of Magpie.

### 3.1 Dataset Coverage

We follow Zhao et al. () and analyze the coverage of Magpie-Pro in the embedding space.
Specifically, we use the all-mpnet-base-v2 embedding model(^1^11[https://huggingface.co/sentence-transformers/all-mpnet-base-v2](https://huggingface.co/sentence-transformers/all-mpnet-base-v2)) to calculate the input embeddings, and employ t-SNE (Van der Maaten & Hinton, ) to project these embeddings into a two-dimensional space. We adopt three synthetic datasets as baselines, including Alpaca (Taori et al., ), Evol Instruct (Xu et al., ), and UltraChat (Ding et al., ), to demonstrate the coverage of Magpie-Pro. The detailed analysis can be found in Appendix D.1. We observe that the t-SNE plot of Magpie-Pro encompasses the area covered by the plots of Alpaca, Evol Instruct, and UltraChat. This suggests that Magpie-Pro provides a broader or more diverse range of topics.

We also follow Wang et al. () and present the most common verbs and their top direct noun objects in instructions in Appendix D, indicating the diverse topic coverage of Magpie dataset.

### 3.2 Dataset Attributes

#### Attribute: Task Categories of Instructions.

We use Llama-3-8B-Instruct to categorize the instances in Magpie-Pro (see Figure 9 in Appendix D.1 for detail).
The prompts used to query Llama-3-8B-Instruct can be found in Appendix G.
Our observations indicate that over half of the tasks in Magpie-Pro pertain to information seeking, making it the predominant category.
This is followed by tasks involving creative writing, advice seeking, planning, and math.
This distribution over the task categories aligns with the practical requests from human users (Li et al., ).

Figure: Figure 3: The statistics of instruction difficulty and quality.
Refer to caption: x5.png

Attribute: Quality of Instructions.
Similar to methods in (Chen et al., ), we prompt the Llama-3-8B-Instruct model to assess the quality of each instruction in Magpie-Air and Magpie-Pro, categorizing them as ‘very poor’, ‘poor’, ‘average’, ‘good’, and ‘excellent’.
We present the histograms of qualities for both datasets in Figure 3-(a).
We have the following two observations.
First, both datasets are of high quality, with the majority of instances rated ‘average’ or higher.
In addition, the overall quality of Magpie-Pro surpasses that of Magpie-Air.
We hypothesize that this is due to the enhanced capabilities of Llama-3-70B compared with Llama-3-8B.

Attribute: Difficulty of Instructions.
We use the Llama-3-8B-Instruct model to rate the difficulty of each instruction in Magpie-Air and Magpie-Pro.
Each instruction can be labeled as ‘very easy’, ‘easy’, ‘medium’, ‘hard’, or ‘very hard’.
Figure 3-(b) presents the histograms of the levels of difficulty for Magpie-Air and Magpie-Pro.
We observe that the distributions across difficulty levels are similar for Magpie-Air and Magpie-Pro.
Some instructions in Magpie-Pro are more challenging than those in Magpie-Air because Magpie-Pro is generated by a more capable model (Llama-3-70B-Instruct).

Figure: Figure 4: This figure summarizes the minimum neighbor distances and reward differences.
Refer to caption: x6.png

Attribute: Instruction Similarity.
We quantify the similarity among instructions generated by Magpie to remove repetitive instructions.
We measure the similarity using minimum neighbor distance in the embedding space.
Specifically, we first represent all instructions in the embedding space using the all-mpnet-base-v2 embedding model.
For any given instruction, we then calculate the minimum distance from the instruction to its nearest neighbors in the embedding space using Facebook AI Similarity Search (FAISS) (Douze et al., ).
The minimum neighbor distances of instructions in Magpie-Air after removing repetitions are summarized in Figure 4-(a).

Attribute: Quality of Responses.
We assess the quality of responses using rewards assigned by a reward model, denoted as $r^{*}$.
For each instance in our dataset, we also calculate reward difference as $r^{*}-r_{base}$, where $r_{base}$ is the reward assigned by the same reward model to the response generated by the Llama-3 base model for the same instruction. We use URIAL (Lin et al., ) to elicit responses from the base model.
A positive reward difference indicates that the response from our dataset is of higher quality, and could potentially benefit instruction tuning.
In our experiments, we follow Lambert et al. () and choose FsfairX-LLaMA3-RM-v0.1 (Xiong et al., ) as the reward model.
Our results on the reward difference are presented in Figure 4-(b).

### 3.3 Safety Analysis

We use Llama-Guard-2 (Team, ) to analyze the safety of Magpie-Air and Magpie-Pro. Our results indicate that both datasets are predominantly safe, with less than 1% of the data potentially containing harmful instructions or responses. Please see Appendix D.2 for detailed safety analysis.

### 3.4 Cost Analysis

We perform experiments on a server with four NVIDIA A100-SXM4-80GB GPUs, an AMD EPYC 7763 64-Core Processor, and 512 GB of RAM, using the VLLM inference framework (Kwon et al., ).
The models are loaded in the bfloat16 format.

When creating the 3M Magpie-Air dataset, our Magpie spent 1.55 and 50 hours to generate the instructions (Step 1) and responses (Step 2), respectively.
For the 1M Magpie-Pro dataset, Magpie used 3.5 and 150 hours to generate the instructions (Step 1) and responses (Step 2), respectively.
Compared to existing approaches to create instruction datasets, the pipeline of Magpie is fully automated without any human intervention or API access to advanced commercial models such as GPT-4 (Achiam et al., ).
Consequently, Magpie is cost-effective and scalable.
On average, implementing Magpie on a cloud server(^2^22[https://lambdalabs.com/service/gpu-cloud](https://lambdalabs.com/service/gpu-cloud)) would incur costs of $0.12 and $1.1 per 1,000 data instances for Magpie-Air and Magpie-Pro, respectively.

### 3.5 Additional Analysis

Additional dataset analysis, including the impact of generation configurations on the quality and difficulty of the generated instructions, is detailed in Appendix D.3. We provide ablation analysis on annotating models for assessing quality and difficulty in Appendix D.4.

## 4 Performance Analysis

In this section, we evaluate the quality of Magpie-generated datasets by utilizing them to align base models including Llama-3 (Meta, ), Qwen1.5 (Bai et al., ), and Qwen2 (Yang et al., ).

### 4.1 Experimental Setups

Baselines for Supervised Fine-Tuning and Preference Optimization. We compare the family of instruction datasets generated by Magpie with eight SOTA open-source instruction datasets: ShareGPT (Chiang et al., ), WildChat (Zhao et al., ), Evol Instruct (Xu et al., ), UltraChat (Ding et al., ), GenQA (Chen et al., ), OpenHermes 1 (Teknium, ), OpenHermes 2.5 (Teknium, ), and Tulu V2 Mix (Ivison et al., ). ShareGPT and WildChat are representative human-written datasets containing 112K and 652K high-quality multi-round conversations between humans and GPT, respectively.
Evol Instruct, UltraChat, and GenQA are representative open-source synthetic datasets.
Following Meng et al. (), we use the 208K sanitized version of Ultrachat provided by HuggingFace(^3^33[https://huggingface.co/datasets/HuggingFaceH4/ultrachat_200k](https://huggingface.co/datasets/HuggingFaceH4/ultrachat_200k)). OpenHermes 1, OpenHermes 2.5, and Tulu V2 Mix are crowd-sourced datasets consisting of a mix of diverse open-source instruction datasets, with 243K, 1M, and 326K conversations, respectively. We also create an instruction dataset with 100K conversations using the Self-Instruct (Wang et al., ) and Llama-3-8B-Instruct model, denoted as Self-Instruct (Llama-3).

We compare the models aligned using Magpie with preference optimization baselines using direct preference optimization (DPO) (Rafailov et al., ). Specifically, we follow Meng et al. () and use the models fine-tuned with the UltraChat dataset (for instruction tuning) and Ultrafeedback dataset (for preference optimization) (Cui et al., ).

Magpie Setups.
To demonstrate the quality of Magpie-generated instruction datasets for SFT, we select the first 300K Magpie-Air and Magpie-Pro raw datasets generated by Llama-3-8B-Instruct and Llama-3-70B-Instruct models, respectively. Apart from these raw datasets, we also applied the filters detailed in Appendix C and created two filtered datasets: Magpie-Air-Filtered and Magpie-Pro-Filtered, each contains 300K conversations. For preference optimization, we generate two additional datasets: Magpie-Air-DPO (generated by Llama-3-8B-Instruct) and Magpie-Pro-DPO (generated by Llama-3-70B-Instruct) with $k=5$ and $T=0.8$, each contains 100K conversations. We use RLHFlow/ArmoRM-Llama3-8B-v0.1 (Wang et al., ) as the reward model.

Model Alignment Details. For supervised fine-tuning, we follow Touvron et al. () and use a cosine learning rate schedule with an initial learning rate of $2\times 10^{-5}$ when fine-tuning Llama-3, Qwen1.5 and Qwen2 base models.
The maximum sequence length is 8192. For DPO, we use a cosine learning rate of $5\times 10^{-7}$. The detailed parameters can be found in Appendix E.2.
We follow the official instruction templates of each model.

Evaluation Benchmarks.
We evaluate the performance of the aligned models using two widely adopted instruction-following benchmarks: AlpacaEval 2 (Li et al., ) and Arena-Hard (Li et al., ).
AlpacaEval 2 consists of 805 representative instructions chosen from real user interactions.
Arena-Hard is an enhanced version of MT-Bench (Zheng et al., ), containing 500 challenging user queries.
Both benchmarks employ a GPT evaluator to assess responses generated by the model of interest and a baseline model.
Specifically, we use GPT-4-Turbo (1106) and Llama-3-8B-Instruct as baselines for AlpacaEval 2.
By default, Arena-Hard uses GPT-4 (0314) as its baseline model.

Metrics.
We adopt two metrics to measure the capabilities of instruction-following of fine-tuned models.
The first metric is the win rate (WR), which calculates the fraction of responses that are favored by the GPT evaluator.
This metric is applied in both benchmarks including AlpacaEval 2 and Arena-Hard.
The second metric is the length-controlled win rate (LC) (Dubois et al., ), a debiased version of WR.
The GPT evaluator considers the lengths of responses generated by the baseline model and model under evaluation when computing LC.
By accounting for response length, LC reduces its impact on the win rate.
This metric is specifically applied to the AlpacaEval 2 benchmark (Li et al., ).

More Experimental Setups. We provide more detailed descriptions of our experimental setups, including more model alignment details and benchmark decoding hyper-parameters in Appendix E.

### 4.2 Experimental Results

**Table 1: This table compares the performance of models instruction-tuned on the Llama-3-8B base models using Magpie-generated datasets and baseline datasets. We observe that models aligned with our datasets significantly outperform those aligned with baseline datasets of the same order of magnitude in terms of data size. In addition, our fine-tuned models achieve comparable performance to the official aligned model, despite only undergoing SFT with a much smaller dataset. Numbers in bold indicate that Magpie outperforms the official Llama-3-8B-Instruct model.**
| Alignment Setup<br>(Base LLM = Llama-3-8B) | #Convs | AlpacaEval 2 | Arena-Hard |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| GPT-4-Turbo (1106) | Llama-3-8B-Instruct |  |  |  |  |  |  |  |  |
| LC (%) | WR (%) | SD | LC (%) | WR (%) | SD | WR(%) |  |  |  |
| SFT | +Self-Instruct (Llama-3) (Wang et al., ) | 100K | 7.21 | 5.18 | 0.7 | 17.86 | 12.73 | 1.05 | 4.0 |
|  | +ShareGPT (Chiang et al., ) | 112K | 9.73 | 7.2 | 0.81 | 27.26 | 18.32 | 1.18 | 6.5 |
|  | +Evol Instruct (Xu et al., ) | 143K | 8.52 | 6.25 | 0.76 | 20.16 | 14.98 | 1.1 | 5.1 |
|  | +OpenHermes 1 (Teknium, ) | 243K | 9.94 | 6.27 | 0.73 | 29.19 | 17.92 | 1.16 | 4.4 |
|  | +Tulu V2 Mix (Ivison et al., ) | 326K | 9.91 | 7.94 | 0.86 | 24.28 | 18.64 | 1.18 | 5.4 |
|  | +WildChat (Zhao et al., ) | 652K | 14.62 | 10.58 | 0.92 | 34.85 | 26.57 | 1.32 | 8.7 |
|  | +OpenHermes 2.5 (Teknium, ) | 1M | 12.89 | 9.74 | 0.91 | 32.68 | 25.01 | 1.30 | 8.2 |
|  | +GenQA (Chen et al., ) | 6.47M | 9.05 | 7.11 | 0.82 | 21.90 | 16.09 | 1.12 | 3.0 |
|  | +UltraChat (Ding et al., )<br>\faArrowRight | 208K | 8.29 | 5.44 | 0.71 | 23.95 | 15.12 | 1.11 | 3.6 |
| + DPO | +UltraFeedback((Cui et al., )) | 64K | 18.36 | 17.33 | 1.14 | 44.42 | 42.36 | 1.46 | 14.8 |
| SFT | Magpie-Air-300K-Raw | 300K | 21.99 | 21.65 | 1.21 | 48.63 | 48.06 | 1.42 | 15.8 |
|  | Magpie-Air-300K-Filtered<br>\faArrowRight | 300K | 22.66 | 23.99 | 1.24 | 49.27 | 50.8 | 1.44 | 14.9 |
| + DPO | +Magpie-Air-DPO | 100K | 45.48 | 50.43 | 1.48 | 75.06 | 79.64 | 1.18 | 35.9 |
| SFT | Magpie-Pro-300K-Raw | 300K | 21.65 | 22.19 | 1.2 | 49.65 | 50.84 | 1.42 | 15.9 |
|  | Magpie-Pro-300K-Filtered<br>\faArrowRight | 300K | 25.08 | 29.47 | 1.35 | 52.12 | 53.43 | 1.44 | 18.9 |
| + DPO | +Magpie-Pro-DPO | 100K | 50.10 | 53.53 | 1.45 | 78.52 | 80.82 | 1.17 | 35.7 |
| Llama-3-8B-Instruct (SFT+DPO) | $>$10M(^4^44[https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct)) | 22.92 | 22.57 | 1.26 | 50 | 50 | - | 20.6 |  |

#### Magpie datasets outperform baselines with SFT only.

In Table 1, we compare the performance of Llama-3 models fine-tuned with instruction datasets generated by Magpie against those supervised fine-tuned with baseline datasets.
Using the AlpacaEval 2 benchmark, we observe that both the LC and WR of our supervised fine-tuned models surpass all those models fine-tuned with baseline SFT datasets.
This indicates that the datasets generated by Magpie are of higher quality, leading to significantly enhanced instruction-following capabilities.
A similar observation is made when using the Arena-Hard evaluation benchmark.
We highlight that the Llama-3 base models supervised fine-tuned with instruction datasets generated by Magpie outperform even those models that have undergone preference optimization (i.e., STF followed by DPO), which further emphasizes the high quality of data generated by Magpie.

Figure: Figure 5: This figure shows the performance breakdown by category of Magpie-Pro and baselines on WildBench.
Refer to caption: x7.png

To investigate the advantages of Magpie across different task categories, we also compare the performance of models fine-tuned with Magpie-Pro compared with baseline datasets using WildBench benchmark (Lin et al., ). This benchmark consists of 1024 tasks carefully selected from real-world human-LLM conversation logs. The results are demonstrated in Figure 5. We observe that Magpie consistently outperforms baseline datasets across categories.

Models aligned with data generated by Magpie achieve comparable or even higher performance to the official aligned model, but with fewer data.
In Table 1, we also compare the performance of models aligned with data generated by Magpie against the official aligned model (Llama-3-8B-Instruct).
We observe that the Llama-3-8B base model supervised fine-tuned with data from Magpie outperforms Llama-3-8B-instruct using the AlpacaEval 2 benchmark.
For example, when Llama-3-8B-Instruct is chosen as the baseline model of AlpacaEval 2, we observe that LC of Llama-3-8B base models fine-tuned with instruction data from Magpie exceeds 50%, indicating a preference for our SFT models over the official aligned model. In addition, when DPO is applied, our aligned model demonstrates remarkable performance gains. Specifically, it outperforms the official Llama-3-8B-Instruct model on both the AlpacaEval 2 and Arena-Hard benchmarks. Most notably, our model even surpasses GPT-4-Turbo(1106) on AlpacaEval 2.
Finally, we highlight that our alignment process uses no more than 400K data, whereas the official aligned models are aligned with more than 10M data samples.
This demonstrates the high quality of the data generated by Magpie.

Magpie can enhance the performance of other backbone models.
Table 2 illustrates the efficacy of Magpie when applied to generate instruction dataset and fine-tune other base models, i.e., Qwen2-1.5B, Qwen1.5-4B, and Qwen1.5-7B. The results demonstrate that our fine-tuned models achieve better performance than the official aligned models, which have undergone both supervised fine-tuning and preference tuning.
These results underscore the effectiveness of Magpie and the quality of its generated instructions. In addition, we apply Magpie-generated datasets to align Llama-3.1-Minitron-4B-Width-Base (Sreenivas et al., ) and Llama-3.1-8B-Instruct (Dubey et al., ) using SFT followed by DPO. The resulting aligned model, which we term MagpieLM, achieves remarkable performance and ranks first among popular open-source instruction models with fewer than 10 billion parameters. The details of MagpieLM are deferred to Appendix B.

**Table 2: This table compares the performance of models instruction-tuned on the Qwen base models using the Magpie-Pro-300K-Filtered dataset and the official instruction-tuned models. The Qwen base model enhanced with Magpie outperforms the official instruction-tuned model.**
| Alignment Setup | AlpacaEval 2 |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- |
| GPT-4-Turbo (1106) | Official Aligned Model as Ref. |  |  |  |  |  |  |
| LC (%) | WR (%) | SD | LC (%) | WR (%) | SD |  |  |
| Qwen2-1.5B | Qwen2-1.5B-Instruct | 3.91 | 3.00 | 0.54 | 50 | 50 | - |
| Base Model + Magpie | 3.48 | 5.32 | 0.67 | 56.66 | 66.27 | 1.50 |  |
| Qwen1.5-4B | Qwen1.5-4B-Chat | 5.89 | 4.74 | 0.67 | 50 | 50 | - |
| Base Model + Magpie | 9.1 | 10.96 | 0.93 | 68.09 | 72.42 | 1.42 |  |
| Qwen1.5-7B | Qwen1.5-7B-Chat | 14.75 | 11.77 | 0.97 | 50 | 50 | - |
| Base Model + Magpie | 15.10 | 18.51 | 1.14 | 46.28 | 58.53 | 1.44 |  |

Performance of Magpie on More Benchmarks.
We report the performance of models supervised fine-tuned using Magpie-Air and Magpie-Pro, evaluated across a range of tasks featured on the Huggingface Open LLM Leaderboard (Beeching et al., ) in Table 3. The tasks includes MMLU (Hendrycks et al., ), ARC Challenge (Clark et al., ), HellaSwag (Zellers et al., ), TruthfulQA (Lin et al., ), WinoGrande (Levesque et al., ), and GSM8K (Cobbe et al., ).
We also perform experiments on MMLU-Redux (Gema et al., ) with zero-shot prompting. Our experimental results demonstrate that models fine-tuned with Magpie-Air and Magpie-Pro achieve comparable performance to the official instruct model and other baselines.

We note that the performance of Magpie may degrade on reasoning tasks, which is attributed to the small proportion of reasoning instructions in Magpie-Air and Magpie-Pro datasets.
In response, we provide a supplementary "booster" dataset containing 150K math, code, and reasoning instructions using the Magpie extension mentioned in Section 2.2. We combine this booster dataset with Magpie-Pro-300K-Filtered and create Magpie-Pro-Mix-Filtered. Experimental results presented in Table 3 demonstrate that the model supervised fine-tuned using the mixed dataset effectively addresses the initial weakness in reasoning tasks. Notably, this new model ranks among the top-3 of all model checkpoints, performing only slightly weaker than OpenHermes 2.5 (1M conversations) and Llama-3-8B-Instruct (>10M conversations). This significant improvement showcases the flexibility and adaptability of the Magpie framework in generating task-specific instruction data.

**Table 3: This table compares the performance of models supervised-fine-tuned on Magpie-Air, Magpie-Pro, and Magpie-Pro-Mix against baselines and official instruct model across various downstream benchmarks. All models are supervised-fine-tuned on the Llama-8B base models.**
| Alignment Setup | MMLU (5) | ARC (25) | HellaSwag (10) | TruthfulQA (0) | WinoGrande (5) | GSM8K (5) | MMLU-Redux (0) | Average |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| ShareGPT | 66.03 | 58.45 | 81.50 | 52.34 | 74.03 | 48.67 | 50.68 | 61.67 |
| Evol Instruct | 65.62 | 60.75 | 82.70 | 52.87 | 76.16 | 42.91 | 52.73 | 61.96 |
| GenQA | 63.45 | 58.53 | 79.65 | 48.85 | 74.03 | 43.14 | 51.87 | 59.93 |
| OpenHermes 1 | 65.42 | 62.29 | 82.15 | 50.85 | 75.61 | 47.16 | 46.07 | 61.36 |
| OpenHermes 2.5 | 65.70 | 61.86 | 82.53 | 51.35 | 76.09 | 67.02 | 46.07 | 66.24 |
| Tulu V2 Mix | 66.34 | 59.22 | 82.80 | 47.99 | 76.16 | 58.07 | 46.97 | 62.51 |
| WildChat | 65.95 | 59.22 | 81.39 | 53.18 | 75.30 | 48.75 | 52.59 | 62.34 |
| UltraChat | 65.23 | 62.12 | 81.68 | 52.76 | 75.53 | 50.57 | 50.75 | 62.66 |
| Magpie-Air-300K-Filtered | 64.45 | 61.01 | 79.90 | 53.48 | 72.38 | 52.24 | 52.34 | 62.25 |
| Magpie-Pro-300K-Filtered | 64.25 | 60.41 | 80.52 | 52.46 | 73.32 | 47.92 | 52.16 | 61.58 |
| Magpie-Pro-Mix-Filtered | 65.65 | 59.64 | 80.72 | 50.81 | 73.24 | 63.08 | 56.34 | 64.21 |
| Llama-3-8B-Instruct | 67.82 | 61.52 | 78.67 | 52.47 | 72.14 | 71.72 | 58.60 | 66.13 |

Additional Experimental Results. We defer additional experimental results and analysis of multi-turn datasets, i.e., Magpie-Air-MT and Magpie-Pro-MT, to Appendix F.1. We conduct a detailed comparison between Magpie and Self-Instruct in Appendix F.2. In addition, ablations on data quantity, quality, filter designs, and response generator are deferred in Appendices F.3, F.4, and F.5.
Magpie model’s performance on trustworthiness benchmarks is reported in Appendices F.6.

## 5 Related Work

LLM Alignment.
Instruction tuning (Wei et al., ) and preference tuning (Bai et al., ) are widely used to align the responses of LLMs with human values.
Instruction tuning utilizes an instruction dataset to fine-tune LLMs, where each instruction data consists of one turn or multiple turns of instructions and desired responses.
The performance of instruction tuning heavily relies on the quality of instruction data (Taori et al., ; Wang et al., ; Zhou et al., ).
Preference tuning further improves responses of LLMs using reinforcement learning human feedback (RLHF) (Bai et al., ) or preference optimization (Azar et al., ; Ethayarajh et al., ; Hong et al., ; Rafailov et al., ) based on a preference dataset.

Alignment Dataset Construction. We classify the existing methods of creating datasets for model alignment into two main categories: human interactions with LLMs and synthetic instruction generation.
To create datasets for alignment, previous studies have collected human interactions with LLMs (Databricks, ; Zhao et al., ; Zheng et al., ; ; Köpf et al., ). However, manually crafting instructions is not only time-consuming and labor-intensive, but may also incorporate toxic content (Zhao et al., ).
Another category of approaches (Wang et al., ; Taori et al., ; Xu et al., ; ; Wang et al., ; Sun et al., ) focus on prompting LLMs to generate synthetic instruction datasets, beginning with a small set of human-annotated seed instructions and expanding these through few-shot prompting. However, these methods face a diversity challenge, as few-shot prompting often results in new instructions that are too similar to the original seed questions (Li et al., ). To enhance coverage, some research (Ding et al., ; Li et al., ) summarizes world knowledge and employs it to generate synthetic datasets. We note that our Magpie dataset also belongs to the synthetic dataset. However, we leverage the prompt template without any requirement for seed questions or prompt engineering.

Compared to the above two main categories, alignment data can also be generated by transforming existing data (Wang et al., ; Sanh et al., ; Gandhi et al., ). However, the constrained variety of NLP tasks in these datasets may impede the ability of tuned LLMs to generalize in real-world scenarios (Li et al., ). There are also mixture datasets (e.g., (Ivison et al., ; Teknium, ; Liu et al., ; Zhou et al., )) that combine or select high-quality instruction data from various existing open-source instruction datasets to enhance coverage (Ivison et al., ; Teknium, ) and/or improve overall performance (Liu et al., ; Zhou et al., ).
There are also data construction methods focusing on improving the reasoning and math abilities (Yue et al., ; ), which can be further merged with Magpie for creating a better mixture of data for instruction tuning.

Training Data Extraction. Language models have the capability to memorize examples from their training datasets, potentially enabling malicious users to extract private information (Brown et al., ; Biderman et al., ; Carlini et al., ). Pioneering work (Krishna et al., ; Carlini et al., ; Nasr et al., ) has demonstrated that it is possible to extract private pre-training data from BERT (Devlin et al., ), GPT-2 (Radford et al., ), and ChatGPT (Achiam et al., ), respectively. Yu et al. () propose several techniques including adjusting sampling strategies to better extract training datasets from language models.
Recently, Kassem et al. () propose a black-box prompt optimization method that uses an attacker LLM to extract high levels of memorization in a victim LLM. Wang et al. () leverage membership inference attack (MIA) to extract fine-tuning datasets from fine-tuned language models. Bai et al. () extract the training dataset of production language models via special characters (e.g., structural symbols of JSON files, and , # in emails and online posts).
Different from the prior work, we aim to create publicly available alignment datasets with minimal human effort by leveraging the remarkable generation capabilities of LLMs, rather than extracting private training data from LLMs.

## 6 Limitations, Discussions, and Ethical Considerations

Limitations and Discussions.
Magpie-aligned LLMs demonstrate strong performance on instruction following benchmarks compared to the official Llama-3-8B-Instruct. However, we observe a performance degradation on math and reasoning benchmarks. Although we leverage the techniques described in Section 2.2 to generate specialized booster reasoning datasets, there is still a performance gap between Magpie-aligned LLMs and the official models. Enhancing the reasoning ability of Magpie-aligned models presents a promising direction for future research.

Societal Impact and Potential Harmful Consequences.
The primary objective of this paper is to develop a scalable method to synthesize instruction data to enhance the instruction-following capabilities of LLMs, and thus align them with human values.
However, the data generated by Magpie may contain harmful instructions and/or responses, which may lead to unsafe behaviors if used raw in instruction tuning.
Our empirical evaluations indicate that such harmful data instances constitute less than 1% of the dataset.
Our data filtering technique in Appendix C can identify and remove these instances, thus mitigating the risk.

## 7 Conclusion

In this paper, we developed a scalable method, Magpie, to synthesize instruction data for fine-tuning large language models.
Magpie leveraged the predefined instruction templates of open-weight LLMs and crafted a prompt specifying only the role of instruction provider.
Given the crafted prompt, the LLM then generated detailed instructions due to their auto-regressive nature.
Magpie then sent the generated instructions to the LLM to generate corresponding responses.
These pairs of instructions and responses constituted the instruction dataset.
We used Llama-3-8B-instruct to label the instruction dataset and developed a filtering technique to select effective data instances for instruction tuning.
We fine-tuned the Llama-3-8B base model using the selected data, and demonstrated that the fine-tuned model outperformed those fine-tuned using all baselines.
Moreover, our fine-tuned models outperformed the official aligned model, Llama-3-8B-Instruct, which has been instruction-tuned and preference-optimized using more than 10M data instances.
This highlighted the quality of the instruction data synthesized by Magpie.

## 8 Acknowledgement

The research of Z. Xu, F. Jiang, L. Niu, and R. Poovendran is partially supported by the National Science Foundation (NSF) AI Institute for Agent-based Cyber Threat Intelligence and Operation (ACTION) under grant IIS 2229876 and Air Force Office of Scientific Research (AFOSR) under grant FA9550-23-1-0208.
The research of Y. Choi is partially supported by the National Science Foundation (NSF) under grant DMS-2134012 (Scaling Laws of Deep Learning) and the Office of Naval Research (ONR) under grant N00014-24-1-2207 (Symbolic Knowledge Distillation of LLMs for All: Diverse Scales, Skills, and Values).

This work is supported in part by funds provided by the National Science Foundation, Department of Homeland Security, and IBM.
Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the NSF or its federal agency and industry partners.

## Appendix A Statistics of instruction datasets generated by Magpie compared to other instruction datasets.

Magpie can be readily deployed to state-of-the-art open-weight model families, including but not limited to Llama-3 (Meta, ), Llama-3.1 (Dubey et al., ), Qwen2 (Yang et al., ), Gemma-2 (Team et al., ), and Phi-3 (Abdin et al., ) model families.

In what follows, we compare datasets generated by Magpie with the above model families compared to other state-of-the-art instruction datasets.
The Magpie dataset family encompasses over 11.4 million diverse and high-quality instructions and corresponding responses generated from state-of-the-art open-source models. This corpus represents the largest alignment dataset for LLMs that does not rely on human-written questions or employ complex multi-stage pipelines.

**Table 4: Statistics of Magpie family compared to other instruction datasets. Tokens are counted using the tiktoken library (OpenAI, ).**
| Instruction<br>Source | Dataset Name | #Convs | #Turns | Human<br>Effort | Response<br>Generator | #Tokens / Turn | #Total Tokens |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Synthetic | Alpaca (Taori et al., ) | 52K | 1 | Low | text-davinci-003 | 67.38±54.88 | 3.5M |
| Evol Instruct (Xu et al., ) | 143K | 1 | Low | ChatGPT | 473.33±330.13 | 68M |  |
| UltraChat (Ding et al., ) | 208K | 3.16 | Low | GhatGPT | 376.58±177.81 | 238M |  |
| Human | Dolly (Databricks, ) | 15K | 1 | High | ChatGPT | 94.61±135.84 | 1.42M |
| ShareGPT (Zheng et al., ) | 112K | 4.79 | High | ChatGPT | 465.38±368.37 | 201M |  |
| WildChat (Zhao et al., ) | 652K | 2.52 | High | GPT-3.5 & GPT-4 | 727.09±818.84 | 852M |  |
| LMSYS-Chat-1M (Zheng et al., ) | 1M | 2.01 | High | Mix | 260.37±346.97 | 496M |  |
| Mixture | Deita (Liu et al., ) | 9.5K | 22.02 | - | Mix | 372.78±182.97 | 74M |
| OpenHermes (Teknium, ) | 243K | 1 | - | Mix | 297.86±258.45 | 72M |  |
| Tulu V2 Mixture (Ivison et al., ) | 326K | 2.31 | - | Mix | 411.94±447.48 | 285M |  |
| Magpie | Llama-3-Magpie-Air | 3M | 1 | No | Llama-3-8B-Instruct | 426.39±217.39 | 1.28B |
| Llama-3-Magpie-Air-MT | 300K | 2 | No | Llama-3-8B-Instruct | 610.80±90.61 | 366M |  |
| Llama-3-Magpie-Pro | 1M | 1 | No | Llama-3-70B-Instruct | 478.00±211.09 | 477M |  |
| Llama-3-Magpie-Pro-MT | 300K | 2 | No | Llama-3-70B-Instruct | 554.53±133.64 | 333M |  |
| Llama-3.1-Magpie-Pro | 1M | 1 | No | Llama-3.1-70B-Instruct | 482.35±378.45 | 482M |  |
| Llama-3.1-Magpie-Pro-MT | 300K | 2 | No | Llama-3.1-70B-Instruct | 552.53±325.49 | 331M |  |
| Qwen2-Magpie-Air | 3M | 1 | No | Qwen2-7B-Instruct | 577.87±416.10 | 1.73B |  |
| Qwen2-Magpie-Pro | 1M | 1 | No | Qwen2-72B-Instruct | 424.87±339.71 | 424M |  |
| Gemmma-2-Magpie-Pro | 1M | 1 | No | Gemma-2-27b-it | 483.90±237.80 | 259M |  |
| Phi-3-Magpie-Pro | 534K | 1 | No | Phi-3-Medium-Instruct | 391.38±414.32 | 391M |  |

## Appendix B MagpieLM

Figure: Figure 6: This figure shows the performance of MagpieLM-4B-Chat and MagpieLM-8B-Chat compared with baselines. MagpieLM significantly outperforms baselines of similar sizes.
Refer to caption: x8.png

In this section, we discuss the details of our MagpieLM. To construct the SFT and DPO datasets for aligning MagpieLM, we select 550K and 200K high-quality instructions, respectively, from the Magpie family. These instructions cover diverse categories, ensuring a comprehensive training set. We then generate corresponding responses using the Gemma-2-9b-it model (Team et al., ).

The benchmark performance of both models is demonstrated in Figure 6. Notably, MagpieLM significantly outperforms other baselines of similar model sizes across multiple benchmarks, including Alpaca Eval 2 (Li et al., ), Arena Hard (Li et al., ), and Wildbench (Lin et al., ).

## Appendix C Filter Setups

In this section, we explore potential filter configurations for selecting high-quality instructional data for fine-tuning purposes. We provide the following metrics to enable users to customize their filtered Magpie dataset:

- 1.
Input Length: The total number of characters in the instructions.
- 2.
Output Length: The total number of characters in the responses.
- 3.
Task Category: The specific category of the instructions. See Appendix D.1 for details.
- 4.
Input Quality: The clarity, specificity, and coherence of the instructions, rated as ‘very poor’, ‘poor’, ‘average’, ‘good’, and ‘excellent’.
- 5.
Input Difficulty: The level of knowledge required to address the task described in the instruction, rated as ‘very easy’, ‘easy’, ‘medium’, ‘hard’, or ‘very hard’.
- 6.
Minimum Neighbor Distance: The embedding distance to the nearest neighbor. Can be used for filtering out repetitive or similar instances.
- 7.
Reward: Denoted as $r^{*}$. See Section 3 for details. This metric can be used to filter out low-quality responses, such as repetitions or refusals.
- 8.
Reward Difference: Denoted as $r^{*}-r_{base}$. See Section 3 for details.

We provide several off-the-shelf configurations, as demonstrated in Table 5. We defer the detailed performance analysis of each filter configuration for Magpie-Pro to Appendix F.4.

**Table 5: Different filter configurations we provide. We note that the Output Length filter is applied last. Specifically, this filter selects the $k$ instances of the longest responses. In our experiments, we empirically set $\tau_{1}=-12$, and $\tau_{2}=0$.**
| Source Dataset | Filter Name | #Convs | Input<br>Length | Output<br>Length | Task<br>Category | Input<br>Quality | Input<br>Difficulty | Min Neighbor<br>Distance | Reward | Reward<br>Difference |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Magpie-Air | Filter | 300K | - | Longest | - | $\geq$ good | $\geq$ medium | $>0$ | - | $>\tau_{2}$ |
| Magpie-Pro | Filter | 300K | - | Longest | - | $\geq$ average | - | $>0$ | $>\tau_{1}$ | - |
| Filter2 | 300K | - | Longest | - | $\geq$ good | $\geq$ easy | $>0$ | $>\tau_{1}$ | - |  |
| Filter3 | 300K | - | Longest | - | - | - | $>0$ | $>\tau_{1}$ | - |  |
| Filter4 | 300K | - | Longest | - | $\geq$ good | $\geq$ easy | $>0$ | - | $>\tau_{2}$ |  |
| Filter5 | 338K | - | - | - | $\geq$ good | $\geq$ easy | $>0$ | $>\tau_{1}$ | - |  |
|  | Filter6 | 200K | - | Longest | - | - | $50\%$ easy + $50\%$ $>$ easy | $>0$ | $>\tau_{1}$ | - |

## Appendix D More Dataset Analysis

This section provides additional dataset analysis, complementing the discussions in Section 3. Statistics including lengths of instructions and responses are illustrated in Figure 8.

### D.1 Additional Analysis on Dataset Coverage and Attributes.

#### Dataset Coverage Measured by T-SNE.

Figure 8 presents the t-SNE plots of Magpie-Pro, Alpaca, Evol Instruct, and UltraChat. Each t-SNE plot is generated by randomly sampling 10,000 instructions from the associated dataset.
We observe that the t-SNE plot of Magpie-Pro encompasses the area covered by the plots of Alpaca, Evol Instruct, and UltraChat.
This suggests that Magpie-Pro provides a broader or more diverse range of topics, highlighting its extensive coverage across varied themes and subjects.

Figure: Figure 7: Lengths of instructions and responses in Magpie-Air/Pro.
Refer to caption: x9.png

#### Task Categories of Magpie -Pro and Magpie -Air.

Figure 9 illustrates the task category distributions for Magpie-Pro and Magpie-Air, as labeled by Llama-3-Instruct. We observe that the task category distributions of these two datasets are largely similar, however, Magpie-Pro exhibits a higher percentage of creative writing tasks.

Figure: (a) Task categories of Magpie-Pro.
Refer to caption: x10.png

#### Visualization of Root Verbs and Their Direct Noun Objects.

Figure 10 visualizes the top common root verbs and their direct noun objects of Magpie-Air dataset. This indicates the diverse topic coverage of MAGPIE-Air.

Figure: Figure 10: This figure demonstrates the top 20 most common root verbs (shown in the inner circle) and their top 5 direct noun objects (shown in the outer circle) within the Magpie-Air dataset. This indicates that Magpie encompasses a broad range of topics.
Refer to caption: x12.png

### D.2 Additional Safety Analysis

Table 6 illustrates the percentage of different unsafe categories of Magpie-Air and Magpie-Pro, as labeled by Llama-Guard-2 (Team, ). We have two key observations. First, the proportion of data containing potentially harmful queries is minimal, with less than 1% for both datasets. Second, the majority of unsafe responses fall into the category of specialized advice, which includes responses that may offer specialized financial, medical, or legal advice, or suggest that dangerous activities or objects are safe.

**Table 6: This table shows the percentage of different unsafe categories of Magpie-Air and Magpie-Pro tagged by Llama-Guard-2 Team () model.**
| Dataset | Safe | Violent<br>Crimes | Non-Violent<br>Crimes | Sex-Related<br>Crimes | Child Sexual<br>Exploitation | Specialized<br>Advice | Privacy | Intellectual<br>Property | Indiscriminate<br>Weapons | Hate | Suicide &<br>Self-Harm | Sexual<br>Content | Others |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Magpie-Air | 99.128% | 0.001% | 0.073% | 0.003% | 0.000% | 0.636% | 0.022% | 0.026% | 0.038% | 0.001% | 0.002% | 0.009% | 0.062% |
| Magpie-Pro | 99.347% | 0.001% | 0.049% | 0.002% | 0.000% | 0.446% | 0.015% | 0.074% | 0.014% | 0.001% | 0.004% | 0.011% | 0.036% |

### D.3 Ablation Analysis on Generation Configurations

Figure: (a) Average Quality Scores of Magpie-Air
Refer to caption: x13.png

Ablation Analysis on Decoding Parameters. We conduct an ablation analysis on the decoding parameters used in generating instruction with Magpie. Specifically, we use three different temperatures (i.e., $1$, $1.1$, and $1.2$) and top-p values (i.e., $1$, $0.995$, and $0.99$) during Step 1 of Magpie. We use three metrics, Average Quality Score, Average Difficulty Score and Average Minimum Neighbor Distance to characterize the quality, difficulty, and diversity of instructions using different decoding parameters.
The Average Quality Score is calculated by averaging the ratings of all data within a specific temperature-top-p pair, on a scale from 1 (‘very poor’) to 5 (‘excellent’). Similarly, the Average Difficulty Score is rated on a scale from 1 (‘very easy’) to 5 (‘very hard’).
The Average Minimum Neighbor Distance is calculated by averaging the minimum neighbor distances, as defined in Section 3, for all data generated using the same decoding parameters.

Figure: Figure 12: This figure compares the input quality and difficulty with and without system prompts.
Refer to caption: x16.png

The findings are summarized in Figure 11. We observe that higher temperature and top-p values may slightly decrease the overall quality of instructions, while simultaneously increasing the difficulty and remarkably enhancing the diversity of the instructions generated. The selection of these hyper-parameters should be tailored to the user’s specific requirements, balancing the trade-offs between quality, difficulty, and diversity.

Ablation Analysis on the System Prompt. Figure 12 compares the use of system prompt compared with not using it in Step 1 of Magpie. Since the Llama-3 model does not have an official system prompt, we use the default system prompt from Vicuna (Chiang et al., ): A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user’s questions. We observe that using a system prompt generally results in a decrease in the overall quality of instructions, and the instructions are easier.
Consequently, we recommend not appending system prompts in default settings.

### D.4 Impact of Annotating Models

Figure: Figure 13: This figure compares the impact of different annotators on evaluating the instruction quality and difficulty.
Refer to caption: x17.png

We note that LLMs may occasionally favor its own response (Deutsch et al., ). In what follows, we conduct experiments to evaluate the impact of annotating models when labeling quality and difficulty of the Magpie-Air dataset. We used the Qwen-2-7B-Instruct model (outside the Llama-3 family) to annotate the quality and difficulty of our Magpie-Air dataset. The statistics are summarized in Figure 13.

Our findings show that even when evaluated by Qwen-2-7B-Instruct, the Magpie-Air dataset maintains high quality and difficulty, which is even higher than those originally annotated by Llama-3-8B-Instruct. This suggests that our dataset’s quality is robust across different annotators.

## Appendix E Detailed Experimental Setups

### E.1 Experimental Setups for Generating Magpie -Air and Magpie -Pro

As detailed in Appendix D.3, varying decoding parameters in Step 1 can significantly influence the quality, difficulty, and diversity of the generated instructions. To optimize the trade-offs among these attributes, we employ diverse decoding parameters for the generation of Magpie-Air and Magpie-Pro. Table 7 presents the configurations of Magpie-Air and Magpie-Pro, showcasing how diverse decoding parameters shape each dataset.

We employ greedy decoding to generate responses in Step 2 for Magpie-Air and Magpie-Pro. The intuition is that the word with the highest probability is more likely to originate from the model’s training dataset.

**Table 7: This table demonstrates the configurations of generating instructions of Magpie-Air and Magpie-Pro datasets with varying decoding parameters.**
| Dataset | Decoding Parameters | Total #Convs |  |  |
| --- | --- | --- | --- | --- |
| Temperature | Top-p | #Convs |  |  |
| Magpie-Air | 1.0 | 1.00 | 300K | 3M |
| 1.0 | 0.995 | 300K |  |  |
| 1.0 | 0.990 | 300K |  |  |
| 1.1 | 1.00 | 300K |  |  |
| 1.1 | 0.995 | 300K |  |  |
| 1.1 | 0.990 | 300K |  |  |
| 1.2 | 1.00 | 300K |  |  |
| 1.2 | 0.995 | 300K |  |  |
| 1.2 | 0.990 | 300K |  |  |
| 1.25 | 1.00 | 100K |  |  |
| 1.25 | 0.995 | 100K |  |  |
| 1.25 | 0.990 | 100K |  |  |
| Magpie-Pro | 1.0 | 1.00 | 300K | 1M |
| 1.1 | 0.995 | 300K |  |  |
| 1.2 | 0.995 | 300K |  |  |
| 1.25 | 0.990 | 100K |  |  |

### E.2 Experimental Setups for Instruction Tuning and Preference Tuning

Supervised Fine-Tuning Hyper-parameters. Table 8 demonstrates the detailed supervised fine-tuning hyper-parameters. These experiments were conducted using Axolotl(^5^55[https://github.com/OpenAccess-AI-Collective/axolotl](https://github.com/OpenAccess-AI-Collective/axolotl)).

**Table 8: This table shows the hyper-parameters for supervised fine-tuning.**
| Hyper-parameter | Value |
| --- | --- |
| Learning Rate | $2\times 10^{-5}$ |
| Number of Epochs | $2$ |
| Number of Devices | $4$ |
| Per-device Batch Size | $1$ |
| Gradient Accumulation Steps | $8$ |
| Effective Batch Size | $32$ |
| Optimizer | Adamw with $\beta s=(0.9,0.999)$ and $\epsilon=10^{-8}$ |
| Learning Rate Scheduler | cosine |
| Warmup Steps | $100$ |
| Max Sequence Length | $8192$ |

**Table 9: This table shows the hyper-parameters for direct preference optimization.**
| Hyper-parameter | Value |
| --- | --- |
| Learning Rate | $5\times 10^{-7}$ |
| Number of Epochs | $1$ |
| Number of Devices | $4$ |
| Per-device Batch Size | $2$ |
| Gradient Accumulation Steps | $16$ |
| Effective Batch Size | $128$ |
| Optimizer | Adamw with $\beta s=(0.9,0.999)$ and $\epsilon=10^{-8}$ |
| Learning Rate Scheduler | cosine |
| Warmup Ratio | $10\%$ |

Preference Tuning Hyper-parameters. Table 9 demonstrates the detailed DPO hyper-parameters for aligning Llama-3-8B using Magpie-Air-DPO and Magpie-Pro-DPO. These experiments were conducted using Alignment Handbook(^6^66[https://github.com/huggingface/alignment-handbook](https://github.com/huggingface/alignment-handbook)).

Decoding parameters for evaluation benchmarks. For Arena-Hard (Li et al., ) and WildBench (Lin et al., ), we follow its default setting and use greedy decoding for all settings. For AlpacaEval 2 (Li et al., ) which allows the model provider to specify decoding parameters, we also employ greedy decoding in all experiments with a slightly increased repetition penalty ($RP=1.2$) to mitigate the potential repetitive outputs during the generation.

## Appendix F Additional Experimental Results

### F.1 Performance of Magpie -MT

Table 10 compares the performance of Magpie-Air-MT and Magpie-Pro-MT with their respective single-turn counterparts. We observe that the multi-turn datasets have enhanced performance, particularly in the Arena-Hard benchmark.

**Table 10: This table compares the performance of the multi-turn versions, Magpie-Air-MT and Magpie-Pro-MT, with their single-turn counterparts. All models are instruction-tuned on the Llama-8B base models.**
| Dataset | AlpacaEval 2 | Arena-Hard |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| GPT-4-Turbo (1106) | Llama-3-8B-Instruct |  |  |  |  |  |  |  |
| LC (%) | WR (%) | SD | LC (%) | WR (%) | SD | WR (%) |  |  |
| Magpie-Air | Single-Turn | 22.66 | 23.99 | 1.24 | 49.27 | 50.80 | 1.44 | 14.9 |
| MT | 22.98 | 24.02 | 1.27 | 49.63 | 51.42 | 1.40 | 15.5 |  |
| Magpie-Pro | Single-Turn | 25.15 | 26.50 | 1.30 | 50.52 | 52.98 | 1.43 | 18.9 |
| MT | 24.21 | 25.19 | 1.28 | 52.92 | 54.80 | 1.41 | 20.4 |  |

### F.2 Compare Magpie and Self-Instruct using Llama-3-8B-Instruct

To compare the performance of Magpie and other synthetic dataset generation methods using the same model, we follow the official Self-Instruct (Wang et al., ) setup and generate a 100K supervised fine-tuning dataset using Llama-3-8B-Instruct. For a fair comparison, we select the first 100K data samples from the Magpie-Air dataset generated by Llama-3-8B-Instruct. The performance of models fine-tuned with these two datasets is shown in the table 11.

**Table 11: This table compares the performance of models fine-tuned using 100K instruction-following datasets generated by Self-Instruct and Magpie. All models are supervised-fine-tuned on the Llama-8B base models. We observe that Magpie significantly outperforms Self-Instruct across all benchmarks.**
| Dataset | #Convs | AlpacaEval 2 | Arena-Hard |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| GPT-4-Turbo (1106) | Llama-3-8B-Instruct |  |  |  |  |  |  |  |
| LC (%) | WR (%) | SD | LC (%) | WR (%) | SD | WR (%) |  |  |
| Magpie-Air-100K | 100K | 20.17 | 21.33 | 1.21 | 46.82 | 48.76 | 1.44 | 15.7 |
| Self-Instruct (Llama-3) | 100K | 7.21 | 5.18 | 0.7 | 17.86 | 12.73 | 1.05 | 4.0 |

We observe a significant performance gap between models fine-tuned with datasets generated by Self-Instruct and our Magpie. Our analysis revealed that the instruction format in Self-Instruct-generated datasets is predominantly constrained by the patterns defined in the seed instructions, resulting in a lack of diversity. This comparison indicates the novelty of our Magpie in generating diverse high-quality instructions without any seed questions.

### F.3 Ablation Analysis on Data Quantity and Quality

In what follows, we compare within the family of datasets generated by Magpie in Table 12.
These datasets differ in size, deployment of filtering, and models used to generate data.
We observe that as the dataset’s size increases, the fine-tuned model’s performance improves, indicating that data quantity plays a critical role in enhancing instruction-following capabilities.
Furthermore, the model fine-tuned with Magpie-Pro-300K-Filtered outperforms those fine-tuned with the same or even higher amounts of raw data.
This demonstrates the effectiveness of our filtering technique, and underscores the importance of data quality.
Finally, we observe that the models fine-tuned with Magpie-Pro consistently outperform those fine-tuned with Magpie-Air. The reason is that Magpie-Pro is generated by the more capable model, i.e., Llama-3-70B-Instruct.

**Table 12: This table compares Magpie datasets within its family that differ in size, deployment of filtering, and models used to generate data. All models are supervised-fine-tuned on the Llama-8B base models.**
| Dataset | #Convs | AlpacaEval 2 | Arena-Hard |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| GPT-4-Turbo (1106) | Llama-3-8B-Instruct |  |  |  |  |  |  |  |  |
| LC (%) | WR (%) | SD | LC (%) | WR (%) | SD | WR(%) |  |  |  |
| Magpie-Air | 300K-Raw | 300K | 21.99 | 21.65 | 1.21 | 48.63 | 48.06 | 1.42 | 15.8 |
| 3M-Raw | 3M | 22.96 | 21.09 | 1.20 | 50.57 | 48.40 | 1.42 | 16.1 |  |
| 300K-Filtered | 300K | 22.66 | 23.99 | 1.24 | 49.27 | 50.8 | 1.44 | 14.9 |  |
| Magpie-Pro | 300K-Raw | 300K | 21.65 | 22.19 | 1.2 | 49.65 | 50.84 | 1.42 | 15.9 |
| 1M-Raw | 1M | 24.16 | 23.93 | 1.25 | 49.97 | 50.34 | 1.43 | 16.7 |  |
| 100K-Filtered | 100K | 20.47 | 24.52 | 1.25 | 47.92 | 52.75 | 1.43 | 17.2 |  |
| 200K-Filtered | 200K | 22.11 | 26.02 | 1.26 | 51.17 | 56.76 | 1.41 | 15.9 |  |
| 300K-Filtered | 300K | 25.08 | 29.47 | 1.35 | 52.12 | 53.43 | 1.44 | 18.9 |  |
| Magpie-Air + Magpie-Pro | 4M-Raw | 4M | 24.45 | 24.08 | 1.26 | 51.96 | 52.08 | 1.42 | 15.5 |

### F.4 Ablation Analysis on Filter Designs

We conduct an ablation analysis on various filter designs within Magpie-Pro to assess their impact on the performance of supervised fine-tuned models. The results are presented in Table 13. We observe that different filtering strategies yield optimal performance on different benchmarks, and no single filter consistently achieves the best performance across all benchmarks. Therefore, determining how to select instructional data to enhance the performance in supervised fine-tuning is an interesting topic for future research.

**Table 13: This table compares the performance of different filter designs within Magpie-Pro. All models are supervised-fine-tuned on the Llama-8B base models.**
| Dataset and Filter | AlpacaEval 2 | Arena-Hard |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| GPT-4-Turbo (1106) | Llama-3-8B-Instruct |  |  |  |  |  |  |  |
| LC (%) | WR (%) | SD | LC (%) | WR (%) | SD | WR (%) |  |  |
| Magpie-Pro | Filter | 25.08 | 29.47 | 1.35 | 52.12 | 53.43 | 1.44 | 18.9 |
| Filter 2 | 25.15 | 26.50 | 1.30 | 50.52 | 52.98 | 1.43 | 18.9 |  |
| Filter 3 | 23.90 | 25.21 | 1.25 | 51.45 | 53.64 | 1.41 | 18.3 |  |
| Filter 4 | 24.20 | 25.33 | 1.27 | 52.43 | 54.34 | 1.43 | 17.9 |  |
| Filter 5 | 24.85 | 25.12 | 1.26 | 52.12 | 53.43 | 1.44 | 18.4 |  |
| Filter 6 | 23.20 | 28.43 | 1.26 | 51.34 | 57.29 | 1.41 | 17.9 |  |

### F.5 Ablation Analysis on Response Generator

To investigate the impact of the response generator on the supervised fine-tuning performance using Magpie, we conduct an ablation study by replacing the response generator with Qwen-2-7B-Instruct (Yang et al., ) within Magpie-Air-300K-Filtered. We note that the performance of Qwen-2-7B-Instruct is comparable to, or slightly weaker than, Llama-3-8B-Instruct. The results are summarized in Table 14.

We observe that although there is a slight performance degradation, the model fine-tuned using Qwen-2-7B-Instruct as the response generator still outperforms all baselines, including those using GPT-4 as the response generator. These findings indicate two key points: (1) The success of Magpie depends little on the specific response generator used, and (2) the instructions generated by Magpie are of high quality and diversity.

**Table 14: This table compares the impact of different response generators on the model performance. All models are supervised-fine-tuned on the Llama-8B base models.**
| Response Generator | AlpacaEval 2 | Arena-Hard |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- |
| GPT-4-Turbo (1106) | Llama-3-8B-Instruct |  |  |  |  |  |  |
| LC (%) | WR (%) | SD | LC (%) | WR (%) | SD | WR (%) |  |
| Llama-3-8B-Instruct | 22.66 | 23.99 | 1.24 | 49.27 | 50.80 | 1.44 | 14.9 |
| Qwen2-7B-Instruct | 15.01 | 15.60 | 1.05 | 41.09 | 42.07 | 1.47 | 13.7 |

### F.6 Trustworthiness of Magpie -Aligned Models

In what follows, we conduct more experiments to compare Magpie model and Llama-3-8B-Instruct on the TrustLLM benchmark (Huang et al., ). The results for safety, fairness, ethics, privacy, and robustness are summarized in Table 15.

We observe that our supervised-fine-tuned model slightly underperforms Llama-3-8B-Instruct in terms of safety and fairness. However, it outperforms the official instruct model on ethics, privacy, and robustness. Considering that our fine-tuned model uses much fewer data samples (300K compared to over 10M), these results again highlight the high quality of data generated by Magpie.

**Table 15: This table compares the performance of model supervised-fine-tuned using Magpie-Pro-300K-Filtered and the official Llama-3-8B-Instruct on the TrustLLM benchmark (Huang et al., ).**
| TrustLLM | Evaluation/Dataset | Llama-3-8B-Instruct | Magpie-Pro-300K-Filtered |
| --- | --- | --- | --- |
| Safety | Jailbreak (RtA$\uparrow$) | 0.93 | 0.80 |
| Misuse (RtA$\uparrow$) | 0.85 | 0.80 |  |
| Exaggerated Safety (RtA$\downarrow$) | 0.54 | 0.52 |  |
| Fairness | Stereotype Recognition (Acc$\uparrow$) | 0.49 | 0.40 |
| Stereotype Query Test (RtA$\uparrow$) | 1.00 | 0.99 |  |
| Disparagement Sex (p-value$\uparrow$) | 0.99 | 0.99 |  |
| Disparagement Race (p-value$\uparrow$) | 0.55 | 0.47 |  |
| Ethics | Social Chemistry 101 (Acc$\uparrow$) | 0.94 | 0.63 |
| ETHICS (Acc$\uparrow$) | 0.65 | 0.69 |  |
| MoralChoice (Acc$\uparrow$) | 0.97 | 0.95 |  |
| MoralChoice (RtA$\uparrow$) | 0.97 | 0.98 |  |
| Privacy | Privacy Awareness-Normal (RtA$\uparrow$) | 0.33 | 0.71 |
| Privacy Awareness-Augmented (RtA$\uparrow$) | 1.00 | 0.98 |  |
| Privacy Leakage (RtA$\uparrow$) | 0.66 | 0.87 |  |
| Robustness | AdvGlue (RobustScore$\uparrow$) | 0.42 | 0.58 |
| OOD Detection (RtA$\uparrow$) | 0.37 | 0.26 |  |
| OOD Generalization (F1-Score$\uparrow$) | 0.83 | 0.84 |  |

## Appendix G Prompt Templates

### G.1 Prompt Templates for Magpie Extension

This section presents the prompt template used to generate Magpie-MT and control instruction tasks, as detailed in Figure 14 and Figure 15, respectively.

Figure: Figure 14: Prompt for generating Magpie-MT. We take Llama-3-8B-Instruct as an example. The placeholder {instruction} and {response} are from the first turn.

Figure: Figure 15: Prompts for controlling instruction generation tasks. These examples illustrate how to guide Llama-3-8B-Instruct in generating instructions for specific domains: mathematics, coding, translation, and multilingual tasks. To adapt this approach for different instruction tasks, replace the System Prompt placeholder in the System Prompt Template with the appropriate domain-specific prompt.

### G.2 Prompt Templates for Evaluation

Here, we present the prompt template employed to generate task categories, quality, and difficulty, as detailed in Figure 16, Figure 17, and Figure 18, respectively. The placeholder input represents the instructions to be evaluated.

Figure: Figure 16: Prompt for generating task categories

Figure: Figure 17: Prompt for generating quality of instructions

Figure: Figure 18: Prompt for generating difficulty of instructions

## Appendix H Magpie Examples

In this section, we demonstrate several representative instructions generated by Magpie with different task categories. The following instructions are generated by the Llama-3-70B-Instruct model.

Magpie can also generate domain-specific instructions using models that are tailored to particular fields, as mentioned in Section 2.2. The following instructions are generated by DeepSeek-Coder-V2 (Zhu et al., ) and Qwen2-Math-7B-Instruct (Yang et al., ), respectively.

We note that Magpie’s capabilities extend beyond generating English datasets to producing diverse multilingual datasets. The following instructions are generated by the Qwen2-72B-Instruct model.

UTF8gbsn

## Peer Reviews

confidence: 5
contribution: 2
initial_rating: 3
presentation: 2
questions: 1. It is not clear how the model used to generate data affects the final performance. The experimental results show that MAGPIE-Pro-300K-Raw has limited improvements over MAGPIE-Air-300K-Raw. This is counterintuitive and needs more insights.

2. Following up above, one possibility is that the base model is the same (llama-8b). From this point of view, the relationship between the model to be aligned and the model to generate data is crucial. More analysis is required.

3. We can also see that MAGPIE-Pro-300K-Filtered show much better performances when used on Llama than QWen. Of course, this could mean Llama base model is better, but could also be limitations of the proposed method. The proposed method essentially relies on the model itself to control the diversity of generated instructions, which is controlled by the pre-training data. If the model to be aligned was trained with the same pre-training data, we can intuitively expect better performances and less hallucination. If that is the case, it becomes kind of a chicken-egg thing, limiting the usefulness to the proposed method.

4. Why is a separate two-step process necessary? The aligned model should be able to generate instruction and response in one pass?

5. The DPO results are surprisingly good. How does the reward model's quality affect the final performances?
soundness: 2
strengths: - The proposed method is simple yet effective, according to the experimental results. In particular, the generated DPO data show a significant performance boost.

- The ablation study is comprehensive, considering different settings/datasets/baselines as well as different aspects like domain-specific capabilities and safety, though the result analysis lacks depth.
summary: This work proposes Magpie, which is a way to prompt aligned LLMs to generate alignment datasets. Unlike most previous studies in this area (LLM-generated alignment data), Magpie removes the need of a seed set of instructions and heavy prompt engineering efforts. Instead of prompting aligned LLMs with an meaningful instruction, Magpie directly puts the "pre-instruction" token, i.e. one of the formatting delimiter tokens, to LLMs and let the LLMs generate single-turn instructions "freely". With limited extra prompt engineering efforts and an extra reward model, the method can be extended to multi-turn, multi-lingual, multi-domain data, and DPO cases (preference data). The experimental results indicate that datasets generated through Magpie are of high quality, yielding superior performances on AlpacaEval2, ArenaHard, and WildBench, as well as comparable performances on general benchmarks like MMLU, GSM8K, etc.
weaknesses: - The presentation can be improved by putting more experimental results in the main context instead of the appendix. The proposed method is simple and easy to understand, similar to most prompt engineering related studies. The experimental results along with analysis and hypothesis test are the most important. For example, Section 3 is less important than Appendix F in terms of demonstrating the method's pros and cons.

- The experiments are well designed but lack deep analysis, which leaves many questions unanswered and makes it hard for other researchers to understand the method's best use cases and limitations. Please refer to Questions for details.

- For those most understanding results, e.g. surpassing GPT-4-Turbo(1106) on AlpacaEval 2, qualitative results are needed, i.e. random samples of actual generations for those benchmarks from all models in comparison. It is known that LLM-based judge could be biased and misleading.

- It would be better to add more alignment benchmarks like IFEval.

---

confidence: 4
contribution: 3
initial_rating: 6
presentation: 3
questions: Based on the Weaknesses, the questions are as follows:
1. How does the performance of Magpie look on multiturn benchamark? 
2. Does Magpie generation process even scale for longer turns?
3. Why there are limited improvements in Table 3 in comparison to massive improvements in Table 2?
4. As the data generation process is un-contolled, contamination analysis in Magpie datasets would be helpful.
5. How effective are system prompts for providing some control over the generation process? Is there any way to measure that? Are there any domain specific results?
6. How the generation process ensures diversity of instructions?
soundness: 3
strengths: 1. The paper introduces a simple & cost effective method of generating alignment data at scale, without relying on closed models or expensive human annotations.
2. Results on Alpaca Eval & Arena hard show significant improvements compared to other baseline datasets.
3. The paper presents an exhaustive quantative & qualitative experiments on question difficulty, safety, task categories, etc to highlight the attributes in Magpie.
4. The authors also experiments with various filtering configuration to improve the quality of final set of instructions.
summary: The paper introduces a new dataset for instruction fine-tuning and preference optimization called Magpie. The dataset is curated by prompting either LLama-3-70B-Instruct or LLama-3-8B-Instruct with the pre-query template or user tags and relying on the next token prediction ability of the model to elicit instructions. The instructions collected are then used to gather responses from LLMs. To generate instruction & responses that are multiturn or relevant to a certain task, the authors add relevant system prompts to steer the model ouptuts. Experiments across multiple baseline datasets, base models and comparison on multiple benchmark shows that effectiveness of Magpie dataset. The paper also has qualitative analysis highlighting various attributes of the dataset.
weaknesses: 1. The Magpie dataset is not conversational in nature. The MT variant of the dataset has at maximum 2 turns. In contrast, datasets like Ultrachat, Open Assistant and WildChat are multi-turn with maximum upto 7-8 turns. Also, the paper has no experiments or analysis on conversational benchmark and multi-turn nature of Magpie in comparison to existing datasets.
2. The paper has very limited improvements on OpenLLM leaderboard in Table 3 when compared to improvements in Table 2. Why is this the case, more dicussion around this is needed.
3. The paper does not have any analysis on contamination or information leakage in the dataset for the evaluation benchmarks used. Although the dataset is purely sythetic, and does not use any seed data the chances of leakage are less, but as there is no control over what the LLM generates, the chances that LLM results in generic instructions that end up being similar to evaluation datasets are high.
4. The method for generating questions is not controlled at all. The method relies only on the next token prediction, which might lead to simple instructions. The only way to steer the generation process is through system prompts, but it is hard to judge how effective is that, as the paper has no ablations on system prompts.
5. As the generation method is fully un-controlled, how does its ensures diverse instructions? T-SNE plot in figure 7 or the similarity analysis in Figure 3 using all-mpnet-base-v2 model is not enough to gauge the diversity.
6. The paper mentions that the method can be used to generate domain specific and multilingual datasets in the abstract. However, there are no evaluations on multilingual or domain specific data.

---

confidence: 4
contribution: 3
initial_rating: 6
presentation: 4
questions: An important aspect of the work is the fact that aligned LLMs can generate user prompts with just a system prompt. 

For instance, the below system prompt would help generate user prompts for code related tasks.

"You are an AI assistant designed to provide helpful, step-by-step guidance on coding problems. The user will ask you a wide range of coding questions. Your purpose is to assist users in understanding coding concepts, working through code, and arriving at the correct solutions"

If an LLM can indeed produce a lot of diverse user prompts when sampled correctly, the novelty would seem limited. The work does go into depth on filtering etc. However fact remains that the LLM is able to generate most of the prompts. If this point can be addressed, the work would definitely be very convincing.
soundness: 3
strengths: - Good contribution to open source community as the dataset is quite large and diverse
- Interesting finding that aligned LLMs can be used to generate synthetic user instructions with just a system prompt
- Detailed insights on the generated SFT and Alignment pairs were presented
- The framework would be very useful for the open source community
- Authors also present a solution to overcome some limitations of the magpie dataset by developing a booster dataset
summary: MAGPIE is a scalable method for synthesizing high-quality instruction data from aligned large language models (LLMs) without requiring prompt engineering or seed questions. By leveraging the auto-regressive nature of models like Llama-3-Instruct, MAGPIE efficiently generates diverse instruction-response pairs through an automated two-step process, extendable to multi-turn, domain-specific, and multilingual datasets. Extensive analysis shows that models fine-tuned with MAGPIE-generated data outperform those using public datasets and can rival proprietary models fine-tuned on much larger datasets. MAGPIE’s versatility is further demonstrated through extensions for preference optimization and task-specific data generation, making it a significant contribution to scalable LLM alignment and democratized AI research.
weaknesses: - LLMs are typically trained (loss is computed) only on the assistant turns (during SFT, DPO, RLHF etc) and it is not clear how aligned models are able to produce user instructions. The paper does not provide enough insights to understand this. While this may not be directly in scope of the paper, it would help in increasing confidence in the presented approach.

Meta-review: This submission introduces Magpie, a method for automatically generating large-scale high-quality alignment data for LLMs. Its idea is to leverage aligned LLMs such as Llama-3-Instruct to generate instructions by prompting them with pre-defined templates, producing millions of instructions and responses. The proposed method includes extensions for filtering, multi-turn generation, preference optimization, and multilingual data. The authors conducted experiments by comparing the generated data to other public instruction datasets, and results show that models fine-tuned with Magpie outperform those trained on other public datasets. Interestingly, the authors demonstrate that Magpie's performance is competitive with Llama-3-8B-Instruct (10 million data points through SFT and subsequent preference optimization). 

The reviewers identified the strengths of this work as:
- the paper introduced method is  simple and efficient. it helps generate alignment data at scale, which helps reduce expensive human annotations and reliance on closed models.
- the authors demonstrate significant improvements on Alpaca Eval and Arena. Extensive quantitative and qualitative experiments --- covering cover different aspects such as question difficulty, safety, and task categories ---  are performed. 

The concerns are raised by the reviewers on: 
- 1) Limited Conversational Data and Multi-Turn Analysis: the Magpie dataset lacks conversational depth (with a maximum of 2 turns). Given the importance of multi-turn dialog, comparisons with related datasets or analysis on conversational benchmarks would further the significance of this work.
- 2) there are concerns about the lack of diversity in instructions, and no ablation studies are provided for system prompts to guide generation.
- 3) though the method claims to generate domain-specific and multilingual datasets, no evaluations or experiments are provided for these aspects, limiting the generalizability of the claims.

First of all, it is unfortunate that only three out of five assigned reviewers submitted reviews. During the rebuttal, the authors managed to convince reviewer D1Jb to increase their score from 6 to 8. Reviewer DhCK decided to keep their rating to 6. Reviewer aNEq did not engage with the author rebuttal until the last minute and eventually decided to keep their rating as 3. 

The AC went through reviewer aNEq's review, the authors' rebuttal to it, and the reviewer's engagement. It is difficult for the AC to follow the rational to given a rating of 3 based on the three weaknesses (a. move more resutls from appendix to main; b. general comments on more deep analysis and c. qualitative results) given in the review. The authors' rebuttal covers detailed (and very long) responses to these questions, and more importantly, extensive experimental results are also included. It would be much appreciated if the reviewer could engage more with the authors before the ddl (extended one). 

Overall, this work's strength does not lie in its technical novelty. Rather, it shows strong empirical results with comprehensive analysis, and additional extensive experiments provided during rebuttal. In other words, this work offers a simple idea to build alignment data with strong empirical demonstration. All factors considered, this work receives an acceptance recommendation. The authors are suggested to include the new results (during the rebuttal) in the camera ready as "implicitly promised" if accepted.

Decision: Accept (Poster)