Abstract
Large Language Models (LLMs) have demonstrated remarkable abilities in general scenarios. Instruction finetuning empowers them to align with humans in various tasks. Nevertheless, the Diversity and Quality of the instruction data remain two main challenges for instruction finetuning. With regard to this, in this paper, we propose a novel gradient-based method to automatically select high-quality and diverse instruction finetuning data for machine translation. Our key innovation centers around analyzing how individual training examples influence the model during training. Specifically, we select training examples that exert beneficial influences on the model as high-quality ones by means of Influence Function plus a small high-quality seed dataset. Moreover, to enhance the diversity of the training data we maximize the variety of influences they have on the model by clustering on their gradients and resampling. Extensive experiments on WMT22 and FLORES translation tasks demonstrate the superiority of our methods, and in-depth analysis further validates their effectiveness and generalization.
Introduction
Instruction finetuning (IFT) is the pivotal process that transforms raw language models into helpful assistants. However, recent research suggests that the traditional "more is better" approach to data collection is reaching a point of diminishing returns. Instead, a small volume of high-quality, diverse data often yields superior results compared to massive, noisy datasets.
The primary challenge lies in the selection process. Existing methods often rely on external "proxy" models—such as GPT-4 or BERT-based reward models—to evaluate data quality. This paper argues that such approaches are suboptimal because they ignore the specific learning behavior and inherent capabilities of the target model. We introduce G-DIG (Gradient-based DIverse and hiGh-quality), a method that allows the model itself to determine which data is most beneficial for its growth by analyzing internal gradients.
The G-DIG Framework
G-DIG operates through a two-stage pipeline designed to identify data that is both high-quality and representative of diverse linguistic patterns.
1. Quality Selection via Influence Functions
The process begins with a "seed set" of 256 human-curated, gold-standard translations. We utilize Influence Functions (IF) to calculate the impact of every candidate example in a large training pool. The IF score determines whether training on a specific example would reduce the model's loss on the high-quality seed set. Examples that exert a positive influence are flagged as high-quality.
2. Diversity Enhancement via Gradient Clustering
Quality alone is insufficient; a model requires variety to generalize well. To ensure diversity, G-DIG analyzes the gradients of the model's Multilayer Perceptron (MLP) layers. These gradients serve as a "fingerprint" of how an example influences the model's internal state. By applying K-means clustering to these gradients and sampling uniformly from each cluster, the final training set covers a broad spectrum of "influence types." To maintain computational efficiency, the method employs Random Projection for dimensionality reduction and Kronecker-Factored Approximate Curvature (KFAC) to approximate the Influence Functions.
Experimental Evaluation
The effectiveness of G-DIG was evaluated on two major translation tasks:
- Chinese to English (Zh ⇒ En): Using a candidate pool of 1.9 million examples from WMT22.
- German to English (De ⇒ En): Using a candidate pool of 256,000 examples from WMT22.
- Seed Data: 256 human-revised parallel texts.
- Evaluation Metrics: BLEU, COMET, and BLEURT scores on WMT22 test sets and Flores-101.
Results and Key Insights
G-DIG consistently outperformed random selection and proxy-based reward models across all tested metrics. Notably, a 7B-parameter model (Baichuan2 or Llama2) finetuned with G-DIG data achieved performance competitive with much larger state-of-the-art models like Bayling-13B and BigTranslate-13B.
Analysis of Findings
- The "Less is More" Effect: Models trained on just 1,000 G-DIG-selected examples often outperformed those trained on 64,000 randomly selected examples. This highlights the efficiency of gradient-based selection.
- Gradients vs. Embeddings: While text embeddings capture semantic similarity, gradients capture learning impact. Gradient-based clustering ensures the model is challenged by diverse concepts rather than just semantically varied text.
- The Scarcity Threshold: Diversity enhancement is most critical when the training budget is extremely small (under 2,000 examples). As the dataset size increases, the natural diversity of the candidate pool begins to compensate for the lack of explicit selection.
- Human Preference: Blind human evaluations confirmed the automated metrics, with judges preferring G-DIG translations significantly more often than those from models trained on random subsets (e.g., 35% "Win" vs. 12% "Lose" for Zh-En).
Discussion and Limitations
Despite its success, G-DIG is computationally intensive due to the requirement of calculating second-order derivatives (Hessians) for Influence Functions. Although KFAC provides a viable approximation, it remains slower than simple text filtering. Furthermore, the method's success is tied to the quality of the initial seed set. Future research will focus on scaling these gradient-based methods to even larger datasets and applying the framework to complex reasoning tasks beyond translation.
This paper was presented at ACL 2024.
Summary updated