Skip to content

Pretraining

Also called: pre-training, pretrained model, pre-trained model, pretrained models, pre-trained models

Published:

What does a model learn during pretraining?

No single task is taught at this stage. The goal is to pick up the general structure of language or data. BERT, introduced by Google in 2018, is a textbook case: it is pre-trained to learn deep bidirectional representations from unlabelled text [1]. It is then fine-tuned with just one extra output layer for tasks like question answering and language inference, and it set state-of-the-art results on eleven natural language processing tasks [1].

How is it different from fine-tuning?

The order and the scale differ. OpenAI's GPT-3 paper describes the standard recipe of the time as pre-training on a large corpus of text followed by fine-tuning on a specific task [2]. It also points out that this recipe still needs task-specific datasets of thousands or tens of thousands of examples [2].

GPT-3 itself is the concrete example. The 175-billion-parameter model was evaluated after pretraining without any gradient updates or fine-tuning, with the task and a few demonstrations given purely as a text prompt [2]. A large enough pretrained model could, for some tasks, be steered by the prompt alone rather than trained again.

Why is pretraining so expensive?

Pretraining trains all of a model's parameters on a very large dataset, and in GPT-3's case that meant 175 billion of them [2]. The compute bill is correspondingly large, so researchers look for ways to pretrain faster on the same budget. The Switch Transformer paper, for instance, reports up to 7x faster pre-training than T5-Base and T5-Large with the same compute [3].

Frequently asked questions

Can a pretrained model be used as is?

For some tasks, yes, but most production models go through further stages such as fine-tuning and instruction tuning.

Does pretraining need labelled data?

Usually not. As with BERT, the model learns from unlabelled text.

Sources

  1. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding — arXiv
  2. Language Models are Few-Shot Learners — arXiv
  3. Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity — arXiv