MMLW (muszę mieć lepszą wiadomość) are neural text encoders for Polish.
This is a distilled model that can be used to generate embeddings applicable to many tasks such as semantic similarity, clustering, information retrieval. The model can also serve as a base for further fine-tuning.
It transforms texts to 768 dimensional vectors.
The model was initialized with Polish RoBERTa checkpoint, and then trained with
multilingual knowledge distillation method on a diverse corpus of 60 million Polish-English text pairs. We utilised
English FlagEmbeddings (BGE) as teacher models for distillation.
⚠️ Our embedding models require the use of specific prefixes and suffixes when encoding texts. For this model, each query should be preceded by the prefix "zapytanie: " ⚠️
You can use the model like this with
sentence-transformers:
1from sentence_transformers import SentenceTransformer
2from sentence_transformers.util import cos_sim
3
4query_prefix = "zapytanie: "
5answer_prefix = ""
6queries = [query_prefix + "Jak dożyć 100 lat?"]
7answers = [
8 answer_prefix + "Trzeba zdrowo się odżywiać i uprawiać sport.",
9 answer_prefix + "Trzeba pić alkohol, imprezować i jeździć szybkimi autami.",
10 answer_prefix + "Gdy trwała kampania politycy zapewniali, że rozprawią się z zakazem niedzielnego handlu."
11]
12model = SentenceTransformer("sdadas/mmlw-roberta-base")
13queries_emb = model.encode(queries, convert_to_tensor=True, show_progress_bar=False)
14answers_emb = model.encode(answers, convert_to_tensor=True, show_progress_bar=False)
15
16best_answer = cos_sim(queries_emb, answers_emb).argmax().item()
17print(answers[best_answer])
18# Trzeba zdrowo się odżywiać i uprawiać sport.
This model was trained with the A100 GPU cluster support delivered by the Gdansk University of Technology within the TASK center initiative.
1@inproceedings{dadas2024pirb,
2 title={PIRB: A Comprehensive Benchmark of Polish Dense and Hybrid Text Retrieval Methods},
3 author={Dadas, Slawomir and Pere{\l}kiewicz, Micha{\l} and Po{\'s}wiata, Rafa{\l}},
4 booktitle={Proceedings of the 2024 Joint International Conference on Computational Linguistics, Language Resources and Evaluation (LREC-COLING 2024)},
5 pages={12761--12774},
6 year={2024}
7}