Scaling Instruction-Tuned LLMs to Million-Token Contexts via Hierarchical Synthetic Data Generation
Linda He, Jue Wang, Maurice Weber, Shang Zhu, Ben Athiwaratkun, Ce Zhang
TL;DR
This work tackles the scarcity and inefficiency of long-context data for instruction-tuning open LLMs by introducing a hierarchical, QA-based synthetic data pipeline that generates coherent long-context (up to $1{,}000{,}000$ tokens) instruction data from short-context models and multiple documents. It employs stepwise RoPE scaling to progressively widen the context window and demonstrates state-of-the-art ultra-long-context performance on RULER and InfiniteBench, while preserving general task abilities on LongBench and MMLU. Extensive ablations validate the importance of hierarchical structure, diverse and multi-hop questions, and fixed question counts, and robustness experiments show the method works across generator sizes. The approach is highly scalable, enabling practical training of ultra-long-context LLMs and offering a data-centric path toward longer horizons in real-world applications.
Abstract
Large Language Models (LLMs) struggle with long-context reasoning, not only due to the quadratic scaling of computational complexity with sequence length but also because of the scarcity and expense of annotating long-context data. There has been barely any open-source work that systematically ablates long-context data, nor is there any openly available instruction tuning dataset with contexts surpassing 100K tokens. To bridge this gap, we introduce a novel post-training synthetic data generation strategy designed to efficiently extend the context window of LLMs while preserving their general task performance. Our approach scalably extends to arbitrarily long context lengths, unconstrained by the length of available real-world data, which effectively addresses the scarcity of raw long-context data. Through a step-by-step rotary position embedding (RoPE) scaling training strategy, we demonstrate that our model, with a context length of up to 1M tokens, performs well on the RULER benchmark and InfiniteBench and maintains robust performance on general language tasks.
