Introduction
The advent of long-context Large Language Models (LLMs) has enabled processing windows of 128k tokens or more. However, a significant gap remains between context capacity and reasoning capability. Models frequently suffer from the "lost in the middle" phenomenon and struggle with multi-hop reasoning—the necessity to link disparate information across vast contexts to answer complex queries. Traditional data generation methods, such as "Self-Instruct," often fail to produce high-quality multi-hop samples, leading to performance bottlenecks.
Addressing the Data Quality Gap
Standard Self-Instruct methods typically yield datasets where fewer than 35% of samples are truly multi-hop, and over 40% are low-quality or repetitive. While human annotation offers a solution, its cost and lack of scalability for massive document sets make it impractical for training modern long-context models.
To overcome these limitations, researchers introduced the Multi-agent Interactive Multi-hop Generation (MIMG) framework. This approach shifts from a single generator to a collaborative pipeline of specialized agents designed to maximize data diversity and reasoning complexity.
The MIMG Framework
The MIMG framework decomposes the complex task of multi-hop data generation into four distinct stages, each managed by a specialized agent:
- Quality Verification Agent (QVA): Employs a multi-criteria scoring system (relevance, logic, clarity) to filter noise. Research found that scoring (1-10) is far superior to binary classification (Yes/No) for data filtering.
- Single-hop Question Generation Agent (SQGA): Focuses on extracting foundational facts from individual document chunks.
- Multiple Question Sampling (MQS): Utilizes embedding similarity (specifically BGE embeddings) to identify semantically related questions across the context that are suitable for linking.
- Multi-hop Question Merger Agent (MQMA): Acts as the "brain" of the operation, synthesizing simple questions into complex, multi-hop queries requiring cross-source reasoning.
Datasets and Evaluation
The framework was used to create LongMIT, a comprehensive dataset comprising 64.4k samples and approximately 5.07 billion tokens. Evaluation was conducted across several benchmarks, including LongBench (NarrativeQA, 2WikiMQA, HotpotQA) and Ruler, comparing LongMIT against established baselines like LongAlpaca, LongAlign, and ChatQA2.
Key Insights and Results
The study yielded several critical findings for long-context data engineering:
- LLMs as Graders: LLMs excel at filtering high-quality information when provided with strict scoring rubrics, even if they struggle to author complex multi-hop questions from scratch.
- Question-First Strategy: Generating questions before answers leads to much higher data retention and quality than simultaneous generation.
- Rationales and Complexity: Interestingly, including rationales during the merging phase was found to decrease multi-hop data quality, suggesting that Chain-of-Thought can sometimes be a double-edged sword during data synthesis.
- Diversity through Inter-Document Sampling: Sampling across different documents provides superior "hop" complexity compared to intra-document sampling.
Performance Impact
Models fine-tuned on LongMIT demonstrated an average accuracy improvement of 7.54% across all benchmarks. On the Ruler benchmark (128k context), the InternLM2-7B model's average score jumped from 47.56 to 70.27, showcasing a massive leap in effective context utilization. Furthermore, MIMG increased the proportion of multi-hop data to 85%, a stark contrast to the 35% achieved by traditional methods. Despite the multi-agent overhead, the framework achieved these results at roughly one-third the cost of using frontier models for the entire process by utilizing open-source models for intermediate steps.
Conclusion
The MIMG framework and the resulting LongMIT dataset provide a scalable, cost-effective solution for enhancing the multi-hop reasoning capabilities of long-context LLMs. By leveraging specialized agents and optimized filtering strategies, this approach sets a new standard for synthetic data generation in the era of massive context windows.
The code and LongMIT dataset are available at https://github.com/WowCZ/LongMIT.
Summary updated