[Paper Review] D-CPT Law: Domain-specific Continual Pre-Training Scaling Law for Large Language Models
This paper proposes the D-CPT Law, a scaling law for domain-specific continual pre-training (CPT) that predicts optimal mixture ratios between general and domain-specific corpora for large language models with minimal training cost. By fitting a parametric loss function to small-scale experiments, the method enables accurate prediction of model performance across model sizes, dataset sizes, and mixture ratios, with high R² (>0.97) and low Huber loss (<0.02), and extends to cross-domain settings via a Cross-Domain D-CPT Law using domain-specific coefficients.
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.
Motivation & Objective
- To address the high computational cost and suboptimal results of grid-searching mixture ratios in domain-specific continual pre-training (D-CPT).
- To develop a scalable, data-efficient method for predicting optimal mixture ratios without extensive full-scale training.
- To extend the method to cross-domain settings where performance on unseen domains can be predicted using data from other domains.
- To validate the generalizability of the D-CPT Law across model sizes, dataset sizes, and mixture ratios in diverse domains.
Proposed method
- Proposes a parametric scaling law, D-CPT Law, modeling validation loss as a function of model size (N), dataset size (D), and mixture ratio (r): L(N,D,r) = E + A/N^α + B·r^η/D^β + C/(r′)^γ, with r′ = r + ε for numerical stability.
- Employs Chinchilla-inspired scaling principles to model the trade-off between general and domain-specific performance across different mixture ratios.
- Introduces Domain-specific Learnable Coefficients (DLC) to enable transfer learning across domains, forming the Cross-Domain D-CPT Law.
- Uses small-scale experiments with limited model and data sizes to fit the D-CPT Law, then extrapolates predictions to full-scale settings.
- Applies Huber loss and R² metrics to evaluate fitting accuracy across multiple domains and model sizes.
- Employs k-fold cross-validation and 3-fold cross-validation to assess generalizability and robustness of the law across domains and parameterizations.

Experimental results
Research questions
- RQ1Can a scaling law accurately predict the optimal mixture ratio between general and domain-specific corpora in D-CPT with minimal training cost?
- RQ2How well does the D-CPT Law generalize across different model sizes, dataset sizes, and mixture ratios?
- RQ3Can the D-CPT Law be extended to predict performance in unseen domains using data from other domains?
- RQ4What is the predictive accuracy of the D-CPT Law and Cross-Domain D-CPT Law across diverse downstream domains such as code, math, law, music, chemistry, and medical?
Key findings
- The D-CPT Law achieves Huber loss below 0.02 and R² above 0.97 across all tested domains, indicating high fitting accuracy.
- The law generalizes effectively across model sizes (0.5B to 4B parameters), dataset sizes (0.1B to 26B tokens), and mixture ratios (0 to 1).
- The Cross-Domain D-CPT Law enables performance prediction for new domains using only ~1% of the normal training cost, based on data from four source domains.
- The method achieves R² > 0.97 and Huber loss < 0.02 even in cross-domain generalization, with the best-performing parameterization (L₃) showing R² > 0.99 and Huber loss < 0.007 in most domains.
- The Cross-Domain D-CPT Law maintains strong predictive power, with R² > 0.98 in general-corpus loss prediction across unseen domains like music and chemistry.
- The method significantly reduces GPU consumption by replacing full grid searches with small-scale fitting, enabling efficient hyperparameter search for domain-specific LLMs.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.