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

## Abstract

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. Our code is available at: https://github.com/WowCZ/LongMIT .

## 1 Introduction

Recently, large language models (LLMs) with long context windows have significantly improved tasks such as information extraction, question answering, and even complex planning scenarios (Liu et al., ; Bai et al., ; Hu et al., ; ; Xu et al., ). Research on developing long-context LLMs has predominantly focused on extending the context window (Ding et al., ; Jin et al., ; Peng et al., ). Nevertheless, in practical applications, simply expanding the context window proves inadequate (Hsieh et al., ; Huang, ). There is a pressing need for training to optimize utilization of long context (Zhang et al., ), especially in instruction tuning (Fu et al., ).

In the instruction tuning phase, a large amount of high-quality long context instruction data is required. However, high-quality long-context instruction data is extremely difficult to obtain, and the annotation cost is extremely high compared to short-context data (Bai et al., ; Xiong et al., ). Therefore, Xiong et al. () and Bai et al. () have begun to explore the use of LLM to generate instruction tuning data through the Self-Instruct framework (Wang et al., ), which addresses the issue of long-context instruction tuning data scarcity.

Figure: Figure 1: Comparison between traditional self-instruct-based data synthesis method and our Multi-agent Interactive Multi-hop Generation (MIMG) data synthesis framework.
Refer to caption: x1.png

Despite addressing data scarcity, existing works still struggle to synthesize high-quality multi-hop instruction tuning data.
This gap arises from inadequate focus on the synthesis process and the factors that affect data effectiveness. As shown in Figure 1, our preliminary manual annotation experiments reveal that direct self-instruction generates less than 35% of multi-hop samples, with high-quality samples accounting for only around 60%. Moreover, sample diversity is concerning, with more than 45% of samples with semantic duplication and lack of diversity. These limitations hinder a comprehensive understanding of the mechanisms and impede further research in this field.

Motivated by these challenges, this paper systematically investigates the research question: What are the essential factors in crafting effective long-context multi-hop instruction datasets?
To address this, we propose a Multi-agent Interactive Multi-hop Generation (MIMG) framework.
First, to enhance the quality of long-context instruction data, we introduce a novel Quality Verification Agent, which prompts LLMs to automatically verify the quality of generated samples.
Second, to incorporate multi-hop reasoning, we develop a Single-hop Question Generation Agent, followed by a Multi-hop Question Merging Agent for stepwise synthesis of multi-hop problems.
Finally, to ensure diversity, we implement multiple question sampling strategies within the Single-hop Question Generation Agent to minimize repetition and promote variety in the multi-hop questions.
As shown in Figure 1, our method significantly improves data quality, with over 85% of the data being multi-hop, high-quality, and non-duplicative.

To understand the best practices for crafting long-context instruction data, we systematically investigate several sub-questions, including strategies for document selection, the impact of different question merging approaches, and the effectiveness of various validation techniques. We conduct extensive experiments using 17 strategies across 10 domains and 5 models. Our findings show that the proposed methods significantly enhance data quality and improve the performance of long-context understanding models. Moreover, models trained on our synthetic high-quality long-text instruction data can achieve at least 7.54% on average improvement, which even surpasses the performance of models trained on a larger volume of human-annotated data.

The main contributions of our work are as follows:

- •
An Extensive Exploration of Best Practices: Our study examines a series of strategies for generating high-quality multi-hop instruction data, identifying key factors and best practices that impact long-context data quality.
- •
A Novel Data Synthesis Framework: We introduce a Multi-Agent Interactive Multi-hop Generation (MIMG) framework to synthesize multi-hop instruction data, enhancing data quality.
- •
A Large Long-Context Instruction Dataset for Effectively Enhanced Long-Context Utilization: Our synthetic dataset (LongMIT) proves effective across numerous models, outperforming even larger human-labeled instruction datasets.

Figure: Figure 2: The overall process of our Multi-agent Interactive Multi-hop Generation (MIMG) data synthesis framework.
Refer to caption: x2.png

## 2 Framework

Our proposed framework consists of four main components: Quality Verification Agent ($\S$ 2.1), Single-hop Question Generation Agent ($\S$ 2.2), Multiple Question Sampling ($\S$ 2.3), and Multi-hop Question Merging Agent ($\S$ 2.4).
Specifically, each component is meticulously designed to contribute to the generation of high-quality multi-hop questions and answers from given documents. First, the Quality Verification Agent ensures the data quality generated by other agents. The Single-hop Question Generation Agent then creates initial single-hop questions, focusing on simple, direct inquiries. Next, Multiple Question Sampling strategies expand on this by sampling questions that cover various aspects of the document, enhancing multi-hop instruction generation. Finally, the Multi-hop Question Merging Agent integrates these single-hop questions into coherent multi-hop questions, requiring information synthesis from multiple document parts, ensuring deeper understanding and engagement. The detailed architecture is illustrated in Figure 2.

### 2.1 Quality Verification Agent

The first module in our framework is Quality Verification Agent, which ensures that the generated questions and answers meet a certain standard of quality. This component involves two main processes:

##### Verification Strategy:

This includes additional heuristic strategies to judge which samples should be contained as high-quality data.
Specifically, we utilize two wide-used verification strategies:

