Abstract
Instruction tuning has achieved unprecedented success in NLP, turning large language models into versatile chatbots. However, the increasing variety and volume of instruction datasets demand significant computational resources. To address this, it is essential to extract a small and highly informative subset (i.e., Coreset) that achieves comparable performance to the full dataset. Achieving this goal poses non-trivial challenges: 1) data selection requires accurate data representations that reflect the training samples’ quality, 2) considering the diverse nature of instruction datasets, and 3) ensuring the efficiency of the coreset selection algorithm for large models. To address these challenges, we propose Task-Agnostic Gradient Clustered COreset Selection (TAGCOS). Specifically, we leverage sample gradients as the data representations, perform clustering to group similar data, and apply an efficient greedy algorithm for coreset selection. Experimental results show that our algorithm, selecting only 5% of the data, surpasses other unsupervised methods and achieves performance close to that of the full dataset.
Introduction
Instruction tuning has become the standard for creating versatile chatbots. However, as instruction datasets balloon to millions of samples, the computational cost of training becomes prohibitive. A major issue identified in current practices is redundancy. Not every instruction is equally valuable; training on a massive, low-quality, or repetitive dataset can be less effective than training on a small, curated "coreset."
Existing selection methods are often too simple (like picking samples with high perplexity) or too complex (like bi-level optimization, which is too slow for LLMs with billions of parameters). TAGCOS addresses these gaps by identifying the most "informative" 5% of instruction tuning data through the analysis of model gradients.
Methodology: The TAGCOS Pipeline
The proposed framework, Task-Agnostic Gradient Clustered Coreset Selection (TAGCOS), is a three-stage pipeline designed to be efficient and model-agnostic.
- Gradient Feature Computation: Instead of using simple text embeddings, TAGCOS utilizes the gradients of a sample. Gradients represent the "direction" a model needs to move to learn from that specific piece of data. To make this feasible for LLMs, the authors use LoRA (Low-Rank Adaptation) to reduce trainable parameters and random projections to compress gradient vectors into a manageable size.
- Gradient-based Clustering: To ensure the selected subset is diverse and covers all "domains" of the data, K-means clustering is performed on these gradient features. This prevents over-sampling specific instruction types.
- Coreset Selection via OMP: Within each cluster, Orthogonal Matching Pursuit (OMP)—a greedy algorithm—selects samples whose gradients, when combined, best approximate the average gradient of the entire cluster.
Experimental Setup
The researchers combined 17 popular instruction datasets (including Dolly, Alpaca, and ShareGPT) to create a pool of approximately 1.07 million examples. Models were evaluated on three major benchmarks: TydiQA (multilingual QA), MMLU (general knowledge), and BBH (complex reasoning).
Key Results and Insights
Experimental results demonstrate that TAGCOS is highly effective at identifying high-quality data subsets.
- Performance vs. Data Volume: On the Llama-2 7B model, TAGCOS achieved an average score of 48.35 across benchmarks using only 5% of the data, compared to 49.58 for the full 100% dataset. It consistently outperformed other selection methods like Uniform sampling and K-Center clustering.
- Efficiency Gains: In a real-world scenario involving hyperparameter optimization, using the TAGCOS 5% subset reduced total GPU time from 1,401 hours to 297.7 hours—a saving of over 1,100 hours.
- Gradients as Superior Features: The study found that gradients are superior to traditional semantic embeddings (like BERT) because they capture the optimization dynamics—how the data actually changes the model—rather than just text semantics.
- Transferability: Data selected using a Llama-2 model was successfully used to train Mistral-7B and Llama-3-8B models, proving that the high-quality subset identified by TAGCOS is not strictly tied to one specific architecture.
Conclusion
TAGCOS provides a robust, task-agnostic method for coreset selection in instruction tuning. While the primary bottleneck remains the initial gradient computation (approximately 144 hours in this setup), the subsequent savings in training and hyperparameter tuning are substantial. Future work will focus on improving the efficiency of gradient estimation to scale the framework to even larger datasets and exploring multi-modal applications.
Summary updated