What are the Essential Factors in Crafting Effective Long Context Multi-Hop Instruction Datasets? Insights and Best Practices

Zhi Chen, Qiguang Chen, Libo Qin, Qipeng Guo, Haijun Lv, Yicheng Zou, Hang Yan, Kai Chen, Dahua Lin

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.

Comparison between Self-Instruct and the proposed Multi-agent Interactive Multi-hop Generation (MIMG) framework.

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:

  1. 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.
  2. Single-hop Question Generation Agent (SQGA): Focuses on extracting foundational facts from individual document chunks.
  3. Multiple Question Sampling (MQS): Utilizes embedding similarity (specifically BGE embeddings) to identify semantically related questions across the context that are suitable for linking.
  4. 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.
Detailed architecture of the MIMG framework, illustrating the interaction between the four specialized agents.

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

BibTeX
@inproceedings{chen2025what,
  author = {Zhi Chen and Qiguang Chen and Libo Qin and Qipeng Guo and Haijun Lv and Yicheng Zou and Hang Yan and Kai Chen and Dahua Lin},
  title = {{What are the Essential Factors in Crafting Effective Long Context Multi-Hop Instruction Datasets? Insights and Best Practices}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure