Scaling Law and Scaling Choices in Large Model Pre-training

    This article explores the application of Scaling Laws in large model pre-training to optimize resource allocation and reduce trial-and-error costs. It covers key findings from Kaplan and Hoffmann, prerequisites for data quality, factors influencing the choice between scaling parameters versus data, and a practical engineering path from small-scale experiments to formal training.

    I. Why Study Scaling Law?

    Training a model with tens of billions of parameters consumes thousands of GPU hours from data preparation to distributed training and evaluation. Most teams cannot afford the cost of repeated trial-and-error, so they commonly adopt a “small-scale experiments first, then large-scale training” approach.

    The theoretical tool supporting this approach is the Scaling Law. It describes an approximate power-law relationship between model loss and the number of parameters N, training tokens D, and training compute C. By fitting the loss curves of small models, teams can extrapolate the approximate performance of larger models, thereby determining the training direction at a lower cost.

    For teams developing their own large models, correctly utilizing Scaling Law offers three main benefits:

    1. Compute allocation: Determining the ratio of parameters to tokens given a fixed total compute to reduce resource waste.
    2. Early risk detection: Identifying issues with hyperparameters such as learning rate, batch size, and data mixture on small models.
    3. Roadmap planning: Accumulating reusable experience to support subsequent model iterations.

    These benefits rely on verified patterns. Teams need to use their own data to confirm whether these patterns hold true. The following sections explain the conclusions and prerequisites of Scaling Law, discuss the trade-off between scaling parameters and data, and finally provide an executable training path.

    II. Conclusions and Prerequisites of Scaling Law

    2.1 Two Representative Conclusions

    Kaplan et al. (2020) found that under fixed compute, model loss decreases as a power law with the growth of N, D, and C. Their fitting results suggest that when compute increases, priority should be given to expanding parameters, while data volume only needs moderate growth.

    Hoffmann et al. (2022, the Chinchilla study) re-fitted under a more systematic experimental design and reached a different conclusion: under compute-optimal conditions, parameters and tokens should grow roughly proportionally, with a common empirical value of about 20 training tokens per parameter. The differences between the two conclusions partly stem from varying fitting intervals, learning rate schedules, and evaluation methods, so specific conditions must be stated when citing them.

    The compute required to train a Transformer can be approximated as:

    1. C ≈ 6 × N × D

    Under this approximation, given compute C, as N increases, D must correspondingly decrease, and the allocation ratio is determined by the fitting results.

    2.2 Prerequisite 1: Training Data Must Be Clean Enough

    The fitting results of classic Scaling Laws assume stable training data quality. When data quality degrades, the loss curve deviates from the power law, primarily in two aspects:

    • Decreased information density: A large amount of duplicated, garbled, or templated text occupies tokens, meaning the same number of tokens contains less effective knowledge.
    • Poorer training stability: Gradient interference from noisy data increases, making loss spikes more likely in the later stages of training.

    In such cases, expanding parameters may not yield benefits, and the model might fit noise faster. To determine if the data meets the standard, refer to the following inspection process. The thresholds need to be calibrated through manual sampling:

    1. Raw corpus -> Language and format validation (language identification confidence threshold)
    2. -> Heuristic filtering (duplicate line ratio, symbol ratio, length range)
    3. -> Classifier scoring (keep text with scores above the threshold, threshold set based on sampling results)
    4. -> Deduplication (exact plus approximate deduplication, record the deduplication rate)
    5. -> Mixture adjustment (ratios of code, math, multilingual, and general text, set upper limits)

    Each step should record the number of inputs and outputs and the manual sampling pass rate. Without these records, it is impossible to determine whether performance changes come from the model or the data.

    2.3 Scale Parameters or Data: Choose Based on Conditions

    “Prioritize larger models with the same compute” only holds under certain conditions. The table below lists the main factors influencing the decision:

    Consideration Favor Scaling Parameters Favor Scaling Data
    Inference volume Low volume, training cost dominates High volume, smaller model with more data lowers total cost
    High-quality data reserve Sufficient data to support more tokens Limited data, diminishing returns from repeated training, be cautious with adding parameters
    Data cleaning capability Mature data pipeline, controllable quality Weak cleaning capability, should improve data quality first
    Downstream task needs Knowledge-intensive, complex reasoning tasks Scenarios sensitive to latency and cost
    Compute budget Sufficient budget, can afford training and deployment of large models Limited budget, need to balance training and inference

    This table shows that the final decision depends on specific scenarios. A safer approach is to conduct two to three controlled experiments on your own data to compare the validation loss of different N/D combinations under the same compute before deciding the direction.

    III. From Small Model Experiments to Formal Training

    3.1 Four Stages

    A reproducible engineering path typically includes the following stages:

    1. Small model hyperparameter search: Train a series of models ranging from hundreds of millions to billions of parameters, scanning learning rates, batch sizes, and warmup steps, and record loss curves under different data volumes.
    2. Fitting and extrapolation: Fit data points using the common form L(N, D) = E + A/N^α + B/D^β, hold out a portion of data points for validation, and record extrapolation errors.