[Paper Review] Supervised Contrastive Learning for Pre-trained Language Model Fine-tuning
The paper adds a supervised contrastive learning term to the standard cross-entropy fine-tuning objective for pre-trained language models, improving few-shot performance and robustness on GLUE tasks without extra data or architectures.
State-of-the-art natural language understanding classification models follow two-stages: pre-training a large language model on an auxiliary task, and then fine-tuning the model on a task-specific labeled dataset using cross-entropy loss. However, the cross-entropy loss has several shortcomings that can lead to sub-optimal generalization and instability. Driven by the intuition that good generalization requires capturing the similarity between examples in one class and contrasting them with examples in other classes, we propose a supervised contrastive learning (SCL) objective for the fine-tuning stage. Combined with cross-entropy, our proposed SCL loss obtains significant improvements over a strong RoBERTa-Large baseline on multiple datasets of the GLUE benchmark in few-shot learning settings, without requiring specialized architecture, data augmentations, memory banks, or additional unsupervised data. Our proposed fine-tuning objective leads to models that are more robust to different levels of noise in the fine-tuning training data, and can generalize better to related tasks with limited labeled data.
Motivation & Objective
- Motivate addressing generalization gaps and instability in cross-entropy fine-tuning under limited labeled data.
- Introduce a supervised contrastive learning (SCL) term tailored for labeled NLP tasks.
- Demonstrate that combining CE with SCL improves robustness to noisy labels and transfers better to related tasks.
- Show that SCL-based fine-tuning yields better few-shot results across SST-2, QNLI, and MNLI on GLUE.
Proposed method
- Define a joint loss L = (1 - lambda) * L_CE + lambda * L_SCL with a temperature tau and l2-normalized features.
- Compute L_SCL by pulling same-class examples together and pushing different-class examples apart within a batch (-equations (3)).
- Use the [CLS] token embedding as the representation for each example and fine-tune RoBERTa-Large on GLUE tasks.
- Perform a grid search over lambda in {0.1,0.3,0.5,0.7,0.9,1.0} and tau in {0.1,0.3,0.5,0.7}, with tau = 0.3 and lambda = 0.9 often yielding best results.
- Explore robustness by creating augmented noisy training data via back-translation with varied temperature T (Section 4.2).
- Benchmark on GLUE with both few-shot and full-data experiments using RoBERTa-Large, reporting mean and std across seeds.
Experimental results
Research questions
- RQ1Does incorporating a supervised contrastive loss in fine-tuning improve few-shot NLP classification performance?
- RQ2Is the SCL objective more robust to label noise and data augmentations than standard cross-entropy?
- RQ3Does SCL improve generalization to related tasks when labeled data is scarce?
- RQ4How does batch size affect performance and training speed when using CE+SCL?
- RQ5Can SCL enhance transferability of task-specific models to related domains?
Key findings
- In 20-shot settings, CE+SCL improves SST-2, QNLI, MNLI over CE baseline by up to 2.2–10.7 points depending on task and data size.
- In full GLUE experiments, CE+SCL yields average improvement around 1.2 points over RoBERTa-Large CE baseline across six tasks (significant for MRPC and QNLI).
- CE+SCL shows robustness to noisy augmented data, with average gains of 0.4–7.0 points across noise levels and higher gains on harder tasks (MNLI, QNLI).
- Hard negatives via temperature scaling (tau) and l2 normalization contribute to improved clustering of same-class instances in representations (tSNE evidence).
- CE+SCL improves cross-domain generalization: SST-2-trained models transfer better to Amazon-2 and Yelp-2 with fewer labeled examples.
- Increasing batch size amplifies the benefits of CE+SCL and affects training speed (updates per second) more noticeably at larger batches.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.