- •
Scoring: We prompt LLMs to generate continuous scores, manually set a more reliable threshold score based on the validation set, and set those exceeding the threshold score as high-quality data. Formally, given a sample $s$, we select the high-quality data as follows:
$\mathcal{V}(s|\mathcal{M})=\begin{cases}\texttt{Approved}&\texttt{Score}(s|
\mathcal{M})>\theta;\\
\texttt{Rejected}&\texttt{Score}(s|\mathcal{M})\leq\theta,\end{cases}$
(1)
where $\texttt{Score}(s|\mathcal{M})$ represents the model score of sample $s$ based on model $\mathcal{M}$, and $\theta$ is the threshold.
- •
Classification: We prompt LLMs to generate binary classification and select those classified as high-quality data. Formally, given a sample $s$, we select the high-quality data as follows:
$\mathcal{V}(s|\mathcal{M})=\begin{cases}\texttt{Approved}&\texttt{Class}(s|
\mathcal{M})=1;\\
\texttt{Rejected}&\texttt{Class}(s|\mathcal{M})=0,\end{cases}$
(2)
where $\texttt{Class}(s|\mathcal{M})$ represents the binary classification process of sample $s$.

##### Verification Condition:

This involves setting specific conditions $\mathcal{C}$ that both questions and answers must meet to be considered high-quality verification ($\mathcal{V}(s|\mathcal{M},\mathcal{C})$). The process includes:

- •
Criteria Perspectives: Criteria include relevance to the document, clarity, factual accuracy, logical coherence, and complexity of the question and answer. Formally, these perspectives can be formulated as:
$\mathcal{C}=\{c_{1},\dots,c_{n}\},$
(3)
where $c_{i}$ denotes the $i$-th criteria instruction. $n$ denotes the number of criteria perspectives.
- •
Auxiliary Context Information: We integrate additional contextual instructions to enhance the model’s accuracy and robustness, like guidelines. These conditions are formally represented as:
$\mathcal{C}=\{c_{1},\dots,c_{n}\}\oplus\texttt{Context},$
(4)
where the Context denotes the context including auxiliary guidelines.
- •
Auxiliary Generation Information: We enable the model to provide more reasoning rationale during output generation and observe whether this improves the robustness and accuracy of the verification process.
$\mathcal{C}=\{c_{1},\dots,c_{n}\}\oplus I_{R},$
(5)
where the $I_{R}$ denotes the instruction that can prompt LLM to generate rationales.

### 2.2 Single-hop Question Generation Agent

This phase generates single-hop questions and answers from individual documents, encompassing the following components:

##### Generation Backbone:

This component utilizes a robust LLM to generate valid and relevant single-hop questions and answers from each document. Multiple questions and answers are produced per document to ensure a diverse foundation for multi-hop question development. We thoroughly examine various LLMs, including both open-source and close-source models, across different scales.

##### Generation Strategy:

The strategy employs a structured approach to extract potential questions from the text, using the following techniques:

- •
Rationale-based Question Generation: Chain-of-Thought (CoT) prompting (Wei et al., ) has been recognized for its role in improving performance on long-text tasks (Li et al., ). Building on this, our study investigates whether generating questions from a long document, supported by rationale, can enhance the understanding of the document’s inherent reasoning.
- •
Question-Answering Generation Order: Furthermore, we aim to evaluate whether the sequence of generating questions and answers impacts the overall effectiveness. Specifically, generating the question prior to the answer may reduce the reasoning complexity and improve the quality of the model’s output compared to a simultaneous generation approach.

### 2.3 Multiple Question Sampling

In order to further optimize the diversity of generated samples, we introduce
Multiple Question Sampling strategy to create multi-hop questions by sampling and combining questions from multiple questions and documents. It mainly involves the following two strategies:

##### Retrieval Strategy:

This strategy identifies relevant questions and documents for multi-hop question creation. Using relevance sampling, a question semantic relevance matrix is generated, assessing the semantic connections between questions across different documents and guiding the sampling process. The strategy includes:

- •
Probability-Based Sampling: This method evaluates document relevance based on the probability and occurrence of specific keywords related to the questions, like BM25 (Robertson et al., ; ), and LDA (Hoffman et al., ).
- •
Semantic-Based Sampling: This approach assesses the relevance by analyzing the semantic similarity between questions and documents, like embedding similarity.

##### Sampling Strategy:

Based on the relevance matrix, the most related questions are selected for merging. This involves choosing questions that are both relevant and complementary, ensuring that the resulting multi-hop questions are coherent and contextually rich. The strategy includes:

- •
Intra-Document Sampling: This strategy focuses on selecting questions within the same document to ensure internal coherent multi-hop data.
- •
Inter-Document Sampling: This strategy involves selecting questions from different documents to ensure a broader contextual coverage.

### 2.4 Multi-hop Question Merging Agent

The final step merges sampled questions into coherent multi-hop questions, involving two modules:

##### Merging Backbone:

We utilize LLM to combine the sampled questions and answers into meaningful multi-hop questions and answers. The model leverages context and semantic understanding to ensure that the merged questions are logically consistent and contextually accurate. The backbone includes 5 classic LLMs.

##### Merging Strategy:

This includes rules and heuristics to ensure the merged questions are logically consistent and contextually accurate. The strategy includes:

