Research map / Large language models / Language, safety and interpretability
LongMagpie: A Self-synthesis Method for Generating Large-scale Long-context Instructions
Read the paperCheck your idea against 108,967 papers
AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.
Proposes LongMagpie, which synthesizes long-context instruction data by prompting aligned LLMs with a document followed by a user-role pre-query token, plus a p-Mix strategy for balancing long and short training data.
Problem
Long-context instruction data for aligning long-context LLMs is proprietary or costly to create; human annotation is expensive and template/seed-based synthesis limits scale, diversity, and quality.
Approach
Aligned long-context LLMs, given only a document followed by the special tokens preceding a user turn, auto-regressively generate relevant queries; harvesting these document-query pairs and the model's responses yields instruction data without seeds or prompts. Extends to multi-document contexts and mixes long and short instructions via probabilistic sampling (p-Mix).
Key results
- LongMagpie-only training reaches LongAVG 62.56 vs 60.28 for ChatQA and 56.12 for LongAlign, with LongBench v2 at 34.4.
- LongMagpie + UltraChat via p-Mix achieves LongAVG 61.60 and ShortAVG 64.10, retaining short-context performance.
- Scaling from 190k to 450k samples raises LongAVG from 61.51 to 62.56; using Qwen2.5-70B instead of 7B raises LongAVG from 59.61 to 62.56.
Measured effects reported in the paper
| What was changed | Where | Measured | Effect |
|---|---|---|---|
| Train on LongMagpie-generated instructions instead of ChatQA | Llama-3-8B-NExtLong-512K-Base · HELMET, RULER, LongBench-v2, LongAVG | benchmark score: +1.87 HELMET; +1.35 RULER; +3.6 LongBench-v2; +2.28 LongAVG | Helped |
| Train on LongMagpie-generated instructions instead of LongAlign | Llama-3-8B-NExtLong-512K-Base · HELMET, RULER, LongBench-v2, LongAVG | benchmark score: +4.31 HELMET; +5.09 RULER; +9.9 LongBench-v2; +6.44 LongAVG | Helped |
| Add randomly sampled distractor documents, using n=10 rather than n=0 (ablation) | LongMagpie · Long-context tasks | LongAVG: 60.19 -> 62.56 | Helped |
| Increase the maximum distractor-document count beyond n=10 (ablation) | LongMagpie · Long-context tasks | LongAVG: 62.56 -> 61.88 (n=20); 61.28 (n=40); 60.93 (n=80) | Mixed |
| Use p-Mix instead of sequential mixing (ablation) | LongMagpie with UltraChat · Long-context tasks | LongAVG: 60.75 -> 61.60 | Helped |
| Use p-Mix instead of simple mixing (ablation) | LongMagpie with UltraChat · Long-context tasks | LongAVG: 60.90 -> 61.60 | Helped |
| Use p-Mix instead of no mixing (ablation) | LongMagpie with UltraChat · Short-context tasks | ShortAVG: 62.37 -> 64.10 | Helped |
| Increase LongMagpie data from 190k to 450k samples (ablation) | LongMagpie · Long-context tasks | LongAVG: +1.05 | Helped |
| Synthesize data with Qwen-2.5-70B rather than Qwen-2.5-7B (ablation) | LongMagpie · Long-context tasks | LongAVG: 59.61 -> 62.56 | Helped |
| Set initial prepended short-context samples to 30 rather than 1 at P_L=0.4 (ablation) | p-Mix · Long-context tasks | LongAVG: 61.60 -> 58.69 | Hurt |
| Set P_L to 0.8 rather than 0.4 with N_S=1 (ablation) | p-Mix · Long-context tasks | LongAVG: 61.60 -> 60.30 | Hurt |
Surprising findings
- Multi-document extension with up to n=10 documents works best; performance declines at larger n, attributed to excessive task difficulty.
- LongMagpie-only training gives the best long-context scores but a lower ShortAVG (62.37) than short-only datasets such as UltraChat (64.43).
Limitations
- Inherits biases from the source instruction-tuned LLMs.
- Does not adequately cover tasks requiring long-form outputs.
- Query filtering is heuristic (question mark and length rules).
Experimental setup
Datasets: FineWeb-Edu LongMagpie-generated instructions ChatQA2 data LongAlign Tulu Magpie UltraChat
Benchmarks: HELMET RULER LongBench v2 HellaSwag Lambada ARC-Challenge ARC-Easy PIQA WinoGrande LogiQA
Metrics: accuracy LongAVG ShortAVG
Baselines: Tulu Magpie UltraChat ChatQA LongAlign Sequential Mix Simple Mix
Builds on: Magpie NExtLong ProLong
Closest papers by meaning
- Scaling Instruction-tuned LLMs to Million-token Contexts via Hierarchical Synthetic Data Generation (ICLR 2025 · similarity 0.92)
- LongGenBench: Benchmarking Long-Form Generation in Long Context LLMs (ICLR 2025 · similarity 0.92)
- MAmmoTH2: Scaling Instructions from the Web (NeurIPS 2024 · similarity 0.90)
- LongWriter: Unleashing 10,000+ Word Generation from Long Context LLMs (ICLR 2025 · similarity 0.89)
- A Little Goes a Long Way: Efficient Long Context Training and Inference with Partial Contexts (ICLR 2025 · similarity 0.89)
- LOGO --- Long cOntext aliGnment via efficient preference Optimization (ICML 2025 · similarity 0.89)
Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.
