Introduction
Pre-trained language models like BERT and RoBERTa have revolutionized NLP by mastering word-level context through Masked Language Modeling (MLM). However, these models often struggle to produce high-quality sentence-level representations. The standard approach of using the [CLS] token frequently yields embeddings that are less effective than simple word-vector averaging. CLEAR (Contrastive LEArning for sentence Representation) addresses this gap by introducing a sentence-level objective that forces the model to learn noise-invariant representations.
The CLEAR Framework
CLEAR is inspired by SimCLR, adapting contrastive learning for the discrete nature of text. The framework generates two augmented versions of a sentence and trains the model to maximize the agreement between their representations while minimizing agreement with other sentences in the batch.
Augmentation Strategies
To create "noisy" versions of sentences, CLEAR employs four primary text augmentation techniques:
- Word Deletion: Randomly removing individual tokens.
- Span Deletion: Removing continuous blocks of text.
- Reordering: Swapping the positions of text spans.
- Synonym Substitution: Replacing words with their semantic equivalents.
The model is trained on a joint objective: $L_{total} = L_{MLM} + L_{CL}$. This dual approach ensures the model maintains its word-level understanding while simultaneously refining its sentence-level "big picture" view.
Experimental Setup
The models were pre-trained from scratch on BookCorpus and English Wikipedia. Evaluation was conducted across two major benchmarks:
- GLUE: Assessing general language understanding across tasks like sentiment analysis and entailment.
- SentEval: Specifically focusing on Semantic Textual Similarity (STS) to measure the quality of sentence embeddings.
Key Results
CLEAR demonstrated significant improvements over baseline models. On the GLUE benchmark, CLEAR outperformed RoBERTa-base by an average of 2.2%, with notable gains in linguistic acceptability (CoLA) and natural language inference (RTE).
In semantic similarity tasks (STS), CLEAR achieved a +5.7% absolute improvement over RoBERTa-base. These results suggest that the contrastive objective effectively "fixes" the [CLS] token, transforming it into a robust summary of sentence meaning.
Conclusion
By combining word-level MLM with a sentence-level contrastive objective, CLEAR provides a more holistic approach to language model pre-training. While challenges remain regarding hyperparameter sensitivity and the complexity of augmentations, CLEAR establishes a strong foundation for learning high-quality sentence representations without requiring massive input documents or specialized architectures.
Summary updated