- •
Document-Based Merging: To further reduce input tokens, we explore whether long documents need to be added to large model inputs to enhance merging performance. Formally, the merging process can be represented as:
${Q_{m}}=\mathcal{M}(Q_{1},Q_{2},\ldots,Q_{n}|C).$
(6)
where $Q_{1},Q_{2},\ldots,Q_{n}$ are the sampled single-hop questions, and $Q_{m}$ represents the merged multi-hop question. $C$ denotes context whether utilize document.
- •
Rationale-Based Merging: This method leverages the underlying rationale or reasoning behind the original questions to guide their integration, ensuring that the combined question preserves the intended meaning and context of the individual components. Formally, this merging process can be expressed as:
$R\oplus{Q_{m}}=\mathcal{M}(Q_{1},Q_{2},\ldots,Q_{n}).$
(7)
where $R$ represents the rationale or underlying reasoning, and $\oplus$ denotes the connector vocabulary in generated response.

Furthermore, we explore the creation of both intra-document and inter-document multi-hop instruction samples for different scenarios.

## 3 Exploration

### 3.1 Quality Verification Agent

#### 3.1.1 Verification Strategy

Currently, the most widely employed strategies for model verification are scoring and direct classification. We evaluated the consistency and precision of both approaches by comparing them with human annotations in the sample analysis of data generated from long contexts.

Figure: Figure 3: The analysis of different verification strategies in quality verification, where includes 5 models: Qwen2-72B-Instruct (Yang et al., ); InternLM2-20B (Cai et al., ); Gemini-1.5-Pro (Reid et al., ); GPT-4o-mini and GPT-4o (Achiam et al., ).
Refer to caption: x3.png

##### Scoring is a Better Verification Strategy Compared with Classification.

As shown in Figure 3 (a), the scoring strategy shows significantly higher kappa and precision scores compared to binary quality classification. This statistical improvement suggests that scoring better captures the nuances of human judgments. This observation aligns with findings in short-context scenarios (Fu et al., ), reinforcing the generalizability of scoring strategies across different lengths of textual data.

##### LLM is not a long-context annotator but a good selector.

As depicted in Figure 3 (a),
in contrast to their performance in short-context verification (Wang et al., ; Fu et al., ), LLMs demonstrate minimal agreement with human annotators in long-context scenarios, reflected in low kappa scores. This suggests challenges in maintaining annotation consistency due to the cognitive load and interpretative variations over extensive information. Despite this, as demonstrated in Figure 3 (b), LLMs consistently achieve nearly perfect precision, indicating robust capability in identifying and selecting relevant data. This distinction underscores the potential of LLMs as effective tools for data filtering and prioritization in long-context environments, contrasting their role as accurate annotators in short-context scenarios.

Figure: Figure 4: Performance of different models for generating single-hop questions.
Refer to caption: x4.png

##### Scoring can alleviate the long context bias but classification not.

Additionally, we examine why classification strategies underperform in long contexts by assessing verifier precision across varying context lengths. As depicted in Figure 4, the scoring strategy demonstrates superior precision and greater robustness in extended contexts, explaining the poor performance of classification in these verification scenarios.

Based on the conclusions drawn from our prior analyses, the subsequent experiments will be conducted within the framework of the Scoring strategy. The precision of the verifier will serve as the metric for evaluating its quality, while the quality of the data will be assessed by examining the data retention ratio.

#### 3.1.2 Verification Conditions

To deeply understand what factors affect the verification of long text data quality, we further explored from three perspectives: scoring perspective, guidelines, and whether rationale is included for scoring.

##### More scoring perspectives reduce long-context bias.

As illustrated in Figure 5 (a),
incorporating more scoring perspectives significantly enhances the accuracy and robustness of filtering long-context data. Unlike short contexts, long contexts introduce noticeable bias in judgments. When fewer than 3 perspectives are used, performance gains are minimal, and the model often overestimates irrelevant samples, leading to poor selection results.
However, increasing the number of perspectives markedly improves labeling accuracy, effectively mitigating biases associated with longer contexts. See Appendix A.2.2 for more details.

##### Effective verifiers adhere to annotation standards aligned with human judgment.

To assess whether incorporating additional scoring criteria enhances the model’s verification performance, we specify the criteria for each score in detail. As illustrated in Figure 5 (b), interestingly, the guideline does not include supplementary information during the annotation process for advanced models. This observation suggests that effective verifiers inherently follow annotation standards that well align with human judgment.

Figure: Figure 5: The analysis of different verification conditions on quality verification.
Refer to caption: x5.png

##### Incorporating rationale enhances robustness in diverse long contexts.

Our methodology necessitates extension across numerous domains, emphasizing the criticality of robustness across diverse domains. Contextualizing the role of CoT (Wei et al., ; Qin et al., ), we evaluate model performance across various domains, specifically in wiki-like knowledge and paper analysis domains. As illustrated in Figure 5 (c), incorporating rationale enables the model to maintain high performance across diverse contexts. Without rationale, performance decreases by more than 8.6% when confronted with different domains. Conversely, adding rationale during validation results in minimal performance variation, with fluctuations in precision limited to 1.8% at most.

### 3.2 Single-hop Question Generation Agent

#### 3.2.1 Generation Backbone

In practice, effective models must be capable of synthesizing high-quality data. To this end, we explored the suitability of several commonly used LLMs for single-hop data synthesis.

Figure: Figure 6: Performance of different models for generating single-hop questions.
Refer to caption: x6.png

##### Open-source LLMs effectively generate single-hop questions.

As shown in Figure 6, smaller open-source LLMs demonstrate high retention rates with cost-efficientiveness, reflecting their capability to understand and generate single-hop questions from a given context.

##### Stronger LLMs can generate better single-hop question generation but higher cost.

