Selecting Influential Samples for Long Context Alignment via Homologous Models' Guidance and Contextual Awareness Measurement

Shuzheng Si, Haozhe Zhao, Gang Chen, Yunshui Li, Kangyang Luo, Chuancheng Lv, Kaikai An, Fanchao Qi, Baobao Chang, Maosong Sun · OpenReview

Abstract

The expansion of large language models (LLMs) to effectively handle instructions with extremely long contexts remains a significant challenge. The primary obstacle is the scarcity of high-quality long instruction-following datasets. While synthetic data can scale volume, indiscriminately increasing quantity often introduces low-quality samples that hinder performance. We propose GATEAU, a novel framework designed to identify influential, high-quality samples enriched with long-range dependency relations. GATEAU utilizes two primary metrics: Homologous Models' Guidance (HMG) and Contextual Awareness Measurement (CAM). HMG measures the difficulty of generating responses due to long-range dependencies by comparing perplexity scores between models with different context windows. CAM evaluates a model's understanding of long contexts by measuring attention alignment with critical segments. Our experiments demonstrate that training on a small subset of data selected by GATEAU significantly outperforms training on full datasets, enhancing both long-context understanding and general instruction-following capabilities.

Introduction

Modern LLMs are increasingly capable of processing massive context windows, yet aligning them to utilize this space effectively is difficult. Standard Supervised Fine-Tuning (SFT) often relies on synthetic data, which frequently suffers from the "lazy model" problem: many samples do not actually require the model to utilize the full context to generate a correct response. If a model can answer a prompt by only observing the most recent tokens, the training sample fails to teach the model how to handle long-range dependencies. GATEAU addresses this by filtering for samples that specifically challenge the model's long-range reasoning abilities.

Methodology: The GATEAU Framework

GATEAU identifies influential samples by quantifying the necessity of long-range context through two innovative scoring mechanisms:

  1. Homologous Models’ Guidance (HMG): This metric calculates the perplexity gap between two models from the same family that differ only in their context window (e.g., a short-context vs. a long-context version). A significant reduction in perplexity for the long-context model indicates that the sample contains crucial information spread across a distance that the short-context model cannot bridge.
  2. Contextual Awareness Measurement (CAM): This evaluates how well a model focuses its attention on objectively important segments of the input. By identifying which segments are necessary for the response and comparing them to the model's actual attention weights, CAM flags samples where the model is currently "confused" or paying attention to irrelevant filler text.
Overview of the GATEAU framework, integrating Homologous Models' Guidance (HMG) and Contextual Awareness Measurement (CAM) to select influential long-context samples.

The final GATEAU score is a weighted combination of HMG and CAM, allowing for the ranking and selection of the most challenging and informative samples for fine-tuning.

Experimental Setup and Results

We evaluated GATEAU using the LongAlign dataset (10,000 synthetic samples) mixed with ShareGPT for general instruction maintenance. Testing was conducted across benchmarks including LongBench, LongBench-Chat, and MT-Bench, as well as "Needle in a Haystack" retrieval tests.

Key Findings

  • Efficiency and Performance: On the LongBench-Chat benchmark, a model trained on only the top 10% of GATEAU-selected data achieved a score of 55.4, significantly higher than the 48.8 achieved by the model trained on the full 100% of the dataset. This suggests that low-quality data acts as noise that degrades learning.
  • Qualitative Superiority: Analysis of the selected samples shows they score higher in coherence, necessity, and faithfulness compared to low-scoring samples. High-GATEAU samples are objectively more complex and require deeper contextual integration.
Comparison of sample quality between the top 1% and bottom 1% of GATEAU-scored data across five key dimensions.
  • Improved Retrieval: GATEAU-trained models showed fewer "blind spots" in retrieval tasks, maintaining high accuracy even when critical information was buried deep within the middle of a long document.

Discussion and Limitations

GATEAU demonstrates a "less is more" paradigm for long-context alignment. By focusing on the "hardest" samples—those that maximize the gap between short and long-range understanding—we can achieve superior performance with 90% less training data.

However, the framework has limitations. The HMG metric requires homologous model pairs, which may not always be available for proprietary architectures. Additionally, while GATEAU improves general long-context reasoning, specialized domains like complex mathematics may require further refinement of the selection criteria. Finally, the initial calculation of HMG and CAM scores introduces an offline computational overhead, though this is largely offset by the reduced training time on the selected subset.

Conclusion

GATEAU provides a robust, automated method for curating high-quality datasets for long-context LLM alignment. By prioritizing samples that demand long-range dependency modeling, GATEAU enables the development of models that are not only more efficient to train but also more capable of handling the complexities of massive input contexts.

Summary updated

BibTeX
@misc{si2024selecting,
  author = {Shuzheng Si and Haozhe Zhao and Gang Chen and Yunshui Li and Kangyang Luo and Chuancheng Lv and Kaikai An and Fanchao Qi and Baobao Chang and Maosong Sun},
  title = {{Selecting Influential Samples for Long Context Alignment via Homologous Models' Guidance and Contextual Awareness Measurement}},
  year = {2024},
  eprint = {2410.15633},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.15633},
}
Figure