🤖 AI Summary
To address the scarcity of high-quality instruction data, prohibitive human annotation costs, and limited diversity and scalability of template-based synthesis methods in aligning long-context large language models (LLMs), this paper proposes LongMagpie—a self-synthesizing framework. LongMagpie introduces a novel model-autoregressive instruction generation paradigm: leveraging already-aligned long-context LLMs (e.g., Qwen, Llama), it employs prompt engineering, special-token triggering mechanisms, and document-query-response triplet construction to fully automatically synthesize high-quality, diverse, long-context instruction data from raw documents—without human annotation. The framework enables open-source, scalable, and cost-effective dataset construction. Experiments demonstrate that models trained on LongMagpie-generated data achieve state-of-the-art performance on long-context benchmarks—including HELMET, RULER, and LongBench v2—while preserving competitive short-context accuracy.
📝 Abstract
High-quality long-context instruction data is essential for aligning long-context large language models (LLMs). Despite the public release of models like Qwen and Llama, their long-context instruction data remains proprietary. Human annotation is costly and challenging, while template-based synthesis methods limit scale, diversity, and quality. We introduce LongMagpie, a self-synthesis framework that automatically generates large-scale long-context instruction data. Our key insight is that aligned long-context LLMs, when presented with a document followed by special tokens preceding a user turn, auto-regressively generate contextually relevant queries. By harvesting these document-query pairs and the model's responses, LongMagpie produces high-quality instructions without human effort. Experiments on HELMET, RULER, and Longbench v2 demonstrate that LongMagpie achieves leading performance on long-context tasks while maintaining competitive performance on short-context tasks, establishing it as a simple and effective approach for open, diverse, and scalable long-context instruction data synthesis.