language: pl
license: apache-2.0
extra_gated_heading: Request access to embed-modernbert-68m
extra_gated_description: Access is granted automatically after submitting this form.
extra_gated_prompt: >-
By requesting access you agree to use the model in accordance with the
Apache-2.0 license and applicable export control regulations.
extra_gated_fields:
Full name: text
Company / Institution: text
Country: country
Region / Business unit: text
Intended use:
type: select
options:
- Research
- Commercial product
- Internal evaluation
- label: Other
value: other
I agree to the license terms: checkbox
extra_gated_button_content: Request access
embed-modernbert-68m
A Polish text embedding model designed as a general-purpose text encoder. The model is based on the ModernBERT architecture and encodes texts into dense vector representations that can be used for text understanding tasks, such as clustering, semantic similarity and few-shot classification. Its compact size makes it possible to run the model locally on limited hardware, including CPU-only environments and offers an efficient alternative to larger LLM-based approaches. This is especially useful for clustering and other large scale text processing tasks, where thousands or millions of documents need to be encoded efficiently.
Training
The model was trained in two stages, both based on knowledge distillation. In each stage a larger teacher embedding model was used to transfer semantic representation capabilities to a smaller student model. In this setting distillation means teaching the student to generate embeddings similar to those produced by the teacher for the same or semantically related texts.
In both stages the teacher model was Qwen3-Embedding-8B, selected for its strong performance in clustering, classification and text similarity tasks, as confirmed on MTEB benchmark. The student model was initialized from ettin-encoder-68m, an English encoder based on ModernBERT architecture.
The first stage used multilingual knowledge distillation, following the approach introduced in Making Monolingual Sentence Embeddings Multilingual using Knowledge Distillation. The goal was to transfer the embedding space of an already trained teacher model from English to Polish. Training was performed on Polish-English parallel data, where each document was available in both languages. The teacher model encoded the English version and the student was trained to produce a similar vector representation for the corresponding Polish text. As a result, the student model learned to place Polish and English texts with the same meaning close to each other in the embedding space. The model was trained for 5 epochs with a batch size of 128 texts (64 parallel pairs of Polish-English texts).
The second stage used more advanced distillation objective inspired by Jasper and Stella: distillation of SOTA embedding models. This stage was performed only on Polish texts and was designed to improve the quality of learned Polish representations. The objective combined three complementary losses:
- cosine loss, which aligns student embeddings with teacher embeddings,
- similarity loss, ensuring consistent similarity judgements between student and teacher,
- relative similarity distillation loss, which teaches the student to preserve the teacher's relative ranking of similar texts.
While the first stage was essential for transferring Polish text representation capabilities to the student model, the three similarity-based objectives used in the second stage resulted in a stronger alignment between the student and teacher embedding spaces. As in the first stage, the model was trained for 5 epochs with a batch size of 128, but using only Polish texts.
The training data contained approximately 20 million Polish-English document pairs, combining existing Polish-English parallel corpora with English embedding datasets translated into Polish.
Evaluation - clustering
To evaluate clustering quality a Polish clustering benchmark was created with eight datasets covering short texts, long documents, web pages, news articles, scientific abstracts and domain-specific banking content. The benchmark combines existing Polish tasks with datasets translated from English to Polish using an LLM. The included tasks are: 8TAGS (clustering headlines into 8 topic categories), Banking-Long (clustering longer finance and banking related articles into 14 topical sections), Banking-Short (clustering finance and banking headlines into the same 14 topics), CORTEX (clustering short texts by expressed emotion into 9 classes), Fineweb-Topics (clustering Polish web pages into 22 topic categories), Guardian-Articles (clustering translated Guardian articles into 29 editorial sections), PLSC (clustering scientific titles and abstracts by research field into 8 classes) and WikiNewsPL (clustering WikiNews articles into 9 news topics).
The evaluation results for the new models together with comparisons to popular Polish and multilingual embedding models are presented in Tables 1 and 2. For each model, documents were encoded into vector representations and clustered with K-Means algorithm. Table 1 reports clustering quality using ARI (Adjusted Rand Index), while Table 2 uses V-measure. Each clustering experiment was repeated five times and the results reported in below tables are average ARI/V-measure scores. As a reference point, the evaluation also includes a lexical baseline method based on TF-IDF representations reduced to dense vectors with Truncated SVD. This baseline represents texts using word-level lexical information rather than learned semantic embeddings.
| Model | 8TAGS | PLSC | WikiNewsPL | Banking-Short | Banking-Long | CORTEX | Guardian-Articles | Fineweb-Topics | MEAN |
|---|---|---|---|---|---|---|---|---|---|
| Lexical baseline | 4.0 | 18.6 | 39.4 | 6.9 | 36.1 | 1.2 | 24.9 | 18.8 | 18.7 |
| sdadas/mmlw-roberta-base | 28.4 | 20.8 | 41.6 | 15.7 | 36.8 | 19.1 | 32.2 | 23.0 | 27.2 |
| sdadas/mmlw-roberta-large | 33.2 | 20.1 | 38.6 | 19.5 | 40.8 | 19.4 | 28.8 | 22.0 | 27.8 |
| intfloat/multilingual-e5-small | 24.8 | 19.3 | 33.7 | 17.2 | 34.5 | 11.3 | 29.7 | 22.9 | 24.2 |
| intfloat/multilingual-e5-base | 27.1 | 19.2 | 34.0 | 17.1 | 35.0 | 14.9 | 27.8 | 21.9 | 24.6 |
| intfloat/multilingual-e5-large | 31.6 | 18.1 | 35.3 | 23.5 | 37.3 | 17.6 | 30.4 | 22.5 | 27.0 |
| paraphrase-multilingual-MiniLM-L12-v2 | 21.8 | 15.4 | 35.6 | 10.2 | 19.0 | 12.0 | 21.3 | 19.3 | 19.3 |
| BAAI/bge-m3 | 29.3 | 17.6 | 37.9 | 22.4 | 38.2 | 20.4 | 27.2 | 22.8 | 27.0 |
| snowflake-arctic-embed-l-v2.0 | 30.8 | 16.3 | 38.7 | 30.6 | 41.3 | 11.1 | 28.1 | 20.5 | 27.2 |
| embed-modernbert-68m | 44.0 | 22.8 | 42.7 | 25.7 | 38.9 | 16.0 | 39.7 | 31.3 | 32.7 |
| embed-modernbert-395m | 46.7 | 22.5 | 42.3 | 26.8 | 40.8 | 22.6 | 40.7 | 32.0 | 34.3 |
| embed-roberta-8k | 26.3 | 17.4 | 38.9 | 23.2 | 39.4 | 21.0 | 29.2 | 25.5 | 27.6 |
Table 1. Comparison of clustering evaluation results using ARI metric.
| Model | 8TAGS | PLSC | WikiNewsPL | Banking-Short | Banking-Long | CORTEX | Guardian-Articles | Fineweb-Topics | MEAN |
|---|---|---|---|---|---|---|---|---|---|
| Lexical baseline | 12.2 | 26.5 | 49.6 | 27.3 | 52.3 | 4.2 | 43.5 | 36.3 | 31.5 |
| sdadas/mmlw-roberta-base | 37.0 | 29.6 | 50.3 | 28.2 | 50.5 | 24.3 | 48.4 | 42.4 | 38.8 |
| sdadas/mmlw-roberta-large | 41.5 | 29.7 | 49.0 | 32.2 | 53.6 | 27.3 | 47.7 | 41.5 | 40.3 |
| intfloat/multilingual-e5-small | 33.4 | 28.4 | 43.1 | 30.8 | 48.0 | 17.6 | 45.6 | 40.8 | 36.0 |
| intfloat/multilingual-e5-base | 35.7 | 28.3 | 43.3 | 30.7 | 48.9 | 22.7 | 45.8 | 39.4 | 36.9 |
| intfloat/multilingual-e5-large | 39.0 | 27.1 | 43.9 | 38.1 | 51.6 | 25.8 | 47.3 | 41.4 | 39.3 |
| paraphrase-multilingual-MiniLM-L12-v2 | 29.0 | 25.3 | 43.0 | 21.1 | 32.6 | 18.2 | 37.0 | 33.9 | 30.0 |
| BAAI/bge-m3 | 36.6 | 27.0 | 46.2 | 35.7 | 52.2 | 28.0 | 46.3 | 40.4 | 39.1 |
| snowflake-arctic-embed-l-v2.0 | 38.0 | 25.7 | 45.2 | 44.5 | 55.0 | 17.4 | 47.1 | 38.2 | 38.9 |
| embed-modernbert-68m | 48.0 | 33.4 | 53.6 | 39.0 | 52.8 | 22.4 | 55.1 | 50.7 | 44.4 |
| embed-modernbert-395m | 52.6 | 33.9 | 53.3 | 40.2 | 54.3 | 30.0 | 55.7 | 51.1 | 46.4 |
| embed-roberta-8k | 34.7 | 28.1 | 48.4 | 37.1 | 53.6 | 28.0 | 46.4 | 44.4 | 40.1 |
Table 2. Comparison of clustering evaluation results using V-measure.
The results are consistent across ARI and V-measure with both metrics leading to a similar ranking of models. The embed-modernbert models achieve the highest scores in both evaluations. Even the smaller 68M variant outperforms other several larger Polish and multilingual encoders. The embed-roberta-8k model also performs well, although its scores are a few percentage points lower than ModernBERT-based models. Increasing the size of the embed-modernbert model provides a modest average gain of about 2 percentage points across the eight tasks for both metric, although the improvement is larger on some individual datasets.
Evaluation - few-shot classification
The models were evaluated in few-shot classification using the SetFit framework. SetFit is designed for efficient text classification with a very small number of labeled examples and consists of two steps: contrastive fine-tuning of the sentence encoder followed by training a classification head.
The evaluation covered four banking and finance classification tasks: FPB (sentiment classification of financial news into negative, neutral and positive classes), Banking77 (customer intent classification for banking related queries into 77 intent categories), Banking-Short (topic classification of finance and banking headlines into 14 topics), Banking-Long (the same topic classification task as in Banking-Short, but using full article texts together with titles). Datasets FPB and Banking77 were machine translated into Polish.
For each task, the models were trained using only 2, 4 or 8 examples per class sampled from training split. The tests sets were kept separate from this sampling process. Each experiment was repeated three times with different training samples and the results reported in Table 3 are mean accuracy scores. In total 12 models were evaluated across 4 tasks.
| Model / task | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| FPB | Banking77 | Banking-Short | Banking-Long | |||||||||
| 2 | 4 | 8 | 2 | 4 | 8 | 2 | 4 | 8 | 2 | 4 | 8 | |
| paraphrase-MiniLM-L12-v2 | 36.56 | 38.59 | 41.92 | 34.76 | 47.31 | 56.16 | 19.27 | 22.89 | 33.07 | 25.32 | 31.68 | 43.63 |
| multilingual-e5-small | 41.06 | 42.54 | 55.88 | 45.31 | 57.48 | 70.85 | 37.93 | 46.51 | 54.71 | 55.42 | 58.33 | 63.91 |
| multilingual-e5-base | 39.14 | 42.82 | 61.52 | 49.75 | 67.16 | 77.43 | 33.01 | 40.70 | 53.34 | 52.29 | 57.75 | 64.39 |
| bge-m3 | 42.54 | 47.46 | 62.82 | 58.02 | 72.79 | 77.84 | 38.19 | 53.39 | 62.13 | 61.39 | 63.03 | 69.58 |
| snowflake-arctic-embed-l-v2.0 | 39.69 | 49.28 | 64.98 | 57.37 | 73.28 | 77.57 | 44.20 | 53.62 | 59.07 | 60.20 | 63.47 | 70.35 |
| pplx-embed-v1-0.6b | 33.82 | 40.00 | 58.42 | 58.03 | 71.78 | 79.19 | 38.32 | 51.54 | 55.15 | 58.22 | 61.23 | 69.20 |
| Qwen3-Embedding-0.6B | 44.12 | 61.75 | 69.42 | 46.57 | 65.18 | 72.58 | 32.43 | 40.35 | 45.94 | 32.89 | 21.38 | 13.27 |
| mmlw-roberta-base | 44.23 | 50.69 | 63.75 | 58.25 | 69.80 | 76.99 | 33.61 | 48.99 | 58.57 | 54.59 | 58.38 | 66.05 |
| mmlw-roberta-large | 44.67 | 52.20 | 66.25 | 58.60 | 71.01 | 76.00 | 38.93 | 54.63 | 61.71 | 56.83 | 62.88 | 68.48 |
| embed-modernbert-68m | 46.08 | 51.75 | 65.60 | 48.93 | 65.66 | 74.32 | 38.73 | 56.69 | 61.96 | 58.16 | 63.88 | 71.87 |
| embed-modernbert-395m | 29.76 | 49.59 | 68.01 | 56.78 | 74.71 | 81.06 | 37.69 | 58.62 | 60.90 | 55.25 | 62.02 | 73.11 |
| embed-roberta-8k | 45.46 | 57.39 | 72.99 | 61.01 | 74.31 | 76.51 | 41.81 | 54.28 | 63.12 | 59.45 | 64.81 | 69.79 |
Table 3. Comparison of few-shot classification results using 2, 4 and 8 training examples per class.
Across the few-shot classification experiments, the strongest overall performance was achieved by embed-modernbert-395m and embed-roberta-8k, each obtaining the highest average accuracy scores in 4 of the evaluated settings. The few cases where other models performed better occured in the most restrictive 2-shot and 4-shot setting. Some results show high variability between runs, especially on FPB. Since the task has only three sentiment classes, few-shot setups provide very small training examples in total, making the final fine-tuned model highly dependent on selected samples.
Usage
This is a general-purpose embedding model optimized for different types of tasks. The task is indicated by a prefix added at the beginning of the input text. The selected prefix has a significant effect on the resulting embedding vector and therefore should match intended use case:
- "[cls]: " for classification and clustering tasks,
- "[sts]: " for semantic similarity tasks,
- "[query]: " for search queries in information retrieval tasks,
- no prefix for documents and passages in information retrieval tasks.
For optimal performance, we recommend using sentence-transformers version 5.4.0 or later and initializing the model with dtype="float16" or dtype="bfloat16" together with attn_implementation="flash_attention_2".
from sentence_transformers import SentenceTransformer
from sentence_transformers.util import cos_sim
from sklearn.cluster import KMeans
model = SentenceTransformer(
"PKOBP/embed-modernbert-68m",
device="cuda",
model_kwargs={
"dtype": "bfloat16",
"attn_implementation": "flash_attention_2"
}
)
# Clustering example
cls_prefix = "[cls]: "
documents = [
cls_prefix + "Jak zastrzec kart臋 p艂atnicz膮 w aplikacji mobilnej?",
cls_prefix + "Ustawianie limit贸w transakcji kartowych dla p艂atno艣ci internetowych.",
cls_prefix + "Warunki wcze艣niejszej sp艂aty kredytu hipotecznego.",
cls_prefix + "Dokumenty wymagane przy sk艂adaniu wniosku o kredyt mieszkaniowy.",
cls_prefix + "Zasady otwierania lokaty terminowej dla klient贸w indywidualnych.",
cls_prefix + "Por贸wnanie funduszy inwestycyjnych dost臋pnych w ofercie banku."
]
embeddings = model.encode(documents, convert_to_tensor=False)
cluster_ids = KMeans(n_clusters=3, random_state=42, n_init=10).fit_predict(embeddings)
print(cluster_ids)
# Semantic similarity example
sim_prefix = "[sts]: "
sentences = [
sim_prefix + "Konto osobiste mo偶na otworzy膰 ca艂kowicie online.",
sim_prefix + "Proces zak艂adania rachunku jest dost臋pny w pe艂ni zdalnie.",
sim_prefix + "Przelewy zagraniczne s膮 realizowane zgodnie z tabel膮 op艂at i prowizji."
]
embeddings = model.encode(sentences, convert_to_tensor=True)
print(cos_sim(embeddings, embeddings))
# Retrieval example
query_prefix = "[query]: "
query = query_prefix + "Jak zwi臋kszy膰 maksymaln膮 kwot臋 pojedynczego przelewu?"
documents = [
"Ustawienia limit贸w transakcyjnych s膮 dost臋pne w bankowo艣ci internetowej i aplikacji mobilnej.",
"Lokata terminowa mo偶e zosta膰 odnowiona automatycznie po zako艅czeniu okresu umownego.",
"Historia operacji na rachunku jest dost臋pna po zalogowaniu do serwisu."
]
query_emb = model.encode(query, convert_to_tensor=True)
doc_emb = model.encode(documents, convert_to_tensor=True)
best_match = cos_sim(query_emb, doc_emb).argmax().item()
print(documents[best_match])
Acknowledgements
This project is financed by the European Funds, registered under the number FENG.01.01-IP.01-A028/23-00. It focuses on "Building innovative large language models and a service platform for serving multi-task models within the Bank." The outcomes of this project are the result of a collaboration between the AI Lab at the National Information Processing Institute (O艣rodek Przetwarzania Informacji Pa艅stwowy Instytut Badawczy) and the AI Team at PKO Bank Polski.
Funding Amount by the European Funds: 9,2 mln PLN