Model card for PM-AI/sts_paraphrase_xlm-roberta-base_de-en
Model summary
Transformer model for Semantic Textual Similarity (STS) for German and Englisch sentences/texts. The embeddings output can be used for semantic search, paraphrasing and retrieval with cosine similarity. The Model is applicable to Englisch-German-Mixed sentences/texts but also for Englisch only and German only.
The model can be easily used with Sentence Transformer library.
Training
This model is based on a training approach from 2020 by Philip May, who published the T-Systems-onsite/cross-en-de-roberta-sentence-transformer model. We updated this approach by a new base model for fine-tuning and some extensions to the training data. These changes are discussed in the next sections.
Training Data
The model is based on training with samples from STSb, SICK and Priya22 semantic textual relatedness datasets. They contain about 76.000 sentence pairs in total. These sentence pairs are based on German-German, English-English and German-English mixed. The training object is to optimize for cosine similarity loss based on a human annoted sentence similarity score. In terms of content, the samples are based on rather simple sentences.
When the TSystems model was published, only the STSb dataset was used for STS training. Therefore it is included in our model, but expanded to include SICK and Priya22 semantic textual relatedness:
- SICK was partly used in STSb, but our custom translation using DeepL leads to slightly different phrases. This approach allows more examples to be included in the training.
- The Priya22 semantic textual relatedness dataset published in 2022 was also translated into German via DeepL and added to the training data. Since it does not have a train-test-split, it was created independently at a ratio of 80:20.
All training and test data (STSb, Sick, Priya22) were checked for duplicates within and with each other and removed if found. Because the test data is prioritized, duplicated entries between test-train are exclusively removed from train split. The final used datasets can be viewed here: datasets_sts_paraphrase_xlm-roberta-base_de-en
Training
Befor fine-tuning for STS we made the English paraphrasing model paraphrase-distilroberta-base-v1 usable for German by applying Knowledge Distillation (Teacher-Student approach). The TSystems model used version 1, which is based on 7 different datasets and contains around 24.6 million samples. We are using version 2 with 12 datasets and about 83.3 million examples. Details for this process here: PM-AI/paraphrase-distilroberta-base-v2_de-en
For fine-tuning we are using SBERT's training_stsbenchmark_continue_training.py training script. One thing has been changed in this training script: when a sentence pair consists of identical utterances the score is set to 5.0 (maximum). It makes no sense to say identical sentences have a score of 4.8 or 4.9.
Parameterization of training
- Script: training_stsbenchmark_continue_training.py
- Datasets: datasets_sts_paraphrase_xlm-roberta-base_de-en/all_cross_train_unique.csv
- GPU: NVIDIA A40 (Driver Version: 515.48.07; CUDA Version: 11.7)
- Batch Size: 32
- Base Model: PM-AI/paraphrase-distilroberta-base-v2_de-en
- Loss Function: Cosine Similarity
- Learning Rate: 2e-5
- Epochs: 3
- Evaluation Samples: 500
- Evaluation Steps: 1000
- Warmup Steps: 10%
Evaluation
Now the performance is measured cross-lingually as well as for German and English only. In addition, the test samples used are evaluated individually for each data set (STSb, SICK, Priya22), as well as in a large combined test data set (all). This subdivision per data set allows for a fair overall assessment, since external models are not built on the same data basis as the model presented here. The data is not evenly distributed in either training or testing!
❗Some models are only usable for one language (because they are monolingual). They will almost not perform at all in the other two tables. Still, they are good models in certain applications❗
The first table shows the evaluation results for cross-lingual (German-English-Mixed) based on Spearman:
The second table shows the evaluation results for German only based on Spearman:
And last but not least our third table which shows the evaluation results for English only based on Spearman:
❗It is crucial to understand that:
- Only our model has seen training data from STSb, SICK and Priya22 combined, which is one reason for better results. The model has simply been trained to be more sensitive to these type of samples.
- The datasets are not proportionally aligned in terms of their number of examples. For example, Priya22 is significantly underrepresented.
- The compared models are of different sizes, which affects resource consumption (CPU, RAM) and inference speed (benchmark). So-called "large" models usually perform better, but also cost more (resources, monetary value) than e.g. "base" models.
- Multilingual models are usually made multilingual by Knowledge Distillation, starting from a monolingual state. Therefore, they usually perform somewhat better in the original language.
Acknowledgment
This work is a collaboration between Technical University of Applied Sciences Wildau (TH Wildau) and sense.ai.tion GmbH. You can contact us via:
- Philipp Müller (M.Eng.); Author
- Prof. Dr. Janett Mohnke; TH Wildau
- Dr. Matthias Boldt, Jörg Oehmichen; sense.AI.tion GmbH
This work was funded by the European Regional Development Fund (EFRE) and the State of Brandenburg. Project/Vorhaben: "ProFIT: Natürlichsprachliche Dialogassistenten in der Pflege".
- Downloads last month
- 15