[论文解读] D-CPT Law: Domain-specific Continual Pre-Training Scaling Law for Large Language Models
本文提出了 D-CPT 法则,这是一种用于领域特定持续预训练(D-CPT)的缩放法则,可预测在最小训练成本下大型语言模型在通用语料与领域特定语料之间的最优混合比例。通过将参数化损失函数拟合至小规模实验,该方法能够准确预测不同模型规模、数据集规模和混合比例下的模型性能,R² 值高于 0.97,Huber 损失低于 0.02,且通过使用领域特定系数的跨领域 D-CPT 法则,可扩展至跨领域设置。
Continual Pre-Training (CPT) on Large Language Models (LLMs) has been widely used to expand the model's fundamental understanding of specific downstream domains (e.g., math and code). For the CPT on domain-specific LLMs, one important question is how to choose the optimal mixture ratio between the general-corpus (e.g., Dolma, Slim-pajama) and the downstream domain-corpus. Existing methods usually adopt laborious human efforts by grid-searching on a set of mixture ratios, which require high GPU training consumption costs. Besides, we cannot guarantee the selected ratio is optimal for the specific domain. To address the limitations of existing methods, inspired by the Scaling Law for performance prediction, we propose to investigate the Scaling Law of the Domain-specific Continual Pre-Training (D-CPT Law) to decide the optimal mixture ratio with acceptable training costs for LLMs of different sizes. Specifically, by fitting the D-CPT Law, we can easily predict the general and downstream performance of arbitrary mixture ratios, model sizes, and dataset sizes using small-scale training costs on limited experiments. Moreover, we also extend our standard D-CPT Law on cross-domain settings and propose the Cross-Domain D-CPT Law to predict the D-CPT law of target domains, where very small training costs (about 1% of the normal training costs) are needed for the target domains. Comprehensive experimental results on six downstream domains demonstrate the effectiveness and generalizability of our proposed D-CPT Law and Cross-Domain D-CPT Law.
研究动机与目标
- 为解决在领域特定持续预训练(D-CPT)中通过网格搜索混合比例所导致的高计算成本和次优结果问题。
- 开发一种可扩展、数据高效的预测方法,无需进行大量全规模训练即可预测最优混合比例。
- 将该方法扩展至跨领域设置,使利用其他领域数据可预测未见领域中的性能表现。
- 验证 D-CPT 法则在不同模型规模、数据集规模和混合比例下在多样化领域中的泛化能力。
提出的方法
- 提出一种参数化缩放法则 D-CPT 法则,将验证损失建模为模型规模(N)、数据集规模(D)和混合比例(r)的函数:L(N,D,r) = E + A/N^α + B·r^η/D^β + C/(r′)^γ,其中 r′ = r + ε 以保证数值稳定性。
- 采用类似 Chinchilla 的缩放原则,对不同混合比例下通用性能与领域特定性能之间的权衡进行建模。
- 引入领域特定可学习系数(DLC),实现跨领域的迁移学习,形成跨领域 D-CPT 法则。
- 利用小规模实验(模型和数据规模有限)拟合 D-CPT 法则,然后将预测结果外推至全规模设置。
- 应用 Huber 损失和 R² 指标评估在多个领域和模型规模下的拟合精度。
- 采用 k 折交叉验证和 3 折交叉验证,评估该法则在不同领域和参数化设置下的泛化能力与鲁棒性。

实验结果
研究问题
- RQ1能否通过极低的训练成本,利用缩放法则准确预测 D-CPT 中通用语料与领域特定语料之间的最优混合比例?
- RQ2D-CPT 法则在不同模型规模、数据集规模和混合比例下的泛化能力如何?
- RQ3D-CPT 法则是否可扩展至利用其他领域数据预测未见领域性能?
- RQ4D-CPT 法则与跨领域 D-CPT 法则在代码、数学、法律、音乐、化学和医学等多样化下游领域中的预测精度如何?
主要发现
- D-CPT 法则在所有测试领域中均实现 Huber 损失低于 0.02 且 R² 高于 0.97,表明拟合精度极高。
- 该法则在模型规模(0.5B 至 4B 参数)、数据集规模(0.1B 至 26B 标记)和混合比例(0 至 1)之间均表现出良好的泛化能力。
- 跨领域 D-CPT 法则可仅使用约 1% 的正常训练成本,基于四个源领域数据即能预测新领域的性能表现。
- 即使在跨领域泛化场景下,该方法仍实现 R² > 0.97 且 Huber 损失 < 0.02,其中表现最佳的参数化设置(L₃)在大多数领域中 R² > 0.99 且 Huber 损失 < 0.007。
- 跨领域 D-CPT 法则在未见领域(如音乐和化学)的通用语料损失预测中保持强大预测能力,R² > 0.98。
- 该方法通过用小规模拟合替代全网格搜索,显著降低了 GPU 消耗,实现了领域特定大语言模型高效超参数搜索。

阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。