Fine-Tuning Pretrained Language Models: Weight Initializations, Data Orders, and Early Stopping
By Jesse Dodge, Gabriel Ilharco, Roy Schwartz, Ali Farhadi, Hannaneh Hajishirzi, Noah A. Smith. 2020
739 citations recorded by the source corpus.
Fine-tuning pretrained contextual word embedding models to supervised downstream tasks has become commonplace in natural language processing. This process, however, is often brittle: even with the same hyperparameter values, distinct random seeds can lead to substantially different results. To better understand this phenomenon, we experiment with four datasets from the GLUE benchmark, fine-tuning BERT hundreds of times on each while varying only the random seeds. We find substantial performance increases compared to previously reported results, and we quantify how the performance of the best-found model varies as a function of the number of fine-tuning trials. Further, we examine two factors influenced by the choice of random seed: weight initialization and training data order. We find that both contribute comparably to the variance of out-of-sample performance, and that some weight initializations perform well across all tasks explored. On small datasets, we observe that many fine-tuning trials diverge part of the way through training, and we offer best practices for practitioners to stop training less promising runs early. We publicly release all of our experimental data, including training and validation scores for 2,100 trials, to encourage further analysis of training dynamics during fine-tuning.
Subfields: Artificial Intelligence, Large Language Models, Optimization & Training
How researchers see this paper
The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.
In Artificial Intelligence
- Mohit Bansal
- Luke S. Zettlemoyer
- Yejin Choi
- Percy Liang
- Noah A. Smith
- Hannaneh Hajishirzi
- Graham Neubig
- Jianfeng Gao
In Large Language Models
- Hinrich Schütze
- Luke S. Zettlemoyer
- Yejin Choi
- Timo Schick
- Hannaneh Hajishirzi
- Mohit Bansal
- Noah A. Smith
- Graham Neubig
In Optimization & Training
- Steven Bethard
- Quoc V. Le
- Mohit Bansal
- Hinrich Schütze
- Timo Schick
- Ali Farhadi
- Aaron C. Courville
- Yoshua Bengio
Citations in the corpus
- Carbon Emissions and Large Neural Network Training (2021, background): “● Fine-tuning and transfer learning both reuse already-trained representations, rather than starting training of each NLP task’s parameters from random initialization, for example [Dod20].”
- Understanding Dataset Difficulty with V-Usable Information (2021, neutral): “More-over, despite the performance of Transformer-based models varying across random initializations (Dodge et al., 2019; 2020; Mosbach et al., 2020), we find that PVI estimates are quite stable: the correlation across seeds is r > 0 .”
- Learning to summarize from human feedback (2020, background): “We also sweep over between 3 and 10 seeds, and choose the reward model that performs best on the development portion of the validation set, as we find that both the data iteration order and reward head initialization affect results [13].”
- Cutting Down on Prompts and Parameters: Simple Few-Shot Learning with Language Models (2021, methodology): “Since transformers’ performance in few-shot settings can be highly dependent on weight initialization (Dodge et al., 2020), we initialize the weights with 10 different random seeds and report the mean and variance of the model performance.”
- How many data points is a prompt worth? (2021, background): “2 In line with previous observations (McCoy et al., 2019; Dodge et al., 2020; Lee et al., 2020), head-based fine-tuning performance varies considerably.”
- Making Pre-trained Language Models Better Few-shot Learners (2021, methodology): “from instability (Dodge et al., 2020; Zhang et al., 2021), and results may change dramatically given a new split of data.”
- It’s Not Just Size That Matters: Small Language Models Are Also Few-Shot Learners (2020, positive): “effective means of reducing finetuning instability (Dodge et al., 2020).”
- RuleBERT: Teaching Soft Rules to Pre-Trained Language Models (2021, background): “This usually happens with small training datasets (Dodge et al., 2020; Mosbach et al., 2021).”
- Pre-train, Prompt, and Predict: A Systematic Survey of Prompting Methods in Natural Language Processing (2021, methodology): “This is a simple, powerful, and widely-used method, but it may overit or not learn stably on small datasets [21].”
- True Few-Shot Learning with Language Models (2021, methodology): “This result may be due to the fact that we retrain the model using the CV-chosen hyperparameters, but finetuning pretrained LMs often has high variance in performance [68, 81].”
- Compacter: Efficient Low-Rank Hypercomplex Adapter Layers (2021, background): “Additionally, fine-tuning of over-parameterized models on low-resource datasets has been shown to be subject to instabilities and may lead to poor performance [6, 7].”
- Model soups: averaging weights of multiple fine-tuned models improves accuracy without increasing inference time (2022, methodology): “…four text classification tasks from the GLUE benchmark (Wang et al., 2018): MRPC (Dolan and Brockett, 2005), RTE (Dagan et al., 2005; Bar-Haim et al., 2006; Giampic-colo et al., 2007; Bentivogli et al., 2009), CoLA (Warstadt et al., 2019) and SST-2 (Socher et al., 2013), as in (Dodge et al., 2020).”
- Do Transformer Modifications Transfer Across Implementations and Applications? (2021, methodology): “It is a well-established fact in deep learning that hyperparameters (and even random seeds (Dodge et al., 2020)) may have a huge impact on model quality.”
- A Primer in BERTology: What We Know About How BERT Works (2020, methodology): “Dodge et al. (2020) report significant variation for BERT fine-tuned on GLUE tasks, where both weight initialization and training data order contribute to the variation.”
- Eliciting Knowledge from Language Models Using Automatically Generated Prompts (2020, background): “Furthermore, results for RoBERTa are more stable across all sample sizes whereas finetuning can result in “failed runs” (consistent with Dodge et al. 2020).”
- On the Stability of Fine-tuning BERT: Misconceptions, Explanations, and Strong Baselines (2020, methodology): “Fine-tuning on CoLA was observed to be particularly stable in previous work (Phang et al., 2018; Dodge et al., 2020; Lee et al., 2020).”
- Better Fine-Tuning by Reducing Representational Collapse (2020, background): “However, fine-tuning them for each task has been shown to be a highly unstable process, with many hyperparmeter settings producing failed fine-tuning runs, unstable results (large variation between random seeds), over-fitting and other unwanted consequences (Zhang et al., 2020; Dodge et al., 2020).”