As shown in Figure 6, more advanced LLMs increase data retention and enhance the quality of generated questions. However, these improvements are not cost-proportional, raising concerns about the economic viability of employing stronger models for single-hop question generation.

Figure: Figure 7: The analysis of generation strategies in single-hop question generation agent.
Refer to caption: x7.png

#### 3.2.2 Generation Strategy

Furthermore, we explore whether employing a question-then-answering approach, supplemented by rationale, enhances the quality of synthetic single-hop questions.

##### Question-then-answering works better than generating data from scratch.

To assess whether a single or multiple stage of generation is more effective, we compare two sample generation strategies: unified question-answer and question-then-answer generation. As shown in Figure 7 (a), generating the question before the answer substantially enhances data quality. It improves both the retention rate and the data quality score, especially open-sourced LLMs, confirming its superiority. For more implementation details, see Appendix A.2.3.

##### Generating with rationale can improve the generated quality but much higher token cost.

As illustrated in Figure 7 (b), adding rationale makes questions more relevant and insightful with higher quality. However, the improvement brought by the rationale is minimal, while the token consumption triples, making it economically inefficient.

Figure: Figure 8: The analysis of multiple question sampling.
Refer to caption: x8.png

### 3.3 Multiple Question Sampling

#### 3.3.1 Retrival Strategy

This strategy involves identifying relevant documents and constructing a semantic relevance matrix to guide sampling based on both keyword and semantic scoring of documents and questions. Observations on these strategies include:

##### Embedding similarity is critical for multi-question sampling.

We assess the effectiveness of various similarity measures by examining three metrics: embedding similarity (using BGE embeddings (Xiao et al., )), BM25, and LDA. As shown in Figure 8 (a), BGE embeddings enable the model to select more relevant questions, enhancing sample quality.

##### Question similarity outweighs document similarity.

We also explore which aspects most influence sample quality. Figure 8 (b) demonstrates that question-based sampling significantly outperforms document-based strategies, as questions provide more contextual relevance.

#### 3.3.2 Sampling Strategy

Figure: Figure 9: Performance Comparison of multiple question sampling based on different sampling strategies.
Refer to caption: x9.png

It selects semantically related and complementary questions from within and across documents to form coherent and contextually rich multi-hop questions.

##### Intra-Document generates better quality but less diversity.

As shown in Figure 9, sampling questions within the same document results in more coherent and contextually aligned questions. However, this method may limit question diversity since they all stem from the same source.

##### Inter-Document generates less quality but more diversity.

As shown in Figure 9, sampling questions from multiple documents introduces a broader range of topics and contexts, enhancing diversity. However, this increased diversity can reduce the coherence and relevance of questions due to larger topic gaps.

Figure: Figure 10: Performance of different models for merging multi-hop questions.
Refer to caption: x10.png

### 3.4 Multi-hop Question Merging Agent

#### 3.4.1 Merging Backbone

We use LLM to merge sampled questions and answers into meaningful multi-hop versions, ensuring logical consistency and contextual accuracy with the help of 5 classic LLMs. The observations are as follows:

##### Open-sourced LLMs can well merge multi-hop question generation.

As shown in Figure 10, all models are greatly capable of handling complex question generation tasks that require multiple steps of reasoning or integration of information.

Figure: Figure 11: The analysis of multi-hop question merging agent.
Refer to caption: x11.png

Figure: Figure 12: Main accuracy results by evaluation by GPT-4o, where all benchmarks comes from the LongBench (Bai et al., ).

#### 3.4.2 Merging Strategy

##### Question-answer pairs are enough for multi-hop instruction merging.

To minimize input tokens, we assess if long documents are necessary for enhancing merging performance. Figure 11 (a) shows that adding documents often fails to consistently improve performance and instead increases input tokens. Thus, simple question-answer pairs effectively achieve multi-hop merging.

##### Merging with rationale can not improve the merging quality.

Generally, generating content with rationales can enhance its quality (Qin et al., ; ). However, as depicted in Figure 11 (b), unlike single-hop generation, rationales in a multi-hop generation do not aid in forming coherent and logical questions. Our quantitative analysis further reveals that large models often misinterpret rationales within queries and merging strategies, leading to frequent CoT failures. Thus, multi-hop synthesis should avoid using additional rationales.

## 4 Data Utilization

### 4.1 Instruction Dataset Construction

To expand the domain coverage and handle longer contexts, we extended the instruction fine-tuning data across 9 domains and 2 languages. All base documents were sourced from pre-trained datasets to prevent data leakage. Our Long Multi-hop Instruction-Tuning dataset (LongMIT) results in a retention rate of over 90% in GPT-4o verification in 200 sampled samples, confirming the high quality and generalizability of our pipeline. To balance the cost and effectiveness of generating data, LongMIT are generated based on Qwen2-72B-Instruct, and verified based on InternLM2-20B. See Appendix A for more details.

### 4.2 Data Synthesis Efficiency

Figure: Figure 13: Comparison of the quality and token consumption on different generation strategies.
Refer to caption: x12.png

Given the high cost of data generation, we consider both cost and data quality when synthesizing LongMIT. To assess the effectiveness of this balance, we compare the proportion of high-quality data and the token cost for 200 samples generated under different strategies. As shown in Figure 13, strategies with open-source models achieve a high-quality proportion even comparable to the highest quality strategies with GPT4o, but at only one-third of the token cost. Furthermore, our approach significantly enhances data quality with minimal additional token expense compared to traditional methods. For more implementation details, see Appendix B.

