Skip to main content
QUICK REVIEW

[Paper Review] What Would Elsa Do? Freezing Layers During Transformer Fine-Tuning

Jaejun Lee, Raphael Tang|arXiv (Cornell University)|Nov 8, 2019
Topic ModelingComputer Science25 references34 citations
TL;DR

The paper investigates how many of the final layers of pretrained transformer models (BERT and RoBERTa) must be fine-tuned to achieve near-full performance, finding that about a quarter of the last layers suffice for 90% quality across many tasks, with some exceptions.

ABSTRACT

Pretrained transformer-based language models have achieved state of the art across countless tasks in natural language processing. These models are highly expressive, comprising at least a hundred million parameters and a dozen layers. Recent evidence suggests that only a few of the final layers need to be fine-tuned for high quality on downstream tasks. Naturally, a subsequent research question is, "how many of the last layers do we need to fine-tune?" In this paper, we precisely answer this question. We examine two recent pretrained language models, BERT and RoBERTa, across standard tasks in textual entailment, semantic similarity, sentiment analysis, and linguistic acceptability. We vary the number of final layers that are fine-tuned, then study the resulting change in task-specific effectiveness. We show that only a fourth of the final layers need to be fine-tuned to achieve 90% of the original quality. Surprisingly, we also find that fine-tuning all layers does not always help.

Motivation & Objective

  • Determine how many of the final layers in BERT and RoBERTa need to be fine-tuned to maintain high performance on standard NLP tasks.
  • Quantify the relationship between the number of fine-tuned layers and task performance across multiple datasets.
  • Identify any tasks where fine-tuning fewer layers or all layers yields best results.

Proposed method

  • Fine-tune BERT and RoBERTa variants (BASE and LARGE) while freezing the embeddings and increasing numbers of initial layers frozen (N = L/2 to L).
  • Evaluate on GLUE tasks: CoLA, SST-2, MRPC, STS-B, QQP, MNLI, QNLI, RTE.
  • Use Adam optimizer with batch size 16; perform task-specific hyperparameter line searches for learning rate in [1e-5, 5e-5].
  • Compare performance when freezing none, some, or all nonoutput layers; report relative gains vs. full-model fine-tuning.
  • Analyze per-layer contribution by observing performance as more layers are unfrozen; identify diminishing returns and potential overparameterization in SST-2.

Experimental results

Research questions

  • RQ1How many of the final transformer layers must be fine-tuned to achieve a target fraction (e.g., 90%) of full-model performance?
  • RQ2Does freezing earlier layers yield consistent performance across tasks and model sizes (BASE vs LARGE)?
  • RQ3Are there tasks where not fine-tuning all layers can improve or degrade performance relative to full fine-tuning?
  • RQ4What is the shape of performance gains as a function of the number of unfrozen layers?

Key findings

  • Only about a fourth of the final layers need to be fine-tuned to achieve around 90% of full-model quality on most tasks.
  • On SST-2, not fine-tuning all layers can improve quality compared to full fine-tuning.
  • Fine-tuning all layers does not always help and can yield worse performance on some tasks.
  • Diminishing returns are observed as more layers are unfrozen; half the network often suffices to approach full performance, with larger models showing similar trends.
  • Large variants (BASE vs LARGE) show that freezing 12–16 layers can yield consistent gains on certain tasks, suggesting overparameterization in some cases.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.