Fast, Effective, and Self-Supervised: Transforming Masked Language Models into Universal Lexical and Sentence Encoders
About
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.
Related benchmarks
| Task | Dataset | Result | Rank | |
|---|---|---|---|---|
| Semantic Textual Similarity | STS tasks (STS12, STS13, STS14, STS15, STS16, STS-B, SICK-R) various (test) | STS12 Score69.1 | 393 | |
| Semantic Textual Similarity | STS tasks (STS12, STS13, STS14, STS15, STS16, STS-B, SICK-R) | STS12 Score68.15 | 195 | |
| Natural Language Understanding | GLUE (test dev) | MRPC Accuracy77.18 | 81 | |
| Semantic Textual Similarity | English STS | Average Score76.4 | 68 | |
| Transfer Learning | SentEval Transfer tasks (test) | MR76.72 | 23 | |
| Biomedical Entity Linking | NCBI | Acc@190.9 | 20 | |
| Biomedical Entity Linking | COMETA | Acc@160.3 | 20 | |
| Hate Speech Detection | HateWas v1 (test) | Macro F157.09 | 14 | |
| Emotion Detection | EmoMoham v1 (test) | Macro F1 Score78.27 | 14 | |
| Crisis Classification | CrisisOltea v1 (test) | Macro F195.79 | 14 |