### 4.3 Previous Instruction Dataset

(1) ChatQA (Liu et al., ) uses manually annotated long text instruction-following data.
(2) LongAlign (Bai et al., ) leverages Claude’s generative abilities to create 10K QA pairs for training.
(3) LongAlpaca (Chen et al., ) integrates a large amount of paper QA corpus with additional short instruction-following examples.
(4) NQ (Kwiatkowski et al., ) is a human-annotated long-context data with a series of natural questions.

### 4.4 The Results of Instruction-Tuning

Based on a substantial volume of synthesized data, we conduct instruction-tuning to further assess its utility.
As shown in Table 12, our synthesized data significantly enhances the long-context QA capabilities of various LLMs, achieving an average improvement of at least 7.54% on average. Notably, multi-hop benchmarks like 2WikiMQA (Ho et al., ), MuSiQue (Trivedi et al., ), and HotpotQA (Yang et al., ) show more pronounced improvements. Moreover, as shown in the case study in Appendix D, the logically complex and high-quality nature of this data enables the model to generalize to single-hop QA tasks not encountered during the instruction tuning phase, further confirming the reliability of our synthetic data. Detailed procedures are available in Appendix C.

### 4.5 Scaling Analysis

##### Data Scaling Analysis

To evaluate how the size of high-quality data affects model performance, we experiment on LLaMA3-8B (Dubey et al., ) by varying the training data volume. The results, depicted in Figure 15, illustrate a clear relationship between the amount of data and the performance. As the dataset size increases, model performance adjusts accordingly, demonstrating the significance of high-quality data scaling in enhancing the model efficacy.

##### Hop Scaling Analysis

To assess the impact of multi-hop data on model performance, we increased the number of hops in the dataset while keeping the training data volume constant. This approach isolated the effect of multi-hop reasoning on model outcomes. As indicated in Figure 16, there is a clear positive correlation between the number of hops and model performance. The data demonstrate that with more hops, the model achieves higher accuracy and robustness. These results demonstrate the effectiveness of using high-quality multi-hop data to enhance the model’s capability for complex reasoning tasks.

## 5 Related Work

Recent efforts have aimed to enhance the performance of LLMs in handling longer contexts. LongLLaMA (Xiong et al., ) demonstrates the impact of incorporating long text data during various pre-training stages. LLaMA2-80K (Fu et al., ) highlights the significance of using a domain-balanced, upsampled long text corpus to improve long text capabilities, requiring only a 5B-token corpus for effective comprehension. ICLM (Shi et al., ) enhances long-text reasoning by transforming pre-training data into knowledge graphs and splicing adjacent documents.
To improve the model’s ability to follow long text instructions, LongAlpaca (Chen et al., ) combines a 9K paper question-answering (QA) corpus with 3K short instruction samples. In contrast, LongAlign (Bai et al., ) utilizes Claude (Anthropic, ) to produce 10K QA pairs for training. Additionally, ChatQA (Liu et al., ) enhances long-context QA performance by incorporating manually annotated data. Building on these approaches, ChatQA2 (Xu et al., ) further incorporate existing long-text datasets, such as Natural Questions (NQ) (Kwiatkowski et al., ).

The method closest dataset is Quest (Gao et al., ), which constructs QA pairs from document data and splices documents based on QA pair correlations, resulting in a close-sourced single-hop QA corpus. In contrast, our approach models document correlations first, then create multi-hop QA pairs using related intra-document data. Additionally, we offer systematic analysis, open-source datasets, and significantly improved models.

## 6 Conclusion

In conclusion, our proposed Multi-agent Interactive Multi-hop Generation (MIMG) framework, which includes a quality verification agent, a single-hop question generation agent, a multiple question sampling strategy, and a multi-hop question merger agent, achieves high-quality, diverse instruction data. Our experiments show that this synthetic data notably enhances performance, even surpassing models trained on larger human-annotated data, highlighting the effectiveness of our approaches.

## Appendix

## Appendix A Data Construction Details

The construction of long-text multi-hop question-and-answer datasets is based on a structured approach leveraging pre-trained document corpora. This section outlines the methodology used for data collection, processing, and validation across multiple domains and languages.

### A.1 Source Data Overview

The primary source of long-text data is a pre-trained document corpus that spans nine distinct domains. The corpus includes data from both Chinese and English sources, ensuring a comprehensive multilingual dataset. The domains covered are:

- •
Books (eBooks): A collection of various eBook formats that provide diverse literary content.
Academic Papers: Scholarly articles sourced from repositories such as arXiv and CNKI. These datasets reflect cutting-edge research across multiple disciplines.
- •
Finance: Data from financial documents and discussions, including the ChatGLM-fin dataset, which encompasses various financial reports and conversational data related to financial analysis.
- •
Knowledge: Information extracted from online encyclopedic sources, including Baike-Wiki and Pile-Wikipedia, covering a broad range of general knowledge.
- •
Science: Data from reputable scientific sources, including Kepuchina and ScienceDaily, that focus on advancements in various scientific fields.
- •
Law: Legal documents and case law from the Pile-Freelaw dataset, providing insight into legal precedents and interpretations.
- •
Medicine: Medical literature, including publications from Pile-PubMed Central, which includes peer-reviewed medical research and case studies.
- •
Technology: Content derived from technical discussions and knowledge-sharing platforms such as Pile-StackExchange.
- •
Web Resources: Web data extracted from open-source platforms, specifically the Pile-OpenWebText2 dataset, reflecting general web-based information.

