Abstract
Supervised Fine-Tuning (SFT) is essential for adapting Large Language Models (LLMs) to specialized domains, yet it often incurs high computational costs and leads to "catastrophic forgetting" of general knowledge. This paper introduces GrADS (Gradient-Aware Data Selection), a novel, self-adaptive method that identifies the most effective training samples by analyzing gradient distributions from a preliminary training run. By selecting data with the highest probability density—representing the most "typical" or core information of a domain—GrADS allows models to outperform full-dataset training using as little as 5% of the data while significantly preserving pre-existing general capabilities.
Introduction
Turning a general-purpose LLM into a domain expert (e.g., in medicine or law) typically requires massive datasets. This process faces two major hurdles: the extreme resource intensity of training and the tendency for models to lose their general reasoning and safety guardrails, a phenomenon known as catastrophic forgetting (CF). Existing selection methods often rely on expensive teacher models like GPT-4 or intensive human labeling. GrADS offers an automated, efficient alternative that is both self-guided and highly effective.
Methodology
GrADS operates through a two-phase process designed to capture the statistical essence of a target domain without external supervision.
- Gradient Extraction: The model undergoes a single preliminary training epoch on the full candidate dataset. Gradients are captured from the Embedding Layer (reflecting input understanding) and the LM Head (reflecting prediction certainty). These are fused into a unified "GrADS gradient vector" ($G_{GrADS}$).
- Self-Adaptive Selection: Rather than simply choosing the "hardest" (highest gradient) or "easiest" (lowest gradient) samples, GrADS employs Kernel Density Estimation (KDE) to model the probability density of these gradients. It selects samples with the highest probability density—the "typical" instances that best represent the domain's core characteristics.
Key Insights and Results
The "Typicality" Hypothesis
The core philosophy of GrADS is that an LLM learns best from "representative" texts, much like a student learns a new field from classical papers rather than outliers. By avoiding the extreme tails of the gradient distribution, GrADS naturally filters out noisy, confusing data (high-gradient outliers) and trivial, well-learned data (low-gradient outliers).
Performance and Efficiency
Experimental results across medical (CMedQA), legal (LawQA), and financial (FinQA) domains demonstrate the method's superiority:
- Efficiency: Models fine-tuned on just 5% of GrADS-selected data surpassed the performance of models trained on 100% of the original dataset.
- Scaling Gains: At 50% data usage, GrADS achieved average gains of 28.08% in BLEU and 25.57% in METEOR scores compared to full-dataset training.
- Mitigating Forgetting: GrADS showed a remarkable ability to prevent CF. On the C-Eval benchmark, models trained with GrADS retained significantly more general reasoning ability compared to those trained on the full domain dataset.
Transferability
A significant practical finding is that data selection is transferable across model scales. Gradients can be calculated using a small, inexpensive model (e.g., Qwen-1.8B) to select data for fine-tuning a much larger model (e.g., Qwen-14B), maintaining high performance while drastically reducing the cost of the selection phase.
Conclusion and Future Work
GrADS provides a robust, model-agnostic framework for efficient SFT. While it requires an initial pass over the full dataset to collect gradients, the subsequent savings in training time and the preservation of model safety make it a powerful tool for domain adaptation. Future research will explore applying GrADS to Continual Learning scenarios, where models must acquire a sequence of new domains without eroding previously learned knowledge.
Summary updated