Skip to main content
QUICK REVIEW

[Paper Review] On Robustness of Finetuned Transformer-based NLP Models

Pavan Kalyan Reddy Neerudu, Subba Reddy Oota|arXiv (Cornell University)|May 23, 2023
Topic ModelingComputer Science3 citations
TL;DR

This paper investigates the robustness of finetuned Transformer models (BERT, GPT-2, T5) to input text perturbations using CKA and STIR to analyze representation changes across layers. GPT-2 shows superior robustness compared to BERT and T5, with noun/verb dropping and character-level changes being the most disruptive perturbations.

ABSTRACT

Transformer-based pretrained models like BERT, GPT-2 and T5 have been finetuned for a large number of natural language processing (NLP) tasks, and have been shown to be very effective. However, while finetuning, what changes across layers in these models with respect to pretrained checkpoints is under-studied. Further, how robust are these models to perturbations in input text? Does the robustness vary depending on the NLP task for which the models have been finetuned? While there exists some work on studying the robustness of BERT finetuned for a few NLP tasks, there is no rigorous study that compares this robustness across encoder only, decoder only and encoder-decoder models. In this paper, we characterize changes between pretrained and finetuned language model representations across layers using two metrics: CKA and STIR. Further, we study the robustness of three language models (BERT, GPT-2 and T5) with eight different text perturbations on classification tasks from the General Language Understanding Evaluation (GLUE) benchmark, and generation tasks like summarization, free-form generation and question generation. GPT-2 representations are more robust than BERT and T5 across multiple types of input perturbation. Although models exhibit good robustness broadly, dropping nouns, verbs or changing characters are the most impactful. Overall, this study provides valuable insights into perturbation-specific weaknesses of popular Transformer-based models, which should be kept in mind when passing inputs. We make the code and models publicly available [https://github.com/PavanNeerudu/Robustness-of-Transformers-models].

Motivation & Objective

  • To understand how finetuning alters representation similarity between pretrained and finetuned Transformer models across layers.
  • To evaluate the robustness of finetuned BERT, GPT-2, and T5 to diverse text perturbations across classification and generation tasks.
  • To identify which types of input perturbations most significantly degrade model performance and whether robustness varies by model architecture or task.
  • To determine whether specific layers are consistently more vulnerable across models, indicating shared invariances or linguistic sensitivities.

Proposed method

  • Employed Centered Kernel Alignment (CKA) to measure representation similarity between pretrained and finetuned models across layers.
  • Applied Similarity Through Inverted Representations (STIR) to quantify shared invariances to perturbations across models.
  • Evaluated model performance under eight distinct text perturbations: synonym replacement, word dropping, character swapping, sentence shuffling, and others.
  • Conducted layer-wise analysis using hidden states from [CLS] token (BERT), last token (GPT-2), and decoder outputs (T5) to identify most affected layers.
  • Trained logistic regression models on hidden states to predict labels and measured performance drop under perturbations.
  • Compared robustness across GLUE benchmark tasks (classification) and generation tasks (summarization, question generation, free-form generation).
(a) CoLA
(a) CoLA

Experimental results

Research questions

  • RQ1How does finetuning affect representation similarity between pretrained and finetuned models across different layers?
  • RQ2Which types of text perturbations most significantly degrade the performance of finetuned Transformer models?
  • RQ3Does the robustness of BERT, GPT-2, and T5 vary depending on the NLP task (e.g., classification vs. generation) or model architecture?
  • RQ4Are there specific layers that are consistently more sensitive to perturbations across different models and tasks?

Key findings

  • The last layers of finetuned models are more affected by finetuning than earlier layers, indicating greater representation adaptation in deeper layers.
  • GPT-2 exhibits greater robustness than BERT and T5 across multiple perturbation types, particularly in generation tasks.
  • Dropping nouns or verbs and changing characters have the most significant negative impact on model performance, regardless of model or task.
  • Certain layers are consistently affected across models and tasks, suggesting shared sensitivity to linguistic features like syntax and semantics.
  • Perturbations involving context changes (e.g., sentence shuffling) affect multiple layers, indicating distributed contextual representation learning.
  • T5 shows a performance increase in early decoder layers post-perturbation, suggesting that initial layers may be less sensitive or more stable in the decoder architecture.
(b) SST-2
(b) SST-2

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.