Each domain was selected to ensure the inclusion of diverse, domain-specific content that could support the generation of robust and accurate multi-hop question-and-answer sequences. A more fine-grained analysis can be seen in Figure 14 (a).

Additionally, inspired by Kim et al. () and Chen et al. (), CoT has the ability to bring powerful performance improvements to the instruction tuning. What’s more, as shown in Figure 18, after adding CoT, the performance of the model has indeed improved. Therefore, in all our data synthesis processes, the answer contains a reasoning path.
Furthermore, since LLMs often cannot fit all the document information that is extremely long documents, we perform truncation segmentation on the documents input to the model. After generating the sample, refill the document with other documents to a fixed length.

### A.2 Multi-hop Question and Answer Data Construction

The construction of multi-hop question-and-answer datasets involved a rigorous process to ensure both linguistic accuracy and domain relevance. The methodology is as follows:

#### A.2.1 Dataset Curation

For each domain, data was independently curated to maintain a clear distinction between different knowledge sources. This allows for more focused and accurate multi-hop questions that are relevant to the particular field of study.

#### A.2.2 Quality Verification Agent

The first module in our framework is Quality Verification Agent, which ensures that the generated questions and answers meet a certain standard of quality. We use InternLM2-20B (Cai et al., ) as backbone and set the quality score threshold to 8.5. Moreover, the prompt are as follows:

#### A.2.3 Single-hop Question Generation Agent

The Single-hop Question Generation Agent is responsible for generating fundamental single-hop questions, which are characterized by their simplicity and directness.

In this framework, we employ Qwen2-72B-Instruct (Yang et al., ) as the foundational model, utilizing it to synthesize data through a question-answering paradigm. The process begins with the generation of prompts designed specifically for question creation, initiating a structured approach to the formulation of these queries.

Based on the questions extracted, the prompt of answer generation is as follows:

#### A.2.4 Multiple Question Sampling

This strategy further enhances the generation of multi-hop instructions by selecting questions that address diverse elements within the document. This method facilitates the creation of comprehensive, multi-hop, long-text question-answer datasets that are meticulously customized to reflect the characteristics and requirements of specific domain data sources.
The organization of the relevant documents begins by embedding them into vectors, where BGE-zh-1.5 and BGE-en-1.5 (Xiao et al., ) models are used to map the documents into 768-dimensional vectors. Following the methods inspired by Shi et al. (), the document vectors are embedded using Faiss to facilitate storage and efficient retrieval. This process relies on measuring vector distances to retrieve the 10 nearest documents for each document, creating a document graph.

Subsequently, a circular search strategy is employed to generate paths that consist of multiple documents, with the maximum path length constrained to 20. This process continues until all documents are sampled, with these paths serving as the initial sets of multiple related documents.

After conducting a sampling analysis, we observed the hop distribution in the constructed data, as illustrated in Figure 14 (b). Additionally, the distribution corresponding to the sampling strategy is depicted in Figure 14 (c).

#### A.2.5 Multi-hop Question Merging Agent

Multi-hop questions are designed to require reasoning across multiple data points, either within a single domain or spanning different domains. This approach ensures that responses cannot be derived from isolated facts; rather, they necessitate a more profound comprehension and integration of the dataset’s overall content.

To achieve this, the Multi-hop Question Merging Agent consolidates single-hop questions into well-structured multi-hop queries. This process demands information synthesis from various sections of the document, promoting a deeper level of understanding and engagement. For the model architecture, we employ Qwen2-72B-Instruct (Yang et al., ) as the base model. The specific prompt for merging two QA pairs is as follows:

Figure: Figure 15: Analysis of the impact of different training dataset size on the average accuracy score.
Refer to caption: x14.png

## Appendix B Highest Quality Strategies Details

To achieve the highest quality data, we deliberately prioritize the use of GPT-4o as the backbone for all processes, fully disregarding cost constraints. This decision is driven by the understanding that ensuring the best data quality is paramount for the success of our project. Furthermore, to maintain and enhance performance during the exploration phase, we implement a comprehensive range of strategies aimed at maximizing the data retention rate.

Specifically, for the Quality Verification Agent, we employ a multi-faceted approach that includes more-perspectives scoring mechanisms, the addition of rationales, the integration of multiple perspectives, and the application of detailed guidelines.
For the Single-hop Question Generation Agent, we have adopted a question-then-answer strategy. This approach is complemented by the incorporation of rationales, which provide context and justification for each query generated.
Additionally, we require LLMs to generate only one question per query, which is intended to reduce the logical burden on the model, thereby improving the coherence and relevance of the questions produced.
In the case of Multiple Question Sampling, we utilize BGE embeddings for the retrieval of questions. This technique is applied both within individual documents (intra-document) and across multiple documents (inter-document).
Finally, for the Multi-hop Question Merging Agent, we employ a strategy that involves merging questions and answers using document references. This method ensures that the merged questions and answers are contextually aligned and coherent. Notably, we have opted to remove the rationale for merging in this process, as we found that it adds unnecessary complexity without significantly improving the quality of the merged content.

## Appendix C Instruction Tuning Experiments Details

### C.1 Training Details

