Abstract
Fine-tuning pre-trained language models (PLMs) like BERT and RoBERTa typically requires substantial labeled data to achieve high performance on downstream tasks. In many specialized domains, such data is scarce and expensive to obtain. This paper presents CSS-LM (Contrastive Semi-Supervised Language Model fine-tuning), a framework designed to enhance few-shot performance by leveraging massive open-domain corpora. CSS-LM employs an informative instance retrieval mechanism and a contrastive learning objective to "pull" similar semantic examples together and "push" dissimilar ones apart. Experimental results across six diverse classification datasets demonstrate that CSS-LM significantly outperforms standard fine-tuning and state-of-the-art supervised contrastive methods, particularly in extreme low-resource settings.
Introduction
While PLMs are pre-trained on billions of tokens, adapting them to specific tasks—such as sentiment analysis or relation extraction—remains a "data-hungry" process. In niche fields like medical or legal text analysis, human-labeled data is often a bottleneck. Standard fine-tuning in these "few-shot" scenarios frequently fails to capture subtle semantic nuances, leading to models that generalize poorly.
CSS-LM addresses this challenge by asking: How can we leverage the vast sea of unlabeled text on the internet to help a model learn a specific task better, without needing more human labels? The framework moves beyond traditional semi-supervised techniques like pseudo-labeling, which can be sensitive to noise, by focusing on the underlying semantic relationships between labeled and unlabeled instances.
Methodology
CSS-LM introduces a contrastive semi-supervised layer to the standard fine-tuning pipeline, built upon three primary pillars:
1. Informative Instance Retrieval
Rather than using random unlabeled text, CSS-LM retrieves "positive" and "negative" instances from large-scale corpora (e.g., Wikipedia) using a dual-metric approach:
- Domain-level similarity: Ensures the retrieved text originates from a similar field.
- Class-level similarity: Identifies text likely sharing the same underlying intent or sentiment as the labeled anchor.
2. Semantic Representation Learning
To facilitate high-level semantic capture, the input structure is modified by adding two special tokens: [DOMAIN] and [CLASS]. The model learns to use these tokens to represent the broad domain context and the specific task category, respectively.
3. Contrastive Semi-supervised Objective
During training, the model optimizes a joint objective: standard Cross-Entropy loss ($L_{CE}$) and a Contrastive Loss ($L_{CSS}$). This forces the model to ensure that a labeled example is mathematically close to retrieved unlabeled "positive" examples in the embedding space, while remaining distant from "negative" ones. This process helps the model define sharper, more accurate decision boundaries.
Experimental Setup
The framework was evaluated across six classification datasets:
- Sentiment: SemEval and SST-5.
- Intent (Scientific): SciCite and ACL-ARC.
- Relation (Scientific/Chemical): SciERC and ChemProt.
The unlabeled pool consisted of English Wikipedia and unused portions of the original training sets. Comparisons were made against standard fine-tuning and Supervised Contrastive Fine-tuning (SCF).
Results and Discussion
Few-Shot Performance
CSS-LM demonstrates clear dominance in low-resource settings. In experiments with only 16 labeled examples per class, CSS-LM outperformed standard fine-tuning by up to 7.8% and surpassed SCF methods by up to 7.1%. These results indicate that the strategic inclusion of unlabeled data is more effective than simply applying contrastive objectives to limited labeled sets.
Key Insights
- Class-level Semantics: Experiments revealed that matching specific task categories (class-level similarity) is significantly more impactful for retrieval than coarse domain-level matching.
- Decision Boundary Refinement: By incorporating "near-miss" negative examples from open-domain corpora, CSS-LM helps the model better distinguish the boundaries between classes, which are often "blurry" in standard few-shot fine-tuning.
- Robustness to Noise: Unlike pseudo-labeling, which relies on the accuracy of a model's guess, CSS-LM's contrastive approach relies on instance relationships, making it more resilient to noisy retrieval results.
Conclusion and Future Work
CSS-LM provides a robust framework for semi-supervised fine-tuning, significantly boosting PLM performance when labeled data is scarce. While highly effective, the authors note that the computational cost of retrieval and the potential for noise in massive corpora remain challenges. Future research will focus on more efficient "memory bank" updates and extending this contrastive framework to complex tasks beyond classification, such as Named Entity Recognition (NER) and text generation.
Summary updated