Influential Language Data Selection via Gradient Trajectory Pursuit

Zhiwei Deng, Tao Li, Yang Li · DOI

Abstract

Training Large Language Models (LLMs) is computationally expensive, and the quality of training data often outweighs sheer volume, particularly during post-training phases like instruction tuning. We present Gradient Trajectory Pursuit (GTP), a novel algorithm designed to select the most influential data subsets by matching a model's gradient trajectory in a low-dimensional subspace. GTP performs joint data selection, which inherently de-duplicates redundant samples, achieving full model performance with as little as 0.5% of the original dataset. Our method demonstrates significant computational efficiency, outperforming traditional joint selection techniques like Orthogonal Matching Pursuit (OMP) by up to 17x.

Introduction

The efficacy of LLMs is heavily dependent on the data used for fine-tuning. However, selecting a representative "coreset" from massive corpora is challenging. Existing methods typically rely on Top-$k$ Ranking, which picks individual high-quality samples but often fails by selecting redundant data. Alternatively, Joint Selection methods aim to find a set that collectively covers the necessary information space but are often too slow to scale to modern LLM datasets. GTP bridges this gap by offering an efficient joint selection framework that scales to millions of samples.

Methodology: Gradient Trajectory Matching

GTP is based on the premise that a model's optimization can be viewed as a trajectory through a gradient field. By selecting a small subset of data that produces a gradient trajectory matching that of the full dataset, the model trained on this subset can reach a similar final state.

Conceptual overview of GTP: matching training trajectories in a target subspace while selecting high-quality instruction-tuning pairs.

Technical Components

  1. Subspace Projection: To manage the high dimensionality of LLM gradients, GTP projects them onto a low-dimensional subspace using Principal Component Analysis (PCA). This reduces noise and computational overhead.
  2. Iterative Compressive Sampling: Inspired by CoSaMP, GTP iteratively selects a pool of candidates, solves a non-negative least squares (NNLS) problem to assign weights, and prunes less useful samples. This approach is significantly faster than the greedy one-at-a-time selection of OMP.
  3. Distributed Scaling: A "star model" for distributed computing allows GTP to scale across multiple machines by partitioning the candidate data pool.

Key Insights

  • Implicit De-duplication: By using NNLS for joint selection, GTP naturally handles redundancy. If two samples are nearly identical, the algorithm assigns a high weight to one and zero to the other, whereas Top-$k$ methods would select both.
  • Low-Rank Optimization: LLM optimization primarily occurs in a low-rank subspace. GTP leverages this by focusing on principal components, ignoring gradient noise that does not contribute to the overall model direction.

Experimental Results

The authors evaluated GTP on benchmarks including ALFWorld and targeted instruction tuning (Flan V2, CoT, etc.).

Data Efficiency and Performance

GTP achieved performance parity with models trained on full datasets using only 0.5% of the data (approximately 1,353 samples). In agent-based tasks (ALFWorld), GTP consistently outperformed baselines like random sampling and Top-$k$ gradient selection (LESS).

Computational Speedup

A major advantage of GTP is its scalability. As shown in the performance analysis, GTP maintains low computation time even as the subset selection size increases, whereas traditional OMP scales poorly.

Computation time comparison: GTP and its distributed variant show significant speedups and better scaling compared to Orthogonal Matching Pursuit (OMP).

GTP was found to be up to 17x more efficient than vanilla OMP-based selection. Furthermore, the algorithm typically converges within just 5 iterations, making the pursuit process extremely rapid once gradients are extracted.

Limitations and Future Work

While GTP is highly efficient during the selection phase, it still requires an initial "warmup" training run to compute gradients for the entire candidate pool. Future research may explore combining gradient-matching pursuit with faster representation-based methods to further reduce this pre-processing overhead. Additionally, while effective for targeted tuning, extending GTP to general-purpose pre-training without a predefined target dataset remains an open area of exploration.

Summary updated

BibTeX
@misc{deng2024influential,
  author = {Zhiwei Deng and Tao Li and Yang Li},
  title = {{Influential Language Data Selection via Gradient Trajectory Pursuit}},
  year = {2024},
  eprint = {2410.16710},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.16710},
}
Figure