用领域数据提前训练,能更好专精且不丢通用能力
The Finetuner's Fallacy: When to Pretrain with Your Finetuning Data
- 把领域数据用于预训练阶段重复输入,而非仅用于微调
- 相同性能下可减少1.75倍预训练量,小模型胜过更大标准模型
- 适合资源有限但需强领域性能的场景,如科研、医疗等
真实应用中模型需在数据稀缺的窄域上表现优异。传统做法是微调模型以适应领域,但易过拟合且遗忘通用知识。本文提出专用预训练(SPT):将原本用于微调的小规模领域数据,在预训练阶段作为总词元的一部分反复输入。在ChemPile、MusicPile和ProofPile三个领域上,SPT在微调后既提升了领域性能,又保留了通用能力。实验表明,达到同等领域性能时,SPT可将所需预训练词元数减少最多1.75倍。当目标领域在预训练语料中代表性不足时,1B参数的SPT模型甚至优于3B的标准预训练模型。我们还推导出过拟合缩放定律,帮助用户根据计算预算选择最优领域数据重复率。研究揭示‘微调者谬误’:看似便宜的微调其实不如早期引入领域数据高效。SPT通过多次暴露减少过拟合,微调时减少遗忘,最终以更少参数和更低总计算量实现更强效果。要最大化领域数据价值,应尽早纳入训练流程。
原文摘要 · Abstract (English)
Real-world model deployments demand strong performance on narrow domains where data is often scarce. Typically, practitioners finetune models to specialize them, but this risks overfitting to the domain and forgetting general knowledge. We study a simple strategy, specialized pretraining (SPT), where a small domain dataset, typically reserved for finetuning, is repeated starting from pretraining as a fraction of the total tokens. Across three specialized domains (ChemPile, MusicPile, and ProofPile), SPT improves domain performance and preserves general capabilities after finetuning compared to standard pretraining. In our experiments, SPT reduces the pretraining tokens needed to reach a given domain performance by up to 1.75x. These gains grow when the target domain is underrepresented in the pretraining corpus: on domains far from web text, a 1B SPT model outperforms a 3B standard pretrained model. Beyond these empirical gains, we derive overfitting scaling laws to guide practitioners in selecting the optimal domain-data repetition for a given pretraining compute budget. Our observations reveal the finetuner's fallacy: while finetuning may appear to be the cheapest path to domain adaptation, introducing specialized domain data during pretraining stretches its utility. SPT yields better specialized domain performance (via reduced overfitting across repeated exposures) and better general domain performance (via reduced forgetting during finetuning), ultimately achieving stronger results with fewer parameters and less total compute when amortized over inference. To get the most out of domain data, incorporate it as early in training as possible.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。