GO TO A SECTION

↑ ↓ to navigate · Enter to openExplore all sections →
FDEInterviews logo
arXiv preprint

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

Give an open chat model only the opening of a user turn and it writes a user's question. 300K filtered pairs from Llama-3 rival its official instruct model, at about $1 per 1,000 pairs.

Breakdown by FDE Interviews · 12 min read · Updated

About the original · 2024
AUTHORS
Xu, Jiang, Niu, Deng, Poovendran, Choi, Lin
FROM
University of Washington, Allen Institute for AI
PUBLISHED
Jun 2024 · arXiv preprint
CITED BY
413Semantic Scholar · Oct 2026
IN THIS BREAKDOWN · 10 SECTIONS

You can read 19% of this breakdown.

01

The paper in one minute

Chat models are fine-tuned on conversations wrapped in a fixed template. For Llama-3-Instruct, a user turn begins with <|start_header_id|>user<|end_header_id|>. The authors noticed that if you send the model only that opening and let it continue, it writes a user's message: a question or request of the kind it saw during alignment. Send that message back in the normal way and it answers. That is Magpie: no seed questions, no prompt engineering, just the template.

With Llama-3-8B-Instruct they generated 3 million instruction-response pairs (Magpie-Air) in 206 A100 hours; with Llama-3-70B-Instruct, 1 million (Magpie-Pro) in 614. At cloud prices that is about $0.12 and $1.1 per thousand pairs. They then score each instruction for quality and difficulty with Llama-3-8B, compute each one's distance to its nearest neighbor in embedding space to drop near-duplicates, and score responses with a reward model, and select 300,000.

Extensions follow from the same trick: a system prompt describing a math tutor or a Chinese assistant steers what the model asks; appending the template again after a response produces multi-turn conversations; and sampling five responses per instruction and keeping the reward model's best and worst gives preference pairs for DPO.

Fine-tuning Llama-3-8B on 300K filtered pairs beat every public dataset they tested on AlpacaEval 2 and Arena-Hard, beat a public SFT-plus-DPO pipeline, and on AlpacaEval 2 beat Llama-3-8B-Instruct, which was trained on over 10 million examples. With Magpie's own DPO data added, the model passed GPT-4-Turbo on AlpacaEval 2. It lagged on math and knowledge tests until a reasoning-focused add-on was mixed in.

THE IDEA, VISUALLY
ASK THE MODEL TO WRITE THE USER'S TURN <|start_header_id|>user<|end_header_id|> nothing else: the template stops where a user message would begin "What materials should I use to build a nest?" (written by the model) send it back as a normal query → the model's response a system prompt steers domain or language (math, code, Chinese) Llama-3-8B: 3M pairs in 206 A100-h; 70B: 1M in 614 A100-h ≈ $0.12 and $1.1 per 1,000 pairs; no seed questions, no API THEN FILTER, AND BUILD PREFERENCE PAIRS length · rated quality · rated difficulty (by Llama-3-8B) min distance to nearest neighbour in embedding space reward-model score and gain over the base model's answer 300K kept per dataset; 6 off-the-shelf filter settings DPO: 5 samples at T = 0.8, best vs worst by a reward model < 1% flagged unsafe by Llama-Guard-2 no single filter won on every benchmark (Table 13) ALPACAEVAL 2 LC VS GPT-4-TURBO, LLAMA-3-8B (TABLE 1) ShareGPT 112K, SFT 9.73 OpenHermes 2.5 1M, SFT 12.89 WildChat 652K, SFT 14.62 UltraChat SFT + UltraFeedback DPO 18.36 Magpie-Air 300K filtered, SFT 22.66 Magpie-Pro 300K filtered, SFT 25.08 Llama-3-8B-Instruct (>10M) 22.92 Magpie-Pro SFT + Magpie DPO 50.1 Arena-Hard after SFT: Magpie-Pro 18.9, official model 20.6 WHERE SFT ON MAGPIE FALLS SHORT (TABLE 3) GSM8K MMLU Magpie-Pro 300K filtered 47.92 64.25 + 150K reasoning booster 63.08 65.65 OpenHermes 2.5 (1M) 67.02 65.70 Llama-3-8B-Instruct 71.72 67.82 WHO WRITES THE ANSWERS MATTERS (TABLE 14) same Magpie-Air instructions, LC vs GPT-4-Turbo: Llama-3-8B answers 22.66 · Qwen2-7B answers 15.01
An aligned model has seen so many user turns that the start of one is enough to make it write a question. Filtering that stream for quality and near-duplicates gives instruction data that beat every public set tested, though not on reasoning.
Research notes: the problem, approach and results
$1.1

