ElemedexA pocket encyclopedia of AI architectures

Glossary (TM) › Training and tuning

TM143

Transfer learning

Also: transfer

In Spanish: Aprendizaje por transferencia

Reusing what a model learned on one task or dataset to solve another task, instead of training from scratch.

Transfer learning starts from a simple idea: what is learned on one problem helps with another. In its most elementary form, the intermediate representations of an already trained model are reused as the starting point of a new one (what Keras calls feature extraction) (Chollet, 2021, sec. 7.2.2). The first layers of a vision network detect edges and textures useful for almost any image; the first layers of a language model, regularities of the language useful for almost any text.

Between 2018 and 2020 this idea reorganized language processing: one expensive round of pretraining, then many cheap rounds of fine-tuning, one per task (Alammar & Grootendorst, 2024, p. 19). BERT, GPT-1 and T5 follow the recipe; the T5 paper puts the word in its title and systematically compares its variants (Raffel et al., 2020). Kaplan et al. (2020) also observed that when a model is evaluated on text from a different distribution, performance drops by a roughly constant amount but improves at the same pace as on the training distribution (2020, sec. 1.1). With GPT-3, transfer moves into the prompt: the model adapts to new tasks without changing its weights, through in-context learning (Brown et al., 2020, sec. 2).

Philosophically, transfer is the everyday face of generalization, and therefore of induction. Chollet (2019) distinguishes local generalization (new cases from a known distribution), broad generalization (new tasks within a category) and extreme generalization (tasks that share only abstract features with what is known) (2019, sec. I.3.2). Which rung is reached when a model goes from "predict the next word" to classifying reviews or translating? The answer depends on how much of the new task was already, implicitly, in the corpus.

Sources

  • Alammar, J., & Grootendorst, M. (2024). Hands-on large language models: Language understanding and generation. O’Reilly Media. §
  • Brown, T. B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., Agarwal, S., Herbert-Voss, A., Krueger, G., Henighan, T., Child, R., Ramesh, A., Ziegler, D. M., Wu, J., Winter, C., . . . Amodei, D. (2020). Language models are few-shot learners. In Advances in Neural Information Processing Systems (Vol. 33, pp. 1877–1901). Curran Associates. https://proceedings.neurips.cc/paper_files/paper/2020/hash/1457c0d6bfcb4967418bfb8ac142f64a-Abstract.html §
  • Chollet, F. (2019). On the measure of intelligence (arXiv:1911.01547). arXiv. https://doi.org/10.48550/arXiv.1911.01547 §
  • Chollet, F. (2021). Deep learning with Python (2nd ed.). Manning Publications. §
  • Kaplan, J., McCandlish, S., Henighan, T., Brown, T. B., Chess, B., Child, R., Gray, S., Radford, A., Wu, J., & Amodei, D. (2020). Scaling laws for neural language models (arXiv:2001.08361). arXiv. https://doi.org/10.48550/arXiv.2001.08361 §
  • Raffel, C., Shazeer, N., Roberts, A., Lee, K., Narang, S., Matena, M., Zhou, Y., Li, W., & Liu, P. J. (2020). Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21(140), 1–67. https://jmlr.org/papers/v21/20-074.html §