All models were trained using 64 A800*80G GPUs with the DeepSpeed+ZeRO-1 framework. The maximum sequence length was set to 32K, with any sequences exceeding this length truncated from the right. The training process utilized the Adam optimizer with a learning rate of $3\times 10^{-5}$, $\beta_{1}=0.9$, and $\beta_{2}=0.95$.

To enhance training efficiency, we employed a packing strategy that concatenates training samples to reach the maximum sequence length. Additionally, Flash Attention (Dao et al., ; Dao, ) is used to accelerate the computation of the attention mechanism. The global batch size consisted of 4 million tokens, and the entire dataset is trained over one epoch.

### C.2 Evaluation Details

Based on the methodology proposed by Bai et al. (), evaluating Token F1 using a model optimized through Chain of Thought (CoT) (Wei et al., ) reasoning proves to be challenging. To address this limitation, we employ GPT-4 as a consistency evaluator. Our testing demonstrates that the error rate of GPT-4 in this role remains consistently low, with deviations falling within a 2% margin. The corresponding prompt used is outlined below:

Figure: Figure 17: The case study of whether utilize reasoning process for instruction tuning.
Refer to caption: x16.png

Figure: Figure 18: The case study of the effectiveness of LongMIT.
Refer to caption: x17.png

## Appendix D Case study

To gain a more nuanced and intuitive qualitative understanding of our model’s performance, we conducted a detailed case study, resulting in two significant findings:

- •
Impact of Instruction Quality: As illustrated in Figure 18, models trained with high-quality multi-hop instruction data, specifically the LongMIT dataset, exhibit enhanced logical reasoning capabilities. These models are better equipped to process and analyze extensive textual information, enabling them to derive more accurate and reliable reasoning. In contrast, models trained using traditional, lower-quality instruction data, such as LongAlign Bai et al. (), demonstrate a reduced capacity for logical reasoning. This comparison underscores the importance of the quality of training data in developing models that can effectively handle complex reasoning tasks, especially when dealing with long and intricate texts.
- •
Role of Rationale Incorporation in Training: Furthermore, as depicted in Figure 17, our analysis reveals that the inclusion of additional rationales during the training process significantly enhances the model’s ability to focus on relevant information within long texts and make precise inferences. This finding is particularly evident when comparing models that underwent Chain-of-Thought (CoT) Wei et al. () training with those that did not. Specifically, models that lacked CoT training tend to falter during inference, often generating erroneous outputs, such as the completely incorrect answer ”1976”. On the other hand, models that were fine-tuned with CoT training not only demonstrate a coherent logical reasoning process but also consistently arrive at the correct answer, ”1065”. This result highlights the critical role of rationale-based training in improving the model’s reasoning accuracy and its ability to tackle complex inferential challenges.

## Peer Reviews

confidence: 4
contribution: 2
initial_rating: 5
presentation: 3
questions: 1. The evaluation criteria for the data need further clarification, especially for metrics like Diversity.
2. In the experimental comparisons within the Data Utilization section, I am a bit confused about the details of LongMIT’s experimental data, such as the number of samples, the number of tokens, and comparisons with other datasets.
3. Please refer to the questions mentioned in the Weaknesses.
soundness: 2
strengths: 1. The motivation of this paper is clear.
2. The exploration of methods within each agent module of the framework is thorough.
summary: This paper proposes the Multi-agent Interactive Multi-hop Generation (MIMG) framework, which incorporates a Quality Verification Agent, a Single-hop Question Generation Agent, a Multiple Question Sampling Strategy, and a Multi-hop Question Merger Agent. This framework enhances data quality, with over 85% of the data being high-quality, multi-hop, and diverse.
weaknesses: 1. The paper contains some errors; for example, Figure 10 shows only one image but is labeled (a).
2. While the authors have explored methods within each agent module of the proposed framework to enhance data generation quality, there is a lack of ablation studies between the agents, making it unclear which agent contributes the most.
3. The experiments are not sufficiently generalized, as they were only evaluated on InternLM. I believe validation on widely used models like the LLaMA series is necessary.
4. The experimental comparisons in the paper are somewhat confusing: it is unclear whether the authors aim to propose a SOTA dataset or a framework for generating data. If it is the latter, I believe comparisons with other works that generate multi-hop data using the same LLM should be included.

---

confidence: 4
contribution: 3
initial_rating: 6
presentation: 3
questions: 1. When analyzing different strategies, the author uses metrics such as retention ratio and average score. Could you provide a more detailed description and implementation method for these metrics to help readers better understand?
soundness: 3
strengths: 1. Compared to previous multi-hop data generation methods like Self-Instruct, the MIMG framework significantly enhances the proportion of multi-hop data, as well as the diversity and quality of the data.
2. The authors conduct a thorough analysis of various potentially impactful strategies, such as document selection strategies and the impact of question merging methods. This provides practical references for future research endeavors.
3. The synthesized long context dataset (LongMIT) effectively enhances long-context utilization in experiments.
summary: This paper primarily focuses on synthesizing multi-hop, high-quality instruction data. The authors propose a data generation framework that incorporates multiple components, including a quality verification agent, a single-hop question generation agent, a multiple question sampling strategy, and a multi-hop question merging agent. Through experimental analysis, the authors identify the most effective strategies for each component and combine them to produce the final synthesized long-context instruction data. The experiments demonstrate that these synthesized data can enhance model performance.
weaknesses: 1. Although the author provides a detailed analysis of the impact of different strategies on the multi-hop data ratio, quality, or diversity in various components, they do not analyze **the impact of these components on the final performance**. Specifically, the roles of the Quality Verification Agent, Single-hop Question Generation Agent, Multiple Question Sampling, and Multi-hop Question Merger Agent in the final framework are not discussed. Analyzing these would help demonstrate the independent contributions and practical necessity of each module.
2. Although the author compares the cost tokens of the proposed method in Section 4.2, Figure 12 still shows that LongMIT-GPT4o has **more than four times the cost tokens compared to Self-Instruct-GPT4o**. Considering that the method introduces multiple agents and complex merging strategies, this significantly increases the computational resources required while improving model performance, which may affect the feasibility of practical applications.

