Fast, Effective, and Self-Supervised: Transforming Masked Language Models into Universal Lexical and Sentence Encoders

Pretrained Masked Language Models (MLMs) have revolutionised NLP in recent years. However, previous work has indicated that off-the-shelf MLMs are not effective as universal lexical or sentence encoders without further task-specific fine-tuning on NLI, sentence similarity, or paraphrasing tasks using annotated task data... In this work, we demonstrate that it is possible to turn MLMs into effective universal lexical and sentence encoders even without any additional data and without any supervision. We propose an extremely simple, fast and effective contrastive learning technique, termed Mirror-BERT, which converts MLMs (e.g., BERT and RoBERTa) into such encoders in 20-30 seconds without any additional external knowledge. Mirror-BERT relies on fully identical or slightly modified string pairs as positive (i.e., synonymous) fine-tuning examples, and aims to maximise their similarity during identity fine-tuning. We report huge gains over off-the-shelf MLMs with Mirror-BERT in both lexical-level and sentence-level tasks, across different domains and different languages. Notably, in the standard sentence semantic similarity (STS) tasks, our self-supervised Mirror-BERT model even matches the performance of the task-tuned Sentence-BERT models from prior work. Finally, we delve deeper into the inner workings of MLMs, and suggest some evidence on why this simple approach can yield effective universal lexical and sentence encoders. read more

PDF Abstract EMNLP 2021 PDF EMNLP 2021 Abstract
Task Dataset Model Metric Name Metric Value Global Rank Result Benchmark
Semantic Textual Similarity SICK Mirror-RoBERTa-base (unsup.) Spearman Correlation 0.706 # 11
Semantic Textual Similarity SICK Mirror-BERT-base (unsup.) Spearman Correlation 0.703 # 12
Semantic Textual Similarity STS12 Mirror-RoBERTa-base (unsup.) Spearman Correlation 0.648 # 10
Semantic Textual Similarity STS12 Mirror-BERT-base (unsup.) Spearman Correlation 0.674 # 8
Semantic Textual Similarity STS13 Mirror-BERT-base (unsup.) Spearman Correlation 0.796 # 9
Semantic Textual Similarity STS13 Mirror-RoBERTa-base (unsup.) Spearman Correlation 0.819 # 7
Semantic Textual Similarity STS14 Mirror-BERT-base (unsup.) Spearman Correlation 0.713 # 9
Semantic Textual Similarity STS14 Mirror-RoBERTa-base (unsup.) Spearman Correlation 0.732 # 8
Semantic Textual Similarity STS15 Mirror-RoBERTa-base (unsup.) Spearman Correlation 0.798 # 10
Semantic Textual Similarity STS15 Mirror-BERT-base (unsup.) Spearman Correlation 0.814 # 8
Semantic Textual Similarity STS16 Mirror-BERT-base (unsup.) Spearman Correlation 0.743 # 10
Semantic Textual Similarity STS16 Mirror-RoBERTa-base (unsup.) Spearman Correlation 0.78 # 6
Semantic Textual Similarity STS Benchmark Mirror-BERT-base (unsup.) Spearman Correlation 0.764 # 27
Semantic Textual Similarity STS Benchmark Mirror-RoBERTa-base (unsup.) Spearman Correlation 0.787 # 22

Methods