⚡ Pretraining and Fine-tuning in Miniature

Emma's iceberg: a huge pretraining phase under the water and a small fine-tuning phase on top. This notebook reproduces the two phases with a tiny GPT: it is pretrained on discharge sheets and clinical notes about 16 diagnoses, and then fine-tuned to answer questions with examples about only 10 of them. The questions about the other 6 show what the fine-tuned model takes from pretraining.

The interactive notebook includes:

  • A pretraining corpus with no questions and no answers.
  • What the pretrained model knows, and why it does not answer questions.
  • 50 question-answer pairs for instruction tuning.
  • Fine-tuning with questions only, and the forgetting it causes.
  • Fine-tuning mixed with pretraining text (replay).
  • The same questions trained from scratch: what pretraining contributes.

Want to modify the code and experiment on your own?
Open the notebook in Google Colab

Bibliography