---

confidence: 3
contribution: 2
initial_rating: 5
presentation: 3
questions: 1.  Lack of Analysis on Failure Cases: There is limited discussion on the types of tasks or data where the proposed method may underperform. An analysis of failure cases or limitations in specific scenarios would provide a more balanced view of the framework's practical utility. 

2. A notable contradiction in this paper is the claim that "stronger LLMs can generate better single-hop questions" While the proposed framework aims to improve data generation quality and efficiency, the reported performance gains do not appear to match those achieved by simply using a stronger LLM. This inconsistency raises questions about the practical benefits of the proposed method, especially considering its added complexity. If a straightforward upgrade to a more powerful LLM yields comparable or superior results, the value of implementing this multi-agent framework diminishes. This aspect weakens the paper's argument for the proposed method as a more effective solution than alternative, less complex approaches.

3. To facilitate readers’ understanding of the related work in this field, it would be more effective to place the "Related Work" section immediately after the "Introduction." Currently, this section is written in a very general and unstructured manner, which makes it challenging to follow. Structuring the "Related Work" section into specific subcategories—such as "Large Language Models (LLMs)," "Multi-hop Instruction Datasets," etc.—would improve readability and provide a clearer context for the presented work.
soundness: 3
strengths: The main strengths of this paper include: 

(1). Innovative Multi-agent Generation Framework: The proposed Multi-agent Interactive Multi-hop Generation (MIMG) framework incorporates multiple agents (Quality Verification Agent, Single-hop Question Generation Agent, Multiple Question Sampling Strategy, and Multi-hop Question Merging Agent), significantly improving the quality and diversity of generated data.  

(2). Extensive Experimental Validation: The paper systematically investigates various document selection, question merging, and validation strategies, backed by experiments across multiple models and domains, demonstrating the practical effectiveness and generalizability of the framework. 

(3). Enhanced Model Performance: Models trained with MIMG-generated data show an average improvement of 7.54% over those trained with larger, human-annotated datasets, underscoring the framework’s value in boosting long-context capabilities in large language models.
summary: This paper introduces a Multi-agent Interactive Multi-hop Generation (MIMG) framework designed to enhance the quality of multi-hop instruction data for long-context tasks. The framework includes four main components: a Quality Verification Agent, a Single-hop Question Generation Agent, a Multiple Question Sampling Strategy, and a Multi-hop Question Merging Agent. Through these components, the proposed MIMG framework significantly improves the quality, diversity, and relevance of synthetic instruction data, which surpasses performance metrics achieved by models trained on larger human-annotated datasets.
weaknesses: The main limitations of this paper are: 

1). The primary weakness of this paper lies in its limited novelty. The contributions primarily emphasize engineering implementations and optimizations rather than presenting groundbreaking theoretical or methodological advancements. While the proposed framework demonstrates effective improvements in long-context, multi-hop instruction datasets, it largely builds upon existing concepts and technologies in a structured engineering fashion.  

2). Limited Analysis of Long-term Effects on Model Robustness: While the paper demonstrates improvements in performance, it lacks a detailed investigation into how the synthetic multi-hop data affects model robustness and generalizability over long-term use, particularly in non-training contexts. 

3). Potential Bias in Synthetic Data Quality Verification: The quality verification process, although effective, relies on automated scoring and classification from LLMs. This approach may introduce bias, particularly in complex, nuanced cases where human judgment could differ, impacting the interpretability and reliability of the data. 

4). Token Cost of Rationale-based Generation: While rationale-based question generation can enhance quality, the paper notes that it significantly increases token consumption, raising concerns about its efficiency and scalability in resource-constrained environments. 

5). Minimal Exploration of Alternative Frameworks: The study primarily focuses on the MIMG framework without thorough comparisons to alternative data synthesis or augmentation frameworks, limiting insights into how it performs relative to other potential approaches.

Meta-review: The paper introduces the Multi-agent Interactive Multi-hop Generation (MIMG) framework to synthesize high-quality, diverse multi-hop instruction datasets for long-context tasks. MIMG incorporates agents for quality verification, single-hop question generation, multiple question sampling, and multi-hop question merging. The framework reportedly achieves over 85% high-quality data and demonstrates improvements on selected benchmarks compared to human-annotated datasets.

While the problem is relevant, the contributions are incremental. The framework largely integrates existing methods with limited novelty, and the evaluation lacks sufficient baselines and ablation studies to isolate contributions of individual components. Key metrics, such as diversity and multi-hop performance, are poorly defined, and their impact on downstream tasks remains unclear. Additionally, the reliance on synthetic benchmarks and high token costs raises questions about scalability and generalizability.

Strengths include a structured approach to data synthesis and some empirical improvements. However, the lack of novelty, incomplete evaluations, and scalability concerns diminish the paper’s impact.

Decision: Reject