This is an embedding model based on
stella_en_1.5B_v5
and further fine-tuned for retrieval tasks in Polish. It transforms texts into 1024-dimensional vectors. The model training consisted of two stages:
In the first stage, we adapted the model to support the Polish language using the
multilingual knowledge distillation method
method, leveraging a diverse corpus of 20 million Polish-English text pairs.
The original Stella model and the output of the first stage were limited to a short context of 512 tokens. In the second stage, we extended the context to 8192 tokens and then fine-tuned the model using contrastive loss on a dataset comprising 1.5 million queries. Positive and negative passages for each query have been selected with the help of
BAAI/bge-reranker-v2.5-gemma2-lightweight
reranker. The model was trained for three epochs with a batch size of 1024 queries.
For retrieval, queries should be prefixed with
"Instruct: Given a web search query, retrieve relevant passages that answer the query.\nQuery: "
.
For symmetric tasks such as semantic similarity, both texts should be prefixed with
"Instruct: Retrieve semantically similar text.\nQuery: "
.
Please note that the model uses a custom implementation, so you should add
trust_remote_code=True
argument when loading it.
You can use the model like this with
sentence-transformers
:
from sentence_transformers import SentenceTransformer
from sentence_transformers.util import cos_sim
model = SentenceTransformer(
"sdadas/stella-pl-retrieval-8k",
trust_remote_code=True,
device="cuda"
)
model.bfloat16()
# Retrieval example
query_prefix = "Instruct: Given a web search query, retrieve relevant passages that answer the query.\nQuery: "
queries = [query_prefix + "Jak dożyć 100 lat?"]
answers = [
"Trzeba zdrowo się odżywiać i uprawiać sport.",
"Trzeba pić alkohol, imprezować i jeździć szybkimi autami.",
"Gdy trwała kampania politycy zapewniali, że rozprawią się z zakazem niedzielnego handlu."
]
queries_emb = model.encode(queries, convert_to_tensor=True, show_progress_bar=False)
answers_emb = model.encode(answers, convert_to_tensor=True, show_progress_bar=False)
best_answer = cos_sim(queries_emb, answers_emb).argmax().item()
print(answers[best_answer])
# Semantic similarity example
sim_prefix = "Instruct: Retrieve semantically similar text.\nQuery: "
sentences = [
sim_prefix + "Trzeba zdrowo się odżywiać i uprawiać sport.",
sim_prefix + "Warto jest prowadzić zdrowy tryb życia, uwzględniający aktywność fizyczną i dietę.",
sim_prefix + "One should eat healthy and engage in sports.",
sim_prefix + "Zakupy potwierdzasz PINem, który bezpiecznie ustalisz podczas aktywacji."
]
emb = model.encode(sentences, convert_to_tensor=True, show_progress_bar=False)
print(cos_sim(emb, emb))
Evaluation Results
The model achieves
NDCG@10
of
62.69
on the Polish Information Retrieval Benchmark. See
PIRB Leaderboard
for detailed results.
Acknowledgements
The research was supported [in part] by project “Cloud Artificial Intelligence Service Engineering (CAISE) platform to create universal and smart services for various application areas”, No. KPOD.05.10-IW.10-0005/24, as part of the European IPCEI-CIS program, financed by NRRP (National Recovery and Resilience Plan) funds. Computations were carried out using the computers of Centre of Informatics Tricity Academic Supercomputer & Network at Gdansk University of Technology.
Citation
@article{dadas2024pirb,
title={{PIRB}: A Comprehensive Benchmark of Polish Dense and Hybrid Text Retrieval Methods},
author={Sławomir Dadas and Michał Perełkiewicz and Rafał Poświata},
year={2024},
eprint={2402.13350},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
Runs of sdadas stella-pl-retrieval-8k on huggingface.co
17.7K
Total runs
0
24-hour runs
0
3-day runs
750
7-day runs
1.2K
30-day runs
More Information About stella-pl-retrieval-8k huggingface.co Model
stella-pl-retrieval-8k huggingface.co is an AI model on huggingface.co that provides stella-pl-retrieval-8k's model effect (), which can be used instantly with this sdadas stella-pl-retrieval-8k model. huggingface.co supports a free trial of the stella-pl-retrieval-8k model, and also provides paid use of the stella-pl-retrieval-8k. Support call stella-pl-retrieval-8k model through api, including Node.js, Python, http.
stella-pl-retrieval-8k huggingface.co is an online trial and call api platform, which integrates stella-pl-retrieval-8k's modeling effects, including api services, and provides a free online trial of stella-pl-retrieval-8k, you can try stella-pl-retrieval-8k online for free by clicking the link below.
sdadas stella-pl-retrieval-8k online free url in huggingface.co:
stella-pl-retrieval-8k is an open source model from GitHub that offers a free installation service, and any user can find stella-pl-retrieval-8k on GitHub to install. At the same time, huggingface.co provides the effect of stella-pl-retrieval-8k install, users can directly use stella-pl-retrieval-8k installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
stella-pl-retrieval-8k install url in huggingface.co: