/ Модель

Характеристики

Контекст
514 токенов
Параметры
149 млн
Лицензия
Apache 2.0
Архитектура
modernbert · dense
Библиотека
transformers
Опубликована
26 авг 2026

pl-ModernBERT-512-base

Заполнение пропусковТекст → текст9 профессий

Польский энкодер ModernBERT для заполнения пропусков и адаптации к задачам классификации, разметки, поиска и сходства текстов.

425скачиваний за 30 дней0лайковвеса обновлены16 сен 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

OPI-PIB/pl-ModernBERT-512-base — базовая монолингвальная модель-энкодер семейства ModernBERT, предварительно обученная для обработки польского языка. Она предназначена как основа для польских NLP-систем: модель можно дообучать для классификации текстов и документов, разметки последовательностей, регрессии, семантического сходства, поиска и переранжирования. В текущем виде она также поддерживает заполнение пропусков в тексте (fill-mask).

Модель содержит 148,7 млн параметров и принимает последовательности длиной до 514 токенов. Архитектура включает 22 слоя, скрытый размер 768, RoPE, слои GeGLU и чередование глобального и локального внимания; используется токенизатор SentencePiece Unigram с размером словаря 50 008. Предобучение проведено на польском корпусе объёмом около 44,5 млрд токенов. В README сообщается о конкурентных результатах на польских задачах NLU, включая KLEJ и FinBench.

Для прикладных задач, кроме заполнения пропусков, потребуется адаптация или дообучение. Модель опубликована в формате safetensors и распространяется по лицензии Apache-2.0.

Сценарии применения

  • заполнение пропущенных слов в польском тексте
  • классификация польских документов после дообучения
  • распознавание сущностей и разметка польских последовательностей после дообучения
  • поиск польских документов по смыслу после адаптации
  • переранжирование результатов поиска на польском языке после дообучения

Ограничения

Модель является базовым энкодером, поэтому для большинства прикладных задач её нужно дообучить или адаптировать. Контекст ограничен 514 токенами.

Для каких профессий подходит9

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Polish ModernBERT is a family of monolingual ModernBERT-based encoders pretrained for Polish. The family covers two model scales (Base and Large) and two context lengths (512 and 8,192 tokens). The models are general-purpose pretrained encoders intended to serve as strong foundations for a broad range of Polish NLP applications. They can be fine-tuned or adapted for downstream tasks including, but not limited to, text and document classification, sequence labeling, regression, semantic similarity, retrieval, reranking, and representation learning.

📄 Paper: Polish ModernBERT: The Long and Short of Polish Language Understanding
🤗 Model collection: Polish ModernBERT
📚 LongContext benchmark: Dataset

Model family

ModelParametersContextVocabularyTokenizer
pl-ModernBERT-512-base149M51250,008SentencePiece Unigram
pl-ModernBERT-512-large475M512128,256SentencePiece Unigram + byte fallback
pl-ModernBERT-base149M8,19250,008SentencePiece Unigram
pl-ModernBERT-large475M8,192128,256SentencePiece Unigram + byte fallback

All variants use the core ModernBERT architecture with RoPE, GeGLU feed-forward layers, pre-normalization, and alternating global/local attention. The Base models use 22 layers with hidden size 768, while the Large models use 28 layers with hidden size 1,024.

Training

The models were pretrained on approximately 44.5B Polish tokens (197 GB after preprocessing) from a curated Polish corpus, Common Crawl (CC-MAIN-2019-43), and the Polish pol_Latn subset of FineTranslations.

Pretraining follows a staged recipe selected through downstream validation: four 512-token stages progressively transition from token-level MLM to whole-word masking, increased emphasis on curated data, and final annealing, followed by long-context continuation to 8,192 tokens. During context extension, the global RoPE theta is increased from 10,000 to 160,000.

Training was performed with Composer in BF16 using StableAdamW and distributed data parallelism across 8 NVIDIA GH200 GPUs.

Evaluation

The models were evaluated on 30 Polish NLU tasks spanning KLEJ, FinBench, the five-task LongContext benchmark, and a range of additional Polish NLP tasks. Each model-task configuration was fine-tuned using five random seeds; scores below are means on a 0–100 scale.

Evaluation Results

The tables below summarize average performance across the main evaluation groups. Scores are reported on a 0–100 scale. Overall Avg. is the macro-average across all 30 individual tasks rather than the average of the four group-level scores.

Base models

ModelContextKLEJ Avg.FinBench Avg.Other Tasks Avg.LongContext Avg.Overall Avg.
XLM-R Base51284.4683.1377.1050.7576.12
HerBERT Base51285.8383.6579.2861.9379.23
Polish RoBERTa-v2 Base51286.7585.1480.2657.6679.42
Polish ModernBERT 512 Base51286.8486.9582.0771.5982.73
EuroBERT-210M8K77.1682.3873.7172.3076.24
mmBERT Small8K80.1183.0778.0169.0278.15
Polish RoBERTa-8K Base8K86.8685.9882.3667.4781.95
Polish ModernBERT Base8K87.0086.6983.0877.1583.99

Large models

ModelContextKLEJ Avg.FinBench Avg.Other Tasks Avg.LongContext Avg.Overall Avg.
XLM-R Large51287.2985.4482.6467.8782.13
HerBERT Large51287.8387.3383.4270.2683.33
Polish RoBERTa-v2 Large51288.6987.9083.5870.4983.80
Polish ModernBERT 512 Large51288.4888.1883.6073.5884.31
EuroBERT-610M8K80.1086.1178.9577.3680.46
mmBERT Base8K83.1785.6980.8073.4481.27
Polish RoBERTa-8K Large8K88.5287.9884.2775.8884.89
Polish ModernBERT Large8K88.3187.8383.9078.4985.11

KLEJ

Polish ModernBERT is competitive with the strongest Polish BERT/RoBERTa encoders on KLEJ. The Base variants obtain the highest KLEJ average in both context settings, while the Large variants remain within 0.21 points of the corresponding Polish RoBERTa models.

Taskpl-RoBERTa-v2-basepl-ModernBERT-512-basepl-RoBERTa-8K-basepl-ModernBERT-base
NKJP-NER94.3294.3894.1694.49
CDSC-E94.0594.6694.5494.46
CDSC-R94.6494.1194.9094.06
CBD70.5768.5669.3571.40
POLEMO-IN90.9792.8891.2792.14
POLEMO-OUT79.1183.7781.2683.04
DYK70.3866.9069.3567.28
PSC98.8897.7998.9097.68
AR87.8388.5388.0588.46
Average86.7586.8486.8687.00
Taskpl-RoBERTa-v2-largepl-ModernBERT-512-largepl-RoBERTa-8K-largepl-ModernBERT-large
NKJP-NER95.7595.0595.6494.38
CDSC-E94.1694.6094.2894.68
CDSC-R95.2595.1495.3394.47
CBD73.1072.6073.2371.47
POLEMO-IN93.5593.3893.0593.05
POLEMO-OUT83.8184.4183.6484.78
DYK74.8773.2874.0574.63
PSC98.3798.8198.5698.47
AR89.3689.0788.9188.88
Average88.6988.4888.5288.31

FinBench

Polish ModernBERT shows particularly strong performance on FinBench. The Base variants achieve the highest FinBench average in both context settings. At Large scale, the 512-token Polish ModernBERT obtains the highest average, while the 8K variant remains close to the corresponding Polish RoBERTa model.

Taskpl-RoBERTa-v2-basepl-ModernBERT-512-basepl-RoBERTa-8K-basepl-ModernBERT-base
Banking-Short78.7580.4179.7980.08
Banking-Long85.0387.2986.9987.16
Banking7788.2691.8589.2791.66
FPB83.5583.2083.6383.40
GCN95.0294.8794.8794.83
Stooq80.2584.0881.3283.03
Average85.1486.9585.9886.69
Taskpl-RoBERTa-v2-largepl-ModernBERT-512-largepl-RoBERTa-8K-largepl-ModernBERT-large
Banking-Short81.6982.0781.9981.94
Banking-Long87.8988.4088.3588.89
Banking7792.4592.9692.7492.62
FPB85.2684.8085.4284.60
GCN95.0495.0894.9794.88
Stooq85.0785.7784.4184.02
Average87.9088.1887.9887.83

Other Tasks

Across the additional Polish NLP tasks, the Base variants of Polish ModernBERT obtain the highest average in both context settings. At Large scale, the 512-token model achieves the highest average, while the 8K variant remains competitive with the corresponding Polish RoBERTa model.

Taskpl-RoBERTa-v2-basepl-ModernBERT-512-basepl-RoBERTa-8K-basepl-ModernBERT-base
8TAGS78.0380.6979.2180.86
BAN-PL92.1993.1092.6293.08
MIPD58.5867.1164.3968.03
PPC87.0584.4086.0285.70
SICK-E86.7186.3186.3186.61
SICK-R82.5883.1683.1683.77
TwitterEMO66.4669.0268.7569.52
IMDB91.0692.0595.0294.40
EURLEX74.5179.3179.1279.61
NKJP-NER*85.4185.5488.9789.21
Average80.2682.0782.3683.08
Taskpl-RoBERTa-v2-largepl-ModernBERT-512-largepl-RoBERTa-8K-largepl-ModernBERT-large
8TAGS81.6482.5081.4482.24
BAN-PL93.8094.0093.9993.51
MIPD67.2768.2868.5068.99
PPC89.9688.0489.4887.20
SICK-E88.3387.8888.9687.47
SICK-R85.9384.6986.5484.91
TwitterEMO70.7070.2070.6070.35
IMDB94.3693.7796.0395.93
EURLEX79.1979.8479.7779.76
NKJP-NER*84.6286.8487.3688.66
Average83.5883.6084.2783.90

Long-context performance

Polish ModernBERT shows its largest gains on the LongContext benchmark, which consists of five tasks designed specifically to evaluate long-document understanding. The 8K variants achieve the highest LongContext average at both model scales.

At Base scale, pl-ModernBERT-base improves over pl-RoBERTa-8K-base by 9.68 points (77.15 vs. 67.47) while using 22% fewer parameters (149M vs. 190M). At Large scale, pl-ModernBERT-large improves over the corresponding Polish RoBERTa-8K baseline by 2.61 points (78.49 vs. 75.88).

Taskpl-RoBERTa-v2-basepl-ModernBERT-512-basepl-RoBERTa-8K-basepl-ModernBERT-base
SCOTUS-Dom79.1282.8179.2684.48
SCOTUS-Dec69.8670.7463.2077.79
BookSummary85.0283.7188.9690.22
ECtHR-PL-AVA33.6561.4264.6668.01
ECtHR-PL-VA20.6559.2941.2865.27
Average57.6671.5967.4777.15
Taskpl-RoBERTa-v2-largepl-ModernBERT-512-largepl-RoBERTa-8K-largepl-ModernBERT-large
SCOTUS-Dom83.0183.8383.9985.78
SCOTUS-Dec72.4671.3968.7378.21
BookSummary87.4786.5493.1191.74
ECtHR-PL-AVA58.3364.6268.2969.48
ECtHR-PL-VA51.1761.5065.2767.24
Average70.4973.5875.8878.49

The 512-token variants are evaluated on LongContext with truncation and should be treated as practical short-context baselines rather than controlled context-length ablations.

Inference efficiency

In a common BF16 inference setup on a single NVIDIA H100, Polish ModernBERT provides favorable quality–efficiency trade-offs relative to the corresponding Polish RoBERTa baselines.

For 512-token inference, the Base and Large models reduce latency by approximately 26% and 47%, respectively, while reducing peak GPU memory usage by 54% and 18%. In the 8K setting, the corresponding latency reductions are 6% and 25%, with peak memory reductions of 24% and 21%.

Usage

from transformers import AutoTokenizer, AutoModel

model_id = "OPI-PIB/pl-ModernBERT-512-base"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModel.from_pretrained(model_id)

text = "W białodrzewiu jaśnie dźni słoneczno, miodzie złoci białopałem żyśnie, drzewia pełni pszczelą i pasieczną, a przez liście kraśnie pęk słowiśnie."

inputs = tokenizer(
    text,
    return_tensors="pt",
    truncation=True,
    max_length=512,
)

outputs = model(**inputs)
token_embeddings = outputs.last_hidden_state

For downstream tasks such as classification, regression, sequence labeling, retrieval, or reranking, the pretrained encoder can be adapted to the target task.

The raw checkpoints are not retrieval-specific sentence-embedding models. PIRB retrieval results reported in the paper were obtained after contrastive fine-tuning.

For longer inputs, use one of the corresponding 8K checkpoints from the Polish ModernBERT family.

Flash Attention 2

🏎️ For the highest training and inference efficiency, we recommend using Polish ModernBERT with Flash Attention 2 when supported by your GPU and environment.

pip install flash-attn --no-build-isolation

The model can then be loaded with:

from transformers import AutoModel

model = AutoModel.from_pretrained(
    model_id,
    attn_implementation="flash_attention_2",
    torch_dtype="auto",
)

Authors

Michał Perełkiewicz, Sławomir Dadas, Rafał Poświata, Małgorzata Grębowiec

AI Lab, National Information Processing Institute
(Ośrodek Przetwarzania Informacji – Państwowy Instytut Badawczy, OPI PIB)

Warsaw, Poland

Corresponding author: mperelkiewicz@opi.org.pl

Acknowledgments

This work was supported by the Gaia AI Factory project, funded by the European Union under Grant Agreement No. 101314359 through the EuroHPC Joint Undertaking (EuroHPC JU).

We gratefully acknowledge the Polish high-performance computing infrastructure PLGrid (HPC Center: ACK Cyfronet AGH) for providing computational resources and support within computational grant PLG/2025/018315.

Citation

If you use Polish ModernBERT in your work, please cite:

@misc{perełkiewicz2026polishmodernbertlongshort,
      title={Polish ModernBERT: The Long and Short of Polish Language Understanding}, 
      author={Michał Perełkiewicz and Sławomir Dadas and Rafał Poświata and Małgorzata Grębowiec},
      year={2026},
      eprint={2609.01379},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2609.01379}, 
}

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers · fill-mask

Можно запустить

Подбираем GPU…

Класс архитектуры
ModernBertForMaskedLM
Ревизия весов
984ecf5

0 моделей