Scaling Laws for Transfer

Danny Hernandez, Jared Kaplan, Tom Henighan, Sam McCandlisharXiv 2021

Abstract

Transfer learning has become the standard for training large-scale models, yet its benefits have remained largely qualitative. This paper introduces a rigorous framework for quantifying transfer learning using "Effective Data Transferred" ($D_T$). By analyzing Transformer models across several orders of magnitude, the authors demonstrate that transfer learning follows predictable power-law scaling. Pre-training acts as a significant data multiplier, particularly in low-data regimes, where it can provide performance boosts equivalent to orders of magnitude more fine-tuning data.

Introduction

The "pre-train then fine-tune" paradigm, exemplified by models like BERT and GPT, is central to modern AI. However, a fundamental question remains: exactly how much does pre-training help? Historically, we lacked a mathematical way to equate pre-training on general text to specific gains on a target task, such as coding in Python. This research moves transfer learning toward a predictable science by establishing the mathematical laws governing model size, fine-tuning dataset size, and distribution similarity.

Quantifying Transfer: Effective Data Transferred

The researchers trained Transformers ranging from small models to those with billions of parameters. They compared three training paths: training from scratch on Python, pre-training on natural language then fine-tuning on Python, and pre-training on a mixture of text and non-Python code before fine-tuning.

To quantify the benefit of pre-training, the authors introduced the metric Effective Data Transferred ($D_T$). As illustrated in Figure 1, $D_T$ represents the amount of additional data a model trained from scratch would require to match the performance of a pre-trained model of the same size. This allows transfer to be measured in units of "data," providing a clear "data multiplier" effect.

Figure 1: Visualizing Effective Data Transferred ($D_T$). The pre-trained model (blue) achieves lower test loss with the same amount of fine-tuning data ($D_F$) compared to a model trained from scratch (orange). $D_T$ quantifies this performance gap in terms of equivalent data.

The Power-Laws of Transfer

The study reveals that in low-data regimes, the effective data transferred follows a clean power-law: $$D_T = k(D_F)^\alpha (N)^\beta$$ where $N$ is the number of model parameters and $D_F$ is the size of the fine-tuning dataset.

Key insights from this scaling behavior include:

  • Distribution Proximity ($\alpha$): The exponent $\alpha$ measures the similarity between the pre-training and fine-tuning distributions. A smaller $\alpha$ indicates more similar distributions, where the benefits of pre-training persist even as more fine-tuning data is added.
  • Model Generality ($\beta$): The exponent $\beta$ (approximately 0.38) remained remarkably constant across different pre-training mixtures. This suggests that $\beta$ may be an intrinsic property of the Transformer architecture's ability to generalize.
  • The Data Multiplier: For smaller datasets, pre-training can be equivalent to having 1,000x more target-task data. For example, GPT-3's zero-shot Python performance is estimated to be equivalent to training a model from scratch on 370 million characters of Python.
Figure 4: Scaling of the fraction of effective data from transfer ($D_T/D_E$) as a function of model parameters and fine-tuning data size ($D_F$). The left panel shows transfer from text to Python, while the right shows transfer from a text/code mixture to Python.

Ossification and Efficiency

While pre-training is highly beneficial when data is scarce, the authors identified a "high-data" trap known as ossification. If the fine-tuning dataset is massive, a pre-trained model may eventually be outperformed by a model trained from scratch. The model becomes "stuck" in the patterns of its pre-training distribution, limiting its ultimate adaptation to the new task.

Despite this, fine-tuning remains significantly more compute-efficient in most practical scenarios. The performance gap between pre-trained and from-scratch models widens as models scale, making transfer learning an essential component of efficient AI development.

Conclusion

By establishing these scaling laws, the authors provide a roadmap for more efficient model training. These laws allow researchers to predict the ideal pre-training mix for a target task through small-scale experiments. Future work may extend these findings to other architectures like CNNs or explore scaling in supervised and reinforcement learning contexts.

Summary updated

BibTeX
@misc{hernandez2021scaling,
  author = {Danny Hernandez and Jared Kaplan and Tom Henighan and Sam McCandlish},
  title = {{Scaling Laws for Transfer}},
  year = {2021},
  eprint = {2102.01293},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2102.01293},
}
Figure