approximate cloud cost per 1,000 Magpie-Pro instruction-response pairs from Llama-3-70B-Instruct, on 4 A100s

25.08 vs 14.62

AlpacaEval 2 length-controlled win rate after SFT on Magpie-Pro filtered versus the best public dataset tested (WildChat)

47.92

GSM8K after SFT on Magpie-Pro filtered, against 71.72 for Llama-3-8B-Instruct; a 150K reasoning add-on raised it to 63.08

THE PROBLEM

Instruction-tuning data is either written by people (slow, costly) or generated by prompting a model with seed questions, which narrows what it produces. The data behind open models like Llama-3-Instruct is not public.

THE IDEA

Send an aligned open model only its chat template's pre-query part, the tokens that begin a user message. It completes a plausible user instruction; send that back to get the response. Repeat millions of times, filter by quality, difficulty, near-duplicates and reward, and optionally build preference pairs from best and worst responses.

THE RESULT

Llama-3-8B fine-tuned on 300K filtered Magpie-Pro pairs scores 25.08 length-controlled win rate on AlpacaEval 2, above every public dataset tested (best 14.62), above UltraChat plus DPO (18.36) and above Llama-3-8B-Instruct (22.92). It trails the official model on Arena-Hard (18.9 vs 20.6) and on GSM8K (47.92 vs 71.72).

02

Why it matters to an FDE

Customers who want to fine-tune often have no instruction data at all, or cannot send their data to an external API to generate it. Magpie needs only an open-weight chat model running on their own GPUs. Nothing leaves the building, and there is no seed set to write first.

It is cheap and fast. About $1 per thousand pairs with a 70B model; a million responses took 150 hours on four A100s. A domain-specific set of 50,000 pairs is a weekend job.

It can be steered. The paper's system prompts ("you are an assistant for math problems") changed what kind of questions the model invented. A customer can describe their domain the same way: a support assistant for their product, an analyst for their reports.

It inherits the generator's habits. The questions are the kind the generating model expects users to ask; over half were information-seeking in Magpie-Pro, and reasoning tasks were rare enough that math scores fell. The answers are only as good as the model writing them: swapping the answer writer from Llama-3-8B to Qwen2-7B cut the win rate from 22.66 to 15.01. And the generator's license terms on using its outputs to train other models apply, which the paper does not discuss.

THE FULL BREAKDOWN

Understand the mechanism. Try it on a real problem.

Unlock this breakdown and 149 more papers.

Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.

6 months · One payment · No auto-renewal

Get Premium · ₹2,000 / $25
  • ◇1 architecture diagram
  • </>1 runnable code experiment
  • ▦2 results tables
  • ?5 interview questions with answers
  1. 03Key takeaways

    What the filters, size and generator contributed, preference data, and three misreadings

    Free account
  2. 04How it works

    The two-step pipeline, filters, the multi-turn and preference extensions, and the training setup

    Premium
  3. 05The numbers that matter

    Cost, SFT and DPO results, Qwen transfer, benchmarks beyond chat, ablations and trust results

    Premium
  4. 06Try it yourself

    Recompute costs and claims, see near-duplicate filtering work, and size preference sampling

    Premium
  5. 07Where it breaks

    Generator dependence, weak reasoning data, judge-based evaluation, safety drift and slips

    Premium
  6. 08Using it on a deployment

    Generating a domain instruction set on site, filtering it, and checking what it misses

    Premium
  7. 09Interview angles

    Five questions this paper prepares you for, with answer hints

    Premium
Back to the paper library →