用梯度分析选数据,5%样本就能让大模型更懂专业领域。
Learn More, Forget Less: A Gradient-Aware Data Selection Approach for LLM
- 基于训练初期梯度大小与分布,自动筛选高价值训练样本。
- 仅用5%精选数据,模型性能超过全量数据微调,50%时提升显著。
- 有效缓解灾难性遗忘,适合资源有限的专业领域微调场景。
尽管大语言模型在众多任务中表现优异,但监督微调(SFT)仍是其适配专业领域的关键步骤。然而,领域微调成本高且常导致通用能力下降,引发灾难性遗忘(CF)。为此,我们提出自适应梯度感知数据选择方法(GrADS),通过初步训练阶段获取的梯度分析,识别最具代表性的训练数据子集。具体地,设计自引导标准,利用梯度幅度及其统计分布,优先选择对模型学习贡献最大的样本。该方法使模型更好地理解特定领域任务。在医学、法律、金融等多个领域的多款LLM上广泛实验表明,GrADS具有显著效率与成本优势:仅使用5%的精选数据,模型性能即超越全量数据微调结果;增至50%数据时性能进一步显著提升,同时显著缓解灾难性遗忘。代码将于后续发布。
原文摘要 · Abstract (English)
Despite large language models (LLMs) have achieved impressive achievements across numerous tasks, supervised fine-tuning (SFT) remains essential for adapting these models to specialized domains. However, SFT for domain specialization can be resource-intensive and sometimes leads to a deterioration in performance over general capabilities due to catastrophic forgetting (CF). To address these issues, we propose a self-adaptive gradient-aware data selection approach (GrADS) for supervised fine-tuning of LLMs, which identifies effective subsets of training data by analyzing gradients obtained from a preliminary training phase. Specifically, we design self-guided criteria that leverage the magnitude and statistical distribution of gradients to prioritize examples that contribute the most to the model's learning process. This approach enables the acquisition of representative samples that enhance LLMs understanding of domain-specific tasks. Through extensive experimentation with various LLMs across diverse domains such as medicine, law, and finance, GrADS has demonstrated significant efficiency and cost-effectiveness. Remarkably, utilizing merely 5% of the selected GrADS data, LLMs already surpass the performance of those fine-tuned on the entire dataset, and increasing to 50% of the data results in significant improvements! With catastrophic forgetting substantially mitigated simultaneously. We will release our code for GrADS later.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。