Abstract
Recent advancements in large language models (LLMs) with extended context windows have significantly improved tasks such as information extraction, question answering, and complex planning scenarios. In order to achieve success in long context tasks, a large amount of work has been done to enhance the long context capabilities of the model through synthetic data. Existing methods typically utilize the Self-Instruct framework to generate instruction tuning data for better long context capability improvement. However, our preliminary experiments indicate that less than 35% of generated samples are multi-hop, and more than 40% exhibit poor quality, limiting comprehensive understanding and further research. To improve the quality of synthetic data, we propose the Multi-agent Interactive Multi-hop Generation (MIMG) framework, incorporating a Quality Verification Agent, a Single-hop Question Generation Agent, a Multiple Question Sampling Strategy, and a Multi-hop Question Merger Agent. This framework improves the data quality, with the proportion of high-quality, multi-hop, and diverse data exceeding 85%. Furthermore, we systematically investigate strategies for document selection, question merging, and validation techniques through extensive experiments across various models. Our findings show that our synthetic high-quality long-context instruction data significantly enhances model performance, even surpassing models trained on larger amounts of human-annotated data.
Introduction
While modern Large Language Models (LLMs) boast massive context windows—often reaching 128k tokens or more—simply expanding the window does not guarantee effective utilization. To truly master long documents, models require instruction tuning (IT) on data that demands multi-hop reasoning: the ability to connect disparate pieces of information scattered across a text to answer complex queries.
The current bottleneck in this field is data quality. Human annotation for long contexts is prohibitively expensive, and existing synthetic methods, such as the popular Self-Instruct framework, often produce "single-hop" questions that are too simplistic. Preliminary analysis shows that fewer than 35% of samples generated by standard methods are multi-hop, and over 40% are of poor quality, leading to model distraction rather than improved reasoning. To address this, we introduce the Multi-agent Interactive Multi-hop Generation (MIMG) framework.
The MIMG Framework
The MIMG framework decomposes the complex task of multi-hop data generation into a structured pipeline managed by four specialized agents. This modular approach ensures that each component of a complex reasoning task is handled with high precision.
- Quality Verification Agent (QVA): Rather than a binary "pass/fail" check, this agent employs a scoring strategy (rating samples from 1-10). Research indicates that LLMs are significantly more effective at ranking quality on a continuous scale than performing binary classification in long-context scenarios.
- Single-hop Question Generation Agent (SQGA): This agent generates foundational questions and answers from individual document segments. A critical finding was that generating the question before the answer leads to higher-quality grounding than simultaneous generation.
- Multiple Question Sampling (MQS): This stage utilizes semantic relevance (via embeddings like BGE) to select related single-hop questions from different parts of a document or across multiple documents.
- Multi-hop Question Merger Agent (MQMA): The final agent synthesizes the related single-hop questions into a single, complex multi-hop query that necessitates the integration of all previously identified facts.
Key Insights and Experimental Results
Through the development of the LongMIT dataset—which contains 64.4k samples and approximately 5.07 billion tokens across nine domains—several key insights emerged:
- Scoring vs. Classification: In long contexts, LLMs often suffer from "judgment bias," frequently labeling mediocre samples as "high quality." Forcing the model to provide a numerical score provides a more nuanced and accurate filter for the final dataset.
- LLMs as Selectors: While LLMs may show low agreement with humans when creating ground truth from scratch (low Kappa scores), they exhibit near-perfect precision in identifying high-quality samples. This makes them ideal filters for synthetic pipelines.
- The Multi-hop Correlation: Models trained on multi-hop data showed a clear positive correlation between the number of "hops" in the training data and their eventual accuracy on complex benchmarks like LongBench and Ruler.
Performance Gains
Models fine-tuned on LongMIT achieved an average performance gain of 7.54% across various benchmarks. Remarkably, models enhanced with this synthetic data outperformed those trained on the much larger, human-annotated Natural Questions (NQ) dataset. Furthermore, the MIMG framework proved efficient; using open-source backbones like Qwen-2-72B achieved data quality comparable to GPT-4o-based methods but at one-third of the token cost.
Conclusion
The MIMG framework represents a significant step forward in synthesizing high-quality instruction-tuning data for long-context LLMs. By shifting from simple self-instruction to a multi-agent interactive pipeline, we can produce datasets that push the boundaries of model reasoning. Future work will explore applying this framework to even more specialized domains, such as long-form code generation and complex mathematical theorem proving, where multi-step logic is paramount.
Summary updated