Beyond Similarity: A Gradient-based Graph Method for Instruction Tuning Data Selection

Yang Zhao, Li Du, Xiao Ding, Yangou Ouyang, Hepeng Wang, Kai Xiong, Jinglong Gao, Zhouhao Sun, Dongliang Xu, Qing Yang, Dongchen Li, Bing Qin, Ting Liu

Introduction

Instruction tuning is a critical phase in transforming base large language models (LLMs) into functional assistants. However, as models move into specialized domains like medicine or law, high-quality instruction data becomes increasingly scarce. Traditional data selection methods typically rely on similarity-based selection, identifying training samples that closely match a small validation set.

This paper argues that such approaches are fundamentally limited because they treat data points as independent entities. In reality, instruction samples exhibit complex interdependencies; selecting based purely on similarity can lead to redundancy or conflicting gradients that hinder model convergence. To address this, the authors propose G2IS (Gradient-based Graph Instruction Selection), a method that shifts the focus from individual sample similarity to the joint-distribution selection of data.

Methodology: The G2IS Framework

The G2IS method models how samples interact with each other using a gradient-based graph, ensuring that the selected subset is both diverse and coherent. The process is divided into three primary stages:

  1. Gradient as Knowledge: Rather than using static text embeddings, G2IS utilizes model gradients to represent data. Gradients capture how a specific sample would actually alter the model's internal weights. To better simulate modern optimizers like Adam, the researchers employ "momentum-adjusted gradients."
  2. Core Knowledge Extraction: By applying Principal Component Analysis (PCA) to the gradients of a small validation set, the method identifies "principal components." These represent the most critical directions the model must move in to master the target task, effectively filtering out noise.
  3. The Gradient Walk: The core of the algorithm involves building a graph where nodes are gradients and edges represent similarity. The selection process then "walks" through this graph based on three principles: No Conflict (avoiding contradictory samples), Consistency (aligning with core knowledge), and Knowledge Coherence (ensuring a smooth learning path between consecutive samples).
The G2IS pipeline: from Core Knowledge Extraction to the Gradient Walk algorithm.

Experimental Setup

The researchers evaluated G2IS across several diverse instruction-tuning sources, including Infinity-Instruct, Chain of Thought (COT), and FLAN-v2. The method was tested on three popular open-source models: Llama 3.1-8B, Gemma-7B, and Mistral-7B. Performance was measured across standard benchmarks such as BBH (reasoning), GPQA (science), GSM8K/Math (mathematics), and MMLU (general knowledge).

Key Results and Insights

The "Less is More" Paradox

A primary finding of the study is that training on a carefully curated 1% of the dataset often outperforms training on the full 100%. This suggests that large-scale datasets frequently contain "data noise" and conflicting instructions that can degrade performance during domain-specific tuning.

Comparison of accuracy between models trained on the full dataset versus a 1% subset selected by G2IS.

Performance Gains

  • Mathematical Reasoning: G2IS showed exceptional results in math benchmarks. For instance, using the Gemma-7B model on GSM8K, G2IS improved accuracy by 12.66% compared to tuning on the entire dataset.
  • Multi-Task Robustness: Unlike previous state-of-the-art methods like LESS, G2IS remained stable when optimizing for multiple tasks simultaneously. The graph-based approach effectively manages conflicting objectives by ensuring the selected data maintains a coherent learning trajectory.
  • Gradient Superiority: The results confirm that gradients are a more powerful proxy for data utility than text embeddings, as they reflect the actual functional impact of data on the model's parameters.

Conclusion and Future Work

G2IS demonstrates that modeling the interdependencies of instruction data through a gradient-based graph can significantly improve the efficiency and effectiveness of instruction tuning. By selecting only the most impactful 1% of data, researchers can achieve superior performance while reducing computational overhead.

Future research directions include scaling the method to larger models (e.g., 70B+ parameters) and exploring the use of full-parameter gradients, as the current study primarily utilized LoRA-based gradients to manage computational costs.

Summary updated

BibTeX
@inproceedings{zhao2025beyond,
  author = {Yang Zhao and Li Du and Xiao Ding and Yangou Ouyang and Hepeng Wang and Kai Xiong and Jinglong Gao and Zhouhao Sun and Dongliang Xu and Qing Yang and Dongchen Li and Bing Qin and Ting Liu},
  title = {{Beyond Similarity: A Gradient-based Graph Method for Instruction Tuning Data Selection}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure