GATEAU: Selecting Influential Samples for Long Context Alignment

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

Abstract

Aligning large language models (LLMs) to handle instructions with extremely long contexts has yet to be fully investigated. Previous studies attempt to scale up the available data volume by synthesizing long instruction-following samples, as constructing such a dataset tends to be challenging for annotators. However, a lack of a well-defined strategy for ensuring data quality may introduce low-quality samples and restrict the model performance. Thus, we propose GATEAU, a novel framework to address the unique challenge of long context alignment by identifying the influential samples enriched with long-range dependency relations. Specifically, GATEAU measures the long-range dependencies from two essential aspects: the difficulty of generating target responses due to the long-range dependencies, and the difficulty of understanding long inputs due to such dependencies. Comprehensive experiments indicate that GATEAU effectively identifies influential samples and the model trained on these selected samples exhibits better instruction-following and long-context understanding capabilities.

Introduction

Modern Large Language Models (LLMs) are increasingly capable of processing massive context windows, often exceeding 128k tokens. However, the process of "aligning" these models to effectively follow instructions within such expansive contexts remains a significant bottleneck. The primary obstacles include the prohibitive cost of human annotation for long documents and the inherent noise in synthetic datasets, which often lack the organic long-range semantic dependencies found in real-world text.

Furthermore, simply scaling up synthetic data volume can lead to a "quantity trap," where low-quality samples that do not require long-context reasoning encourage the model to adopt "lazy-reading" behaviors. To combat this, we introduce GATEAU, a framework designed to select the most influential training samples—those that maximize long-context performance by emphasizing complex, long-range dependencies.

The GATEAU Framework

GATEAU identifies influential samples using two primary metrics that capture different facets of long-range dependency richness: Homologous Models’ Guidance (HMG) and ConTExtual Awareness MeasUrement (CAM).

The GATEAU framework overview, illustrating the selection of influential samples using Homologous Models’ Guidance (HMG) and Contextual Awareness Measurement (CAM).

1. Homologous Models’ Guidance (HMG)

HMG identifies samples where the long context is indispensable for generating a correct response. It calculates the difference in perplexity (PPL) between two "homologous" models: a short-context model (e.g., LLaMA-3-8k) and a long-context model (e.g., LLaMA-3-64k). If the short-context model finds a response significantly harder to predict than the long-context model, the sample likely contains critical information embedded deep within the long context.

2. ConTExtual Awareness MeasUrement (CAM)

CAM evaluates the model's ability to discern important segments within a long input. The input is partitioned into segments, and an importance score is calculated for each based on its contribution to the target response. This is then compared to the model's actual attention weights. Samples where the model's attention is misaligned with the segment importance are considered "challenging" and highly influential for training.

Experimental Results and Insights

The effectiveness of GATEAU was evaluated using the LongAlign dataset (10,000 samples up to 100k tokens) and benchmarks such as LongBench, LongBench-Chat, and MT-Bench.

Efficiency and Performance

The most significant finding is that "less is more" in long-context alignment. A LLaMA-2-7B model trained on only the top 10% of samples selected by GATEAU outperformed the same model trained on the full 100% of the dataset. Specifically, GATEAU-LLaMA achieved a 9% improvement on LongBench-Chat and a 6.5% boost on MT-Bench compared to standard fine-tuning.

Comparison of data quality metrics between the top 1% and bottom 1% of samples selected by GATEAU, highlighting the superiority of selected influential samples.

Quality over Quantity

As shown in the radar chart above, samples selected by GATEAU score significantly higher across dimensions such as coherence, necessity of long context, and faithfulness. By filtering for quality, the model learns to rely on long-range dependencies rather than shortcuts. Interestingly, improving long-context capabilities also yielded a "free" boost to short-context performance, suggesting that mastering complex long-range tasks enhances the robustness of general reasoning.

Conclusion

GATEAU provides a robust solution to the data quality challenges in long-context LLM alignment. By focusing on samples with high long-range dependency, the framework enables more efficient training and superior model performance. While the method currently requires homologous model versions and adds a pre-processing step, the resulting gains in instruction-following and document understanding represent a significant step forward for long-context AI.

Summary updated

BibTeX
@misc{si2024gateau,
  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 = {{GATEAU: Selecting Influential Samples for Long Context Alignment}},
  year = {2024},
  eprint = {2410.15633},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.15633},
}
Figure