Manuscript Offprint
arXiv:2609.01379Polish ModernBERT: The Long and Short of Polish Language Understanding
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
Encoder-only Transformers remain effective for discriminative and representation-learning tasks, yet Polish encoders still largely rely on BERT/RoBERTa-style architectures. We introduce Polish ModernBERT, a family of four Polish encoders available at Base and Large scales, each with 512-token and 8K context variants. We adapt the ModernBERT pretraining recipe through staged selection experiments and release a long-context benchmark covering legal topic classification, ideological decision-direction prediction, factual-consistency assessment over literary plot summaries, and human-rights violation assessment. Across 30 tasks, Polish ModernBERT achieves the best overall performance among the evaluated Polish encoders, reaching 83.99 and 85.11 for the Base-8K and Large-8K models, respectively. On long-context tasks, the 8K variants improve over matched Polish RoBERTa-8K baselines from 67.47 to 77.15 and from 75.88 to 78.49 at the Base and Large scales, respectively. The Base-8K model achieves this gain with 22% fewer parameters (149M vs. 190M). Efficiency measurements in representative inference setups show lower peak memory usage and latency than matched Polish RoBERTa baselines in both 512-token and 8K settings. Polish ModernBERT-8K-Base additionally achieves the best result on a Polish retrieval benchmark among the evaluated encoders below 300M parameters.
1 Introduction
Recent progress in NLP has been driven largely by decoder-only large language models. Encoder-only Transformers, however, remain a competitive and computationally efficient choice for discriminative and representation-learning applications, including text classification, dense retrieval, cross-encoder reranking, and sentence representation learning. Recent architectures such as MosaicBERT (Portes et al., 2023), ModernBERT (Warner et al., 2025), and NeoBERT (Breton et al., 2025) demonstrate that BERT-style models can be further improved through updated architectural choices, training recipes, and optimized implementations.
Access to these advances remains uneven across languages. Although ModernBERT-style architectures have recently been extended to several languages and multilingual settings (Pellicer and Rinaldo, 2026; Shmidman et al., 2025; Marone et al., 2025; Boizard et al., 2025), many languages continue to rely primarily on earlier BERT (Devlin et al., 2019) and RoBERTa (Liu et al., 2019) architectures. This limitation is particularly relevant for morphologically rich languages such as Polish, for which language-specific tokenization and monolingual pretraining can provide better lexical coverage and stronger downstream representations.
Existing Polish encoders include HerBERT (Mroczkowski et al., 2021), Polish RoBERTa-v2 (Dadas et al., 2020b), and Polish RoBERTa-8K (Dadas et al., 2026). Although these models remain strong reference points, to our knowledge, no previous Polish encoder family combines a ModernBERT-based architecture with both Base and Large model scales and 512-token and 8K context lengths.
To address this gap, we introduce Polish ModernBERT , a family of four Polish encoder models covering Base and Large scales and maximum context lengths of 512 and 8,192 tokens. We adapt the ModernBERT pretraining recipe to Polish through staged recipe selection, corpus refinement, and long-context continuation. We additionally introduce the LongContext benchmark , a five-task Polish evaluation suite for long-document understanding.
Across 30 downstream tasks, Polish ModernBERT achieves stronger aggregate performance than prior Polish encoders, with particularly strong gains on long-document understanding. The Base-8K model improves over the matched Polish RoBERTa-8K baseline by 9.68 points while using 22% fewer parameters, and the Large-8K variant achieves the best overall score among the evaluated Polish encoders. The models also reduce inference latency and peak memory usage relative to matched RoBERTa baselines and achieve strong performance on a Polish retrieval benchmark.
Our contributions are as follows: (i) we introduce a ModernBERT-based encoder family for Polish, covering Base and Large scales and 512-token and 8K context
https://huggingface.co/collections/OPI-PIB/pl-modernbert
https://huggingface.co/collections/mmichall/polish-longcontext-benchmark lengths, and will release all four checkpoints publicly upon publication; (ii) we adapt the ModernBERT pretraining setup through a staged procedure encompassing recipe selection, corpus refinement, and long-context continuation; (iii) we introduce LongContext, a five-task Polish benchmark specifically designed to evaluate long-document understanding beyond the standard 512-token context window, covering legal topic and decision-direction prediction, human-rights violation assessment, and factual-consistency assessment over literary plot summaries; and (iv) we provide an extensive evaluation against Polish and multilingual encoders and retrieval models, together with inference-efficiency measurements showing favorable quality–cost trade-offs.
Long-document encoders such as Longformer (Beltagy et al., 2020) and BigBird (Zaheer et al., 2020) extended the context length of BERT-style models through sparse attention mechanisms. More recent work has revisited the broader encoder design by incorporating architectural, training, and implementation advances developed for later Transformer systems. MosaicBERT (Portes et al., 2023) focuses on efficient pretraining, while ModernBERT (Warner et al., 2025) and NeoBERT (Breton et al., 2025) combine updated architectural choices with optimized implementations and native support for contexts of up to 8,192 and 4,096 tokens, respectively.
Multilingual encoders such as mBERT (Devlin et al., 2019; Pires et al., 2019) and XLM-R (Conneau et al., 2019) established strong baselines for cross-lingual transfer. More recently, multilingual encoders have also been revisited using modern architectural and training choices. EuroBERT (Boizard et al., 2025) introduces a family of encoders covering European and widely spoken global languages with native 8K-token support, while mmBERT (Marone et al., 2025) scales modern encoder pretraining to a massively multilingual setting. Nevertheless, sharing a fixed model capacity across many languages can limit performance for individual languages, particularly when they are morphologically rich or underrepresented in the pretraining mixture (Conneau et al., 2019; Hu et al., 2020; Ruder et al., 2021).
This limitation has motivated complementary work on language-focused modern encoders, including Modern-LiBERTa for Ukrainian (Haltiuk and Smywiński-Pohl, 2025), NeoDictaBERT for Hebrew (Shmidman et al., 2025), Finnish-centered ModernBERT models (Reunamo et al., 2025), TabiBERT for Turkish (Türker et al., 2025), and NorBERTo for Brazilian Portuguese (Pellicer and Rinaldo, 2026).
For Polish, prominent general-purpose encoder families include HerBERT (Mroczkowski et al., 2021) and Polish RoBERTa (Dadas et al., 2020b). Polish RoBERTa-8K (Dadas et al., 2026) further extends this line of work to long-document processing through continued pretraining of a RoBERTa-based model. Despite these developments, Polish still lacks a modern encoder family covering multiple model scales and both standard- and long-context settings.
3 Polish ModernBERT
3.1 Model Family and Architecture
All Polish ModernBERT variants retain the core ModernBERT architecture (Warner et al., 2025), including rotary positional embeddings, GeGLU feed-forward layers, pre-normalization, and alternating global and local sliding-window attention.
The model family varies primarily along two axes: model capacity and context length, with tokenizer design coupled to model scale. We release Base and Large models with maximum context lengths of 512 and 8,192 tokens. The 512-token models are pretrained from scratch on Polish data. The corresponding 8K variants are initialized from these checkpoints and undergo continued pretraining for long-context processing. During context extension, the global RoPE is increased from 10,000 to 160,000, while the local RoPE configuration remains unchanged.
The 512-token variants target conventional short-text processing and lower-cost inference, whereas the 8K variants are intended for document-level tasks. Within each model scale, the two context variants share the same architecture, tokenizer, and parameter count. Table 1 summarizes their configurations.
Table 1: Polish ModernBERT configurations. Slash-separated values denote the 512- and 8K-token variants, respectively.
| Property | Base | Large |
|---|---|---|
| Context | 512 / 8,192 | 512 / 8,192 |
| Vocabulary | 50,008 | 128,256 |
| Byte fallback | No | Yes |
| Layers | 22 | 28 |
| Hidden size | 768 | 1,024 |
| FFN size | 1,152 | 2,624 |
| GLU size | 2,304 | 5,248 |
| Attention heads | 12 | 16 |
| Global attention | Every 3rd | Every 3rd |
| Local window | 128 | 128 |
| Global RoPE θ | 10,000/160,000 | 10,000/160,000 |
| Local RoPE θ | 10,000 | 10,000 |
| Parameters | 149M | 475M |
| Non-embedd. params | 111M | 343M |
Tokenization The Base variants use the 50K SentencePiece Unigram tokenizer adopted from Polish RoBERTa-v2 (Dadas et al., 2020b). We extend its original vocabulary from 50,001 to 50,008 entries by adding seven unused tokens, making the vocabulary size divisible by eight and aligning the embedding matrix with hardware-friendly tensor dimensions. As shown in Table 10, the tokenizer provides broad coverage across most evaluation datasets, with higher unknown-token rates concentrated primarily in noisy user-generated and social-media text.
For the Large variants, we train a new SentencePiece Unigram tokenizer (Kudo and Richardson, 2018) with a total vocabulary of 128,256 entries, including byte-level fallback symbols. The larger vocabulary is designed to provide finer segmentation of rare, domain-specific, and morphologically complex Polish word forms, while byte fallback guarantees that arbitrary input strings can be represented without unknown tokens. We use this tokenizer only for the Large variants, for which the additional embedding parameters constitute a smaller proportion of the overall model capacity.
3.2 Pretraining Corpus
The main Polish ModernBERT pretraining corpus comprises 44.5B tokens from three sources: a curated Polish corpus, a Polish subset of Common Crawl, and a filtered Polish subset of FineTranslations (Penedo et al., 2026). Table 2 summarizes the post-processing size of each component, while a domain-level breakdown is provided in Appendix A.1.
The curated component contains Polish-language documents collected from publicly available web sources and existing text collections. It covers encyclopedic, scientific, educational, legal, parliamentary, literary, question-answer, consumer-review, news, discussion-forum, and general web content.
We include Polish documents extracted from the October 2019 Common Crawl snapshot (CC-MAIN-2019-43) to broaden the coverage of web language and long-tail lexical phenomena.
We also use Polish text from the pol_Latn subset of FineTranslations, a multilingual dataset derived from FineWeb2 and released by Hugging Face. We retain documents with edu_score_raw > 1.24, where edu_score_raw is a document-level educational-quality score provided with the dataset, with higher values indicating higher estimated quality. The threshold corresponds to approximately the top 25% of the Polish subset. To increase the representation of long-form content, we additionally retain documents longer than 2,000 tokens regardless of this score. These documents remain subject to the shared cleaning and quality-filtering pipeline. Documents admitted through this length-based criterion account for approximately 27% of the retained FineTranslations component, or 3.3B of 12.4B tokens.
Table 2: Post-cleaning pretraining-corpus statistics. Token counts use the Base tokenizer; annealing statistics reflect the upsampled mixture.
| Corpus / mixture | Text size | Tokens |
|---|---|---|
| Main pretraining corpus | ||
| Curated Polish corpus | 70 GB | 15.8B |
| Common Crawl | 70 GB | 16.3B |
| FineTranslations | 57 GB | 12.4B |
| Total main pretraining data | 197 GB | 44.5B |
| Stage-specific mixtures | ||
| Annealing corpus | 86 GB | 18.6B |
| Context-extension corpus | 127 GB | 28.2B |
Stage-specific mixtures. In addition to the main pre-training corpus, we construct two mixtures for specific stages of training. The annealing corpus is derived from the curated Polish corpus by upsampling selected components, including Wikipedia, legal texts, and consumer reviews. It is used during the final 512-token pretraining stage to increase the proportion of encyclopedic, legal, and opinion-oriented content. The context-extension corpus combines the curated Polish corpus with the FineTranslations component, including the additionally retained long documents. It is used for continued pretraining with sequences of up to 8,192 tokens and increases the representation of long-form content during context extension. Both mixtures are constructed from the cleaned and deduplicated source corpora and therefore do not introduce additional unique pretraining data.
Corpus cleaning. Following source-specific extraction, all corpus components undergo a shared cleaning and filtering pipeline comprising sentence segmentation, punctuation and whitespace normalization, URL removal, sentence-level language identification, heuristic and classifier-based quality filtering, and KenLM-based perplexity filtering. Documents shorter than 500 characters are removed. We subsequently apply exact and near-duplicate removal across the corpus components.
After cleaning and deduplication, approximately 0.1% of documents are reserved as a held-out masked-language-modeling validation set and excluded from all pretraining stages. Full preprocessing and deduplication details are provided in Appendix A.2.
3.3 Training Procedure
The final pretraining schedule was selected through a compute-aware staged procedure initialized from the original ModernBERT recipe (Warner et al., 2025). As an initial baseline, we directly adapted the original configuration to Polish. This baseline achieved lower average KLEJ validation performance than the configurations identified through the subsequent recipe search; its training setup and downstream results are reported in Appendix B.1.
https://huggingface.co/datasets/HuggingFaceFW/finetranslations
| Stage IMLM pretraining | Stage IIWWM transition | Stage IIICurated continuation | Stage IVAnnealing | Context extension | |
|---|---|---|---|---|---|
| Masking objective | MLM | WWM | WWM | WWM | WWM |
| Masking ratio | 0.30 | 0.25 | 0.15 | 0.08 | 0.30 |
| Batch token capacity | 322k | 1.6M | 966k | 966k | 491k |
| Max. sequence length | 512 | 512 | 512 | 512 | 8,192 |

Figure 1: Polish ModernBERT pretraining schedule. The models are trained in four 512-token stages followed by 8K continuation. Blue markers denote evaluated checkpoints; red/gold markers denote selected Base/Large checkpoints. Slash-separated values correspond to Base / Large variants.
Recipe selection was conducted on the Base model. At each stage, we varied a small subset of factors—the learning-rate schedule, masking objective and ratio, corpus mixture, or peak learning rate—while keeping the remaining configuration fixed. Intermediate checkpoints were evaluated using the average KLEJ validation score, and the best-performing checkpoint was propagated to the subsequent stage. The selected recipe was then transferred to the Large variants. Following the original ModernBERT settings, Stage I used peak learning rates of and for Base and Large, respectively. For Large, Stages I–II were each extended by 50K steps to accommodate the greater model capacity and vocabulary size. The evaluated configurations and validation results are provided in Appendix B.2.
Overall schedule. Figure 1 summarizes the resulting training trajectory. The models undergo four 512-token pretraining stages, followed by long-context continuation from the selected Stage IV checkpoints. Across the 512-token stages, training progresses from token-level MLM on the full corpus to whole-word masking on the full, curated, and annealing corpora, with progressively lower masking ratios and peak learning rates. The final 512-token checkpoints initialize the corresponding 8K variants, which undergo continued pretraining on the context-extension corpus after increasing the global RoPE base from 10,000 to 160,000.
Each stage uses dynamic masking and its own learning-rate schedule, comprising 6% linear warm-up followed by cosine decay (Loshchilov and Hutter, 2016). At each stage transition, the optimizer and scheduler states are reinitialized, yielding stage-wise cosine restarts aligned with changes in the masking objective, masking ratio, or corpus mixture.
Token accounting. The token budgets shown in Figure 1 denote nominal capacity before excluding padding tokens. With sequence unpadding, non-padding tokens account for approximately 56% of this capacity during 512-token pretraining and 16% during context extension. Along the trajectories leading to the selected checkpoints, the Base and Large models process approximately 271.4B and 344.1B non-padding tokens, respectively, during 512-token pretraining, followed by approximately 11.0B and 12.6B tokens during context extension.
Implementation and compute. We use the official ModernBERT implementation released by the original authors , including sequence unpadding, optimized attention kernels, and Megatron-style parameter initialization. Training is performed with Composer 0.30.0 using distributed data parallelism across eight NVIDIA GH200 GPUs on two HPC nodes. We optimize all models with decoupled StableAdamW (Wortsman et al., 2023; Loshchilov and Hutter, 2017) and use BF16 mixed precision throughout pretraining.
Full optimizer settings, checkpoint-selection criteria, stage-wise hyperparameters, and token budgets are provided in Appendix B.2.
4 Evaluation
The evaluation suite comprises 30 Polish NLU tasks organized into four groups: nine KLEJ tasks, six FinBench tasks, ten additional tasks grouped under Other Tasks, and the five-task LongContext benchmark. KLEJ was introduced by Rybak et al. (2020), whereas FinBench and the original nine-task Other Tasks group were introduced by Dadas et al. (2026). In this work, we extend the latter group with one additional task and introduce the LongContext benchmark.
KLEJ covers sentiment analysis (POLEMO2.0-IN, POLEMO2.0-OUT, and AR), named-entity type classification (NKJP-NER), harmful-content detection (CBD),
https://github.com/answerdotai/modernbert and semantic-relation tasks (CDSC-E, CDSC-R, DYK, and PSC). FinBench evaluates financial-domain understanding through topic classification of short and long banking texts (BANKING-SHORT and BANKING-LONG), intent detection (BANKING77), sentiment analysis (FPB and STOOQ), and multi-label topic classification (GCN). The ten additional tasks grouped under Other Tasks broaden the evaluation to semantic relations (PPC, SICK-E, and SICK-R), thematic classification (8TAGS and EURLEX), sentiment and emotion analysis (IMDB and TWITTEREMO), harmful-content and manipulation detection (BAN-PL and MIPD), and sequence labeling (NKJP-NER*).
LongContext specifically targets document understanding beyond the standard 512-token context window. It comprises tasks selected or constructed to evaluate long-document processing and distinguish between standard- and extended-context encoders.
NKJP-NER*. NKJP-NER* is a sequence-labeling task derived from the Polish National Corpus and included among Other Tasks. Unlike the KLEJ NKJP-NER formulation, which recasts the data as single-label classification, it preserves the original sequence-labeling setup . Using the same underlying texts and annotations, we evaluate 512-token models on sentence-level inputs and 8K models on full documents. Both variants are treated as one task and evaluated using micro-averaged entity-level F1. This setup evaluates each model under its intended input regime and should not be interpreted as a controlled comparison of context length alone.
The complete list of tasks, prediction formulations, domains, and primary metrics is provided in Table 9. Test-set sizes and token-length statistics are reported in Table 10.
4.1 LongContext Benchmark
We introduce LongContext, a five-task Polish benchmark for document understanding beyond the standard 512-token context window. It comprises SCOTUS-DOM, SCOTUS-DEC, ECTHR-PL-AVA, ECTHR-PL-VA, and BOOKSUMMARY. LongContext is restricted to tasks selected or constructed specifically to evaluate long-document processing; datasets with long inputs that belong to established benchmark groups remain in their original groups for comparability with prior work.
The benchmark combines translated legal tasks with a specially constructed task evaluating factual consistency between distant parts of a document. All source datasets are based on publicly available English-language resources and were translated into Polish using GLM-4.6 . We manually spot-checked 50 randomly sampled examples from each LongContext task. A single annotator assessed whether the translated text was coherent and preserved the information required for the corresponding prediction task. For BookSummary, the inspection additionally covered claim grammaticality, unambiguity, and consistency with the assigned label. This inspection was intended as a quality-control check rather than a comprehensive human validation of the benchmark.
The inspection revealed a small number of degenerate outputs containing repetitive generation loops. We therefore applied automatic corpus-wide filters to remove such cases and other anomalously long outputs.
SCOTUS. We derive two tasks from the publicly available SCOTUS dataset of United States Supreme Court opinions (Spaeth et al., 2020). SCOTUS-DOM is an 11-class task predicting the legal issue area of a case, whereas SCOTUS-DEC is a binary task predicting whether the ideological direction associated with the decision is liberal or conservative. The tasks use the same court opinions but evaluate complementary aspects of legal document understanding. Their inputs are particularly long: 74.5% of the test examples exceed 4K tokens when tokenized with the Polish ModernBERT Base tokenizer.
ECTHR-PL. We construct ECTHR-PL from the European Court of Human Rights dataset introduced by Chalkidis et al. (2021). For each case, we concatenate the sentences and paragraphs describing its facts into a single document. We remove cases whose concatenated factual descriptions exceed 32,000 characters to exclude extreme-length outliers and keep the inputs within practical processing limits. The remaining documents are translated into Polish. Using the labels provided in the original dataset, we define two multi-label classification tasks: ECTHR-PL-AVA predicts the articles of the European Convention on Human Rights alleged to have been violated, whereas ECTHR-PL-VA predicts the articles that the Court found to have been violated.
BookSummary. We construct BOOKSUMMARY from a public collection of approximately 25.7K English-language plot summaries. To obtain sufficiently long inputs, we retain the longest 25% of the summaries, translate them into Polish, and divide them into 70%/10%/20% training, validation, and test splits. For each summary, GLM-4.6 is prompted to generate a two- or three-sentence claim supported by the document, with a preference for facts appearing in the second half of the summary. The claim is then prepended to the summary. Half of the claims are supported by the corresponding summary, while the remaining half are modified by GLM-4.6 to be plausible but factually inconsistent. The resulting balanced binary classification task requires the model to relate a claim at the beginning of the input to supporting or contradicting evidence that typically appears later in the summary. The
https://huggingface.co/datasets/pasinit/scotus
The processed NKJP-NER* dataset is available at https://anonymous.4open.science/r/pl-modernbert-5E28.
https://huggingface.co/datasets/AUEB-NLP/ecthr_cases
https://huggingface.co/zai-org/GLM-4.6
https://huggingface.co/datasets/kingkangkr/book_summary_dataset
Table 3: Base-scale encoder results across 30 tasks. Boldface marks the best score in each row, while underlining marks the best score within each context-length group. Averages are unweighted macro-averages across tasks. Superscripts denote architecture families: BERT, RoBERTa, ModernBERT, and Llama-inspired encoder; (m) denotes multilingual models. POLEMO-IN/OUT denote the in- and out-of-domain POLEMO2.0 variants. NKJP-NER* uses sentence-level inputs for 512-token models and document-level inputs for 8K models.
| 512 tokens | 8K tokens | |||||||
|---|---|---|---|---|---|---|---|---|
| XLM-RoBERTa(m) base (278M) | HerBERT base (124M) | pl-RoBERTa-v2 base (124M) | pl-ModernBERT base (149M) | EuroBERT(m) 210m (212M) | mmBERT(m) small (140M) | pl-RoBERTa-8K base (190M) | pl-ModernBERT-8K base (149M) | |
| KLEJ | ||||||||
| NKJP-NER | 92.37 | 94.13 | 94.32 | 94.38 | 84.17 | 90.99 | 94.16 | 94.49 |
| CDSC-E | 93.50 | 94.22 | 94.05 | 94.66 | 92.64 | 93.34 | 94.54 | 94.46 |
| CDSC-R | 93.38 | 93.84 | 94.64 | 94.11 | 88.40 | 90.47 | 94.90 | 94.06 |
| CBD | 60.84 | 66.36 | 70.57 | 68.56 | 51.06 | 50.02 | 69.35 | 71.40 |
| POLEMO-IN | 90.80 | 90.50 | 90.97 | 92.88 | 88.28 | 89.36 | 91.27 | 92.14 |
| POLEMO-OUT | 79.27 | 77.94 | 79.11 | 83.77 | 73.44 | 76.88 | 81.26 | 83.04 |
| DYK | 65.02 | 68.82 | 70.38 | 66.90 | 36.41 | 48.28 | 69.35 | 67.28 |
| PSC | 97.91 | 98.94 | 98.88 | 97.79 | 95.30 | 97.10 | 98.90 | 97.68 |
| AR | 87.06 | 87.74 | 87.83 | 88.53 | 84.73 | 84.59 | 88.05 | 88.46 |
| Average | 84.46 | 85.83 | 86.75 | 86.84 | 77.16 | 80.11 | 86.86 | 87.00 |
| FinBench | ||||||||
| Banking-Short | 77.34 | 78.35 | 78.75 | 80.41 | 73.72 | 73.86 | 79.79 | 80.08 |
| Banking-Long | 82.65 | 85.09 | 85.03 | 87.29 | 86.34 | 85.13 | 86.99 | 87.16 |
| Banking77 | 85.10 | 87.29 | 88.26 | 91.85 | 91.15 | 88.97 | 89.27 | 91.66 |
| FPB | 82.76 | 83.11 | 83.55 | 83.20 | 78.52 | 81.77 | 83.63 | 83.40 |
| GCN | 94.38 | 94.73 | 95.02 | 94.87 | 94.71 | 94.61 | 94.87 | 94.83 |
| Stooq | 76.53 | 73.33 | 80.25 | 84.08 | 69.81 | 74.05 | 81.32 | 83.03 |
| Average | 83.13 | 83.65 | 85.14 | 86.95 | 82.38 | 83.07 | 85.98 | 86.69 |
| Other Tasks | ||||||||
| 8TAGS | 76.15 | 77.81 | 78.03 | 80.69 | 72.17 | 74.41 | 79.21 | 80.86 |
| BAN-PL | 90.71 | 91.71 | 92.19 | 93.10 | 88.89 | 90.37 | 92.62 | 93.08 |
| MIPD | 54.30 | 57.65 | 58.58 | 67.11 | 64.96 | 66.95 | 64.39 | 68.03 |
| PPC | 81.76 | 84.16 | 87.05 | 84.40 | 66.54 | 80.10 | 86.02 | 85.70 |
| SICK-E | 83.98 | 85.17 | 86.71 | 86.31 | 75.34 | 84.35 | 86.31 | 86.61 |
| SICK-R | 73.79 | 77.82 | 82.58 | 83.16 | 52.13 | 66.38 | 83.16 | 83.77 |
| TwitterEMO | 65.19 | 67.41 | 66.46 | 69.02 | 61.93 | 63.23 | 68.75 | 69.52 |
| IMDB | 88.12 | 90.21 | 91.06 | 92.05 | 91.36 | 92.10 | 95.02 | 94.40 |
| EURLEX | 72.60 | 75.37 | 74.51 | 79.31 | 79.00 | 78.36 | 79.12 | 79.61 |
| NKJP-NER* | 84.36 | 85.49 | 85.41 | 85.54 | 84.76 | 83.82 | 88.97 | 89.21 |
| Average | 77.10 | 79.28 | 80.26 | 82.07 | 73.71 | 78.01 | 82.36 | 83.08 |
| Short Ctx Avg | 81.19 | 82.69 | 83.77 | 84.96 | 77.03 | 79.98 | 84.85 | 85.36 |
| LongContext | ||||||||
| SCOTUS-Dom | 75.36 | 78.80 | 79.12 | 82.81 | 83.45 | 79.83 | 79.26 | 84.48 |
| SCOTUS-Dec | 61.46 | 65.59 | 69.86 | 70.74 | 76.23 | 60.98 | 63.20 | 77.79 |
| BookSummary | 78.53 | 81.12 | 85.02 | 83.71 | 82.27 | 82.58 | 88.96 | 90.22 |
| ECtHR-PL-AVA | 22.04 | 43.90 | 33.65 | 61.42 | 62.47 | 60.26 | 64.66 | 68.01 |
| ECtHR-PL-VA | 16.38 | 40.26 | 20.65 | 59.29 | 57.09 | 61.45 | 41.28 | 65.27 |
| Long Ctx Avg | 50.75 | 61.93 | 57.66 | 71.59 | 72.30 | 69.02 | 67.47 | 77.15 |
| Overall Average | 76.12 | 79.23 | 79.42 | 82.73 | 76.24 | 78.15 | 81.95 | 83.99 |
BookSummary-specific part of the manual spot-check additionally assessed claim grammaticality, unambiguity, and consistency with the assigned label. The claim-generation prompts are provided in Appendix E.2.
Most test examples in each of the three dataset families exceed the 512-token limit; full length distributions are reported in Table 10.
4.2 Baselines
We compare Polish ModernBERT with established Polish encoder models, including HerBERT (Mroczkowski et al., 2021), Polish RoBERTa-v2 (Dadas et al., 2020b), and Polish RoBERTa-8K (Dadas et al., 2026), using Base and Large variants where available. We also include XLM-RoBERTa (Conneau et al., 2019) as an established multilingual encoder, together with the more recent EuroBERT (Boizard et al., 2025) and mmBERT (Marone et al., 2025), both of which provide native long-context support. On the LongContext benchmark, 512-token models serve as practical truncation baselines. Because the compared model families also differ in architecture and pretraining setup, these results should not be interpreted as a controlled ablation of context length alone.
Retrieval baselines. For retrieval evaluation, we use the Polish Information Retrieval Benchmark (PIRB) (Dadas et al., 2024), a suite of 41 Polish text-retrieval tasks. We compare Polish ModernBERT with Polish RoBERTa-8K, EuroBERT, and mmBERT. These encoder models are fine-tuned and evaluated using a shared contrastive-learning protocol. We additionally include Qwen3-Embedding-0.6B (Zhang et al., 2025), BGE-M3 (Chen et al., 2024), Jina-Embeddings-V5-Text-Small (Akram et al., 2026), Multilingual-E5-Large (Yu et al., 2025), and Snowflake-Arctic-Embed-L-v2.0 (Wang et al., 2024) as external reference points. These dedicated embedding models differ in their training data, objectives, and optimization procedures and are therefore not treated as controlled baselines.
4.3 Fine-Tuning and Evaluation Protocol
For the 30 tasks in KLEJ, FinBench, Other Tasks, and LongContext, we follow the fine-tuning protocol used for Polish RoBERTa and Polish RoBERTa-8K (Dadas et al., 2020b, 2026). We fine-tune each model–task configuration using five random seeds and report the mean test performance according to the task's primary metric. To quantify run-to-run variability, Table 15 reports aggregate mean scores and sample standard devia-
Table 4: Large-scale encoder results across 30 tasks. Formatting and notation follow Table 3.
| 512 tokens | 8K tokens | |||||||
|---|---|---|---|---|---|---|---|---|
| XLM-RoBERTaR(m) large (560M) | HerBERTB large (355M) | pl-RoBERTa-v2R large (435M) | pl-ModernBERTM large (475M) | EuroBERTL(m) 610m (610M) | mmBERTM(m) base (307M) | pl-RoBERTa-8KR large (443M) | pl-ModernBERT-8KM large (475M) | |
| KLEJ | ||||||||
| NKJP-NER | 94.68 | 96.07 | 95.75 | 95.05 | 89.59 | 92.34 | 95.64 | 94.38 |
| CDSC-E | 94.40 | 94.78 | 94.16 | 94.60 | 89.48 | 93.72 | 94.28 | 94.68 |
| CDSC-R | 94.75 | 95.01 | 95.25 | 95.14 | 91.14 | 93.12 | 95.33 | 94.47 |
| CBD | 66.91 | 70.21 | 73.10 | 72.60 | 54.58 | 52.55 | 73.23 | 71.47 |
| POLEMO-IN | 92.47 | 91.39 | 93.55 | 93.38 | 90.89 | 90.22 | 93.05 | 93.05 |
| POLEMO-OUT | 81.78 | 81.66 | 83.81 | 84.41 | 78.42 | 78.38 | 83.64 | 84.78 |
| DYK | 73.16 | 73.31 | 74.87 | 73.28 | 42.61 | 64.24 | 74.05 | 74.63 |
| PSC | 98.91 | 98.85 | 98.37 | 98.81 | 98.03 | 96.83 | 98.56 | 98.47 |
| AR | 88.53 | 89.23 | 89.36 | 89.07 | 86.19 | 87.16 | 88.91 | 88.88 |
| Average | 87.29 | 87.83 | 88.69 | 88.48 | 80.10 | 83.17 | 88.52 | 88.31 |
| FinBench | ||||||||
| Banking-Short | 71.56 | 81.80 | 81.69 | 82.07 | 78.04 | 77.33 | 81.99 | 81.94 |
| Banking-Long | 85.97 | 86.64 | 87.89 | 88.40 | 88.59 | 86.41 | 88.35 | 88.89 |
| Banking77 | 92.86 | 92.76 | 92.45 | 92.96 | 92.04 | 90.69 | 92.74 | 92.62 |
| FPB | 84.99 | 84.99 | 85.26 | 84.80 | 81.69 | 82.78 | 85.42 | 84.60 |
| GCN | 95.00 | 95.25 | 95.04 | 95.08 | 94.86 | 94.91 | 94.97 | 94.88 |
| Stooq | 82.26 | 82.53 | 85.07 | 85.77 | 81.43 | 82.04 | 84.41 | 84.02 |
| Average | 85.44 | 87.33 | 87.90 | 88.18 | 86.11 | 85.69 | 87.98 | 87.83 |
| Other Tasks | ||||||||
| 8TAGS | 79.74 | 81.16 | 81.64 | 82.50 | 75.32 | 76.43 | 81.44 | 82.24 |
| BAN-PL | 92.73 | 93.25 | 93.80 | 94.00 | 89.39 | 90.91 | 93.99 | 93.51 |
| MIPD | 67.57 | 66.79 | 67.27 | 68.28 | 70.88 | 69.17 | 68.50 | 68.99 |
| PPC | 87.92 | 89.78 | 89.96 | 88.04 | 78.56 | 83.86 | 89.48 | 87.20 |
| SICK-E | 87.70 | 87.33 | 88.33 | 87.88 | 82.03 | 86.58 | 88.96 | 87.47 |
| SICK-R | 83.47 | 84.37 | 85.93 | 84.69 | 67.77 | 75.32 | 86.54 | 84.91 |
| TwitterEMO | 70.16 | 70.51 | 70.70 | 70.20 | 65.50 | 66.26 | 70.60 | 70.35 |
| IMDB | 91.44 | 93.55 | 94.36 | 93.77 | 93.70 | 93.77 | 96.03 | 95.93 |
| EURLEX | 79.43 | 79.68 | 79.19 | 79.84 | 79.79 | 78.98 | 79.77 | 79.76 |
| NKJP-NER* | 86.23 | 87.79 | 84.62 | 86.84 | 86.53 | 86.67 | 87.36 | 88.66 |
| Average | 82.64 | 83.42 | 83.58 | 83.60 | 78.95 | 80.80 | 84.27 | 83.90 |
| Short Ctx Avg | 84.98 | 85.95 | 86.46 | 86.46 | 81.08 | 82.83 | 86.69 | 86.43 |
| LongContext | ||||||||
| SCOTUS-Dom | 81.03 | 82.49 | 83.01 | 83.83 | 84.20 | 82.32 | 83.99 | 85.78 |
| SCOTUS-Dec | 61.72 | 67.91 | 72.46 | 71.39 | 76.25 | 70.97 | 68.73 | 78.21 |
| BookSummary | 83.43 | 84.59 | 87.47 | 86.54 | 91.91 | 87.31 | 93.11 | 91.74 |
| ECtHR-PL-AVA | 58.63 | 60.23 | 58.33 | 64.62 | 68.49 | 62.93 | 68.29 | 69.48 |
| ECtHR-PL-VA | 54.55 | 56.07 | 51.17 | 61.50 | 65.97 | 63.69 | 65.27 | 67.24 |
| Long Ctx Avg | 67.87 | 70.26 | 70.49 | 73.58 | 77.36 | 73.44 | 75.88 | 78.49 |
| Overall Average | 82.13 | 83.33 | 83.80 | 84.31 | 80.46 | 81.27 | 84.89 | 85.11 |
tions across the same five runs for the principal matched Polish-model comparisons.
The common training setup comprises 10 epochs (1 for CBD), a batch size of 32, 6% linear warm-up, and polynomial learning-rate decay. Base models use a peak learning rate of . For Large models, we compare peak learning rates of and on the validation set and use for the final test evaluation. Models with standard and extended context lengths use maximum sequence lengths of 512 and 8,192 tokens, respectively, with longer inputs truncated to the corresponding limit. All task metrics are reported on a 0–100 scale.
5 Results
5.1 Encoder Performance
Tables 3 and 4 report results for the Base- and Large-scale models, respectively. At the Base scale, Polish ModernBERT achieves the strongest aggregate performance in both context settings. The 512-token model obtains a short-context average of 84.96, improving over Polish RoBERTa-v2 by 1.19 points, with the largest gains outside LongContext observed on FinBench and Other Tasks. Its 8K counterpart further increases the short-context average to 85.36 and achieves the highest overall score of 83.99. Aggregate means and run-to-run variability for the matched Polish models are reported in Table 15.
The gains are also broad at the task level. Considering both context variants, a Polish ModernBERT model attains the best Base-scale result on 17 of the 25 tasks outside LongContext, including 6 of 9 KLEJ tasks, 4 of 6 FinBench tasks, and 7 of 10 Other Tasks. The comparable short-context averages of the 512-token and 8K variants suggest that context extension does not degrade aggregate performance outside the dedicated LongContext benchmark. At the Large scale, Polish ModernBERT-512 and Polish RoBERTa-v2 obtain the same short-context average of 86.46. Among the 512-token models, Polish ModernBERT achieves the strongest FinBench and Other Tasks averages, while trailing Polish RoBERTa-v2 by only 0.21 points on KLEJ. The 8K variant reaches the highest overall score of 85.11 while retaining a short-context average comparable to Polish RoBERTa-8K (86.43 vs. 86.69). Across both context variants, the Large family provides the best result on 9 of the 25 tasks outside LongContext, with its strongest performance concentrated in FinBench and Other Tasks. Established Polish baselines nevertheless remain stronger on several KLEJ tasks.
On NKJP-NER*, both Polish 8K model families outperform their corresponding 512-token variants. At the Base scale, Polish RoBERTa improves from 85.41 to 88.97, while Polish ModernBERT improves from 85.54 to 89.21. At the Large scale, the corresponding gains are from 84.62 to 87.36 and from 86.84 to 88.66, respec-tively. Polish ModernBERT-8K achieves the highest score at both scales.
Across the two scale-specific comparisons, a Polish ModernBERT variant attains the highest task-level score in 35 of 60 cases, compared with 19 for the Polish RoBERTa family. Polish ModernBERT also substantially outperforms the recent multilingual EuroBERT and mmBERT variants in aggregate, underscoring the competitiveness of Polish-specific pretraining relative to modern multilingual encoders.
5.2 Long-Context Performance
The Polish ModernBERT-8K variants attain the best score in 9 of the 10 LongContext task-scale comparisons. At the Base scale, the 8K model reaches an average of 77.15, improving over the corresponding 512-token variant by 5.56 points and over Polish RoBERTa-8K by 9.68 points. It ranks first on all five tasks and achieves this improvement over Polish RoBERTa-8K with fewer parameters (149M vs. 190M).
At the Large scale, context extension improves the Polish ModernBERT average from 73.58 to 78.49. The resulting model exceeds Polish RoBERTa-8K-Large by 2.61 points and ranks first on four of five tasks; the only exception is BOOKSUMMARY, where Polish RoBERTa-8K obtains the highest score. The largest gains over the corresponding 512-token variants are observed on SCOTUS-DEC, BOOKSUMMARY, and the two ECTHR-PL tasks.
The gains are considerably smaller on existing datasets that contain long examples but were not designed specifically to evaluate long-document processing. Across BANKING-LONG, MIPD, IMDB, and EURLEX, the average improvement of the Polish ModernBERT-8K models over their corresponding 512-token variants is 0.86 points at the Base scale and 0.82 points at the Large scale, compared with 5.56 and 4.91 points on LongContext. This contrast supports distinguishing datasets that contain long inputs from tasks selected or constructed specifically to stress long-document processing. To further examine how model performance changes with input length, we report a bucket-level analysis for all LongContext tasks in Appendix C.3. The corresponding figures are shown in Figures 2 and 3, while the number of examples in each bucket is reported in Table 14.
5.3 Inference Efficiency
Polish ModernBERT provides favorable quality–efficiency trade-offs. All measurements were conducted using the same inference setup on a single NVIDIA H100 GPU; complete results are reported in Appendix D.
In the 512-token setting, Polish ModernBERT-Base improves the short-context average over Polish RoBERTa-v2-Base from 83.77 to 84.96, while reducing latency by and peak GPU memory usage by . At the Large scale, the models obtain the same short-context average of 86.46, but Polish ModernBERT reduces latency from 1.29 to 0.69 ms per sample and peak GPU memory usage from 3,604 to 2,946 MB, corresponding to reductions of and , respectively.
The efficiency gains persist in the 8K setting. Relative to Polish RoBERTa-8K-Base, Polish ModernBERT-8K-Base reduces peak GPU memory usage by and latency by , while improving the LongContext average from 67.47 to 77.15. At the Large scale, Polish ModernBERT-8K reduces memory usage by and latency by , while increasing the corresponding score from 75.88 to 78.49.
5.4 Retrieval Performance
We additionally evaluate retrieval performance on PIRB, a comprehensive Polish benchmark comprising 41 retrieval datasets. The encoder models are fine-tuned using a shared contrastive-learning protocol, with results reported in Table 5. Dedicated multilingual embedding models are included as external reference points in Appendix E.1, as they rely on different training data, objectives, and optimization protocols. We follow the pooling, normalization, similarity, and evaluation settings of the original PIRB protocol (Dadas et al., 2024).
Table 5: Mean NDCG@10 on PIRB across 41 datasets. Bold marks the best encoder within each size group.
| Model | NDCG@10 |
|---|---|
| Smaller models (<300M params) | |
| mmBERT-small (140M) | 48.25 |
| EuroBERT-210 (212M) | 52.14 |
| pl-RoBERTa-8K-base (190M) | 54.10 |
| pl-ModernBERT-8K-base (149M) | 55.36 |
| Larger models (>300M params) | |
| mmBERT-base (307M) | 52.39 |
| EuroBERT-610M (610M) | 56.52 |
| pl-RoBERTa-8K-large (443M) | 58.42 |
| pl-ModernBERT-8K-large (475M) | 58.16 |
6 Conclusion
We introduced Polish ModernBERT, a family of four Polish encoders covering Base and Large scales and 512-token and 8K context lengths, together with a staged pretraining procedure and a new five-task long-context benchmark. Across 30 downstream tasks, the proposed models achieve the strongest overall performance among the evaluated Polish encoders, with particularly large gains on long-document understanding. Polish ModernBERT-8K-Base outperforms the matched Polish RoBERTa-8K baseline by 9.68 points on LongContext while using fewer parameters (149M vs. 190M). The models also provide favorable inference efficiency, while Polish ModernBERT-8K-Base achieves the best PIRB result among the evaluated encoders below 300M parameters. These results show that modern, language-focused encoder architectures remain effective and computationally attractive for Polish language understanding and representation learning.
Limitations
Language scope. Our experiments focus exclusively on Polish. Although the staged pretraining procedure proved effective in this setting, its effectiveness may not transfer directly to languages with different linguistic properties, data availability, or tokenizer requirements. Evaluating the same procedure across additional languages would be necessary to establish its broader generality.
Evaluation coverage. The evaluation suite is dominated by classification tasks, particularly single-label classification, and includes only one sequence-labeling task. Although this setup follows earlier evaluations of Polish encoders (Dadas et al., 2026), it does not fully represent the range of applications for encoder models, such as reranking, span extraction, semantic search, or structured prediction. Broader evaluation across these task types would provide a more complete assessment of model capabilities.
Translated and generated evaluation data. Most LongContext tasks are derived from machine-translated English datasets, while BookSummary additionally relies on LLM-generated claims. Although we manually spot-checked 50 examples from each task and filtered degenerate outputs, this assessment was conducted by a single annotator and was intended as a quality-control check rather than a comprehensive human validation. Translation artifacts, model-specific generation patterns, or occasional label inconsistencies may therefore remain.
Moreover, four LongContext tasks are derived from publicly available English datasets, and their source documents and labels may have appeared in the pretraining data of some evaluated models. Translating the datasets into Polish reduces direct lexical overlap but does not eliminate the possibility of cross-lingual data contamination. BookSummary uses newly generated claims, although its underlying plot summaries are also publicly available. A larger-scale evaluation involving multiple annotators and agreement measurements, as well as the development of originally Polish long-document datasets, would strengthen the benchmark.
LongContext domain coverage. LongContext is weighted toward legal documents, reflecting an important real-world setting in which long-context processing is particularly relevant. However, this domain concentration may limit the generalizability of the benchmark conclusions. Future extensions should include additional long-document domains, such as finance, science, administration, and news.
Model-scale comparisons. The Base and Large variants use different tokenizers. Consequently, differences between model scales reflect both model capacity and tokenization and should not be interpreted as a controlled scaling study.
Ethical Considerations
The models and benchmarks introduced in this work are intended for research on Polish language understanding and document representation. Several LongContext tasks are derived from publicly available legal and human-rights datasets. Although these resources contain court documents, the released benchmark follows the structure of the corresponding public source datasets and is not intended for identifying individuals or making decisions about specific cases.
Machine translation and LLM-based claim generation may introduce systematic linguistic or factual artifacts. Moreover, performance on legal and human-rights classification tasks should not be interpreted as evidence that the models are suitable for autonomous legal decision-making. Model outputs may reflect biases present in the pretraining and evaluation data and should be independently verified in high-stakes applications.
Because the legal source documents may contain names or other identifying details already present in the public source datasets, the released benchmark should not be used for identifying individuals or profiling specific cases.
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 Polish high-performance computing infrastructure PLGrid (HPC Center: ACK Cyfronet AGH) for providing computer facilities and support within computational grant no. PLG/2025/018315
References
Mohammad Kalim Akram, Saba Sturua, Nastia Havriushenko, Quentin Herreros, Michael Günther, Maximilian Werk, and Han Xiao. 2026. jina-embeddings-v5-text: Task-targeted embedding distillation. arXiv preprint arXiv:2602.15547.
Zachary Ankner, Naomi Saphra, Davis Blalock, Jonathan Frankle, and Matthew Leavitt. 2024. Dynamic masking rate schedules for MLM pretraining. In Proceedings of the 18th Conference of the European Chapter of the Association for Computational Linguistics (Volume 2: Short Papers), pages 477–487, St. Julian's, Malta. Association for Computational Linguistics.
Iz Beltagy, Matthew E. Peters, and Arman Cohan. 2020. Longformer: The long-document transformer. ArXiv, abs/2004.05150.
Stanisław Bogdanowicz, Hanna Cwynar, Aleksandra Zwierzhowska, Cezary Klamra, Witold Kieraś, and Łukasz Kobyliński. 2023. Twitteremo: Annotating emotions and sentiment in polish twitter. In International Conference on Computational Science, pages 212–220. Springer.
Nicolas Boizard, Hippolyte Gisserot-Boukhlef, Duarte M. Alves, André Martins, Ayoub Hammal, Caio Corro, Céline Hudelot, Emmanuel Malherbe, Etienne Malaboeuf, Fanny Jourdan, Gabriel Hautreux, João Alves, Kevin El-Haddad, Manuel Faysse, Maxime Peyrard, Nuno M. Guerreiro, Patrick Fernandes, Ricardo Rei, and Pierre Colombo. 2025. Eurobert: Scaling multilingual encoders for european languages. Preprint, arXiv:2503.05500.
Lola Le Breton, Quentin Fournier, Mariam El Mezouar, John X. Morris, and Sarath Chandar. 2025. Neobert: A next-generation bert. Preprint, arXiv:2502.19587.
Iñigo Casanueva, Tadas Temčinas, Daniela Gerz, Matthew Henderson, and Ivan Vulić. 2020. Efficient intent detection with dual sentence encoders. In Proceedings of the 2nd Workshop on Natural Language Processing for Conversational AI, pages 38–45, Online. Association for Computational Linguistics.
Ilias Chalkidis, Manos Fergadiotis, Prodromos Malakasiotis, and Ion Androutsopoulos. 2019. Large-scale multi-label text classification on EU legislation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 6314–6322, Florence, Italy. Association for Computational Linguistics.
Ilias Chalkidis, Manos Fergadiotis, Dimitrios Tsarapatsanis, Nikolaos Aletras, Ion Androutsopoulos, and Prodromos Malakasiotis. 2021. Paragraph-level rationale extraction through regularization: A case study on european court of human rights cases. In Proceedings of the Annual Conference of the North American Chapter of the Association for Computational Linguistics, Mexico City, Mexico. Association for Computational Linguistics.
Jianlyu Chen, Shitao Xiao, Peitian Zhang, Kun Luo, Defu Lian, and Zheng Liu. 2024. M3-embedding: Multi-linguality, multi-functionality, multi-granularity text embeddings through self-knowledge distillation. In Findings of the association for computational linguistics: ACL 2024, pages 2318–2335.
Kevin Clark, Minh-Thang Luong, Quoc V. Le, and Christopher D. Manning. 2020. ELECTRA: Pretraining text encoders as discriminators rather than generators. In ICLR.
Alexis Conneau, Kartikay Khandelwal, Naman Goyal, Vishrav Chaudhary, Guillaume Wenzek, Francisco Guzmán, Edouard Grave, Myle Ott, Luke Zettlemoyer, and Veselin Stoyanov. 2019. Unsupervised cross-lingual representation learning at scale. arXiv preprint arXiv:1911.02116.
Yiming Cui, Wanxiang Che, Ting Liu, Bing Qin, and Ziqing Yang. 2021. Pre-training with whole word masking for chinese bert. IEEE/ACM Trans. Audio, Speech and Lang. Proc., 29:3504–3514.
Sławomir Dadas. 2022. Training effective neural sentence encoders from automatically mined paraphrases. In 2022 IEEE International Conference on Systems, Man, and Cybernetics (SMC), pages 371–378. IEEE.
Sławomir Dadas and Małgorzata Grębowiec. 2024. Assessing generalization capability of text ranking models in polish. In International Conference on Artificial Intelligence and Soft Computing, pages 37–49. Springer.
Sławomir Dadas, Michał Perełkiewicz, and Rafał Pościata. 2020a. Evaluation of sentence representations in Polish. In Proceedings of the Twelfth Language Resources and Evaluation Conference, pages 1674–1680, Marseille, France. European Language Resources Association.
Sławomir Dadas, Michał Perełkiewicz, and Rafał Pościata. 2020b. Pre-training polish transformer-based language models at scale. In International Conference on Artificial Intelligence and Soft Computing, pages 301–314. Springer.
Sławomir Dadas, Michał Perełkiewicz, and Rafał Pościata. 2024. PIRB: A comprehensive benchmark of Polish dense and hybrid text retrieval methods. In Proceedings of the 2024 Joint International Conference on Computational Linguistics, Language Resources and Evaluation (LREC-COLING 2024), pages 12761–12774, Torino, Italia. ELRA and ICCL.
Sławomir Dadas, Rafał Pościata, Marek Kozłowski, Małgorzata Grębowiec, Michał Perełkiewicz, Paweł Klimiuk, and Przemysław Boruta. 2026. Long-context encoder models for polish language understanding. Preprint, arXiv:2603.12191.
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171–4186, Minneapolis, Minnesota. Association for Computational Linguistics.
Angela Fan, Yacine Jernite, Ethan Perez, David Grangier, Jason Weston, and Michael Auli. 2019. Eli5: Long form question answering. In Proceedings of the 57th annual meeting of the association for computational linguistics, pages 3558–3567.
Mykola Haltiuk and Aleksander Smywiński-Pohl. 2025. On the path to make Ukrainian a high-resource language. In Proceedings of the Fourth Ukrainian Natural Language Processing Workshop (UNLP 2025), pages 120–130, Vienna, Austria (online). Association for Computational Linguistics.
Pengcheng He, Xiaodong Liu, Jianfeng Gao, and Weizhu Chen. 2020. DeBERTa: Decoding-enhanced BERT with Disentangled Attention. CoRR, abs/2006.03654.
Kenneth Heafield. 2011. Kenlm: Faster and smaller language model queries. In Proceedings of the sixth workshop on statistical machine translation, pages 187–197.
Junjie Hu, Sebastian Ruder, Aditya Siddhant, Graham Neubig, Orhan Firat, and Melvin Johnson. 2020. XTREME: A Massively Multilingual Multi-task Benchmark for Evaluating Cross-lingual Generalization. Preprint, arXiv:2003.11080.
Armand Joulin, Edouard Grave, Piotr Bojanowski, Matthijs Douze, Hérve Jégou, and Tomas Mikolov. 2016. Fasttext.zip: Compressing text classification models. arXiv preprint arXiv:1612.03651.
Armand Joulin, Edouard Grave, Piotr Bojanowski, and Tomas Mikolov. 2017. Bag of tricks for efficient text classification. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 2, Short Papers, pages 427–431, Valencia, Spain. Association for Computational Linguistics.
Daniel Khashabi, Amos Ng, Tushar Khot, Ashish Sabharwal, Hannaneh Hajishirzi, and Chris Callison-Burch. 2021. Gooaq: Open question answering with diverse answer types. In Findings of the Association for Computational Linguistics: EMNLP 2021, pages 421–433.
Łukasz Kobylński, Maciej Ogrodniczuk, Piotr Rybak, Piotr Przybyła, Piotr Peżik, Agnieszka Mikołajczyk, Wojciech Janowski, Michał Marciniczuk, and Aleksander Smywiński-Pohl. 2023. Poleval 2022/23 challenge tasks and results. In 2023 18th Conference on Computer Science and Intelligence Systems (FedC-SIS), pages 1243–1250. IEEE.
Jan Kocon, Piotr Miłkowski, and Monika Zaśko-Zielińska. 2019. Multi-level sentiment analysis of polemo 2.0: Extended corpus of multi-domain consumer reviews. In Proceedings of the 23rd Conference on Computational Natural Language Learning (CoNLL), pages 980–991.
Anna Kolos, Inez Okulska, Kinga Głąbińska, Agnieszka Karlinska, Emilia Wisnios, Paweł Ellerik, and Andrzej Prałat. 2024. BAN-PL: A Polish dataset of banned harmful and offensive content from wykop.pl web service. In Proceedings of the 2024 Joint International Conference on Computational Linguistics, Language Resources and Evaluation (LREC-COLING 2024), pages 2107–2118, Torino, Italia. ELRA and ICCL.
Taku Kudo and John Richardson. 2018. SentencePiece: A simple and language independent subword tokenizer and detokenizer for neural text processing. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 66–71, Brussels, Belgium. Association for Computational Linguistics.
Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. RoBERTa: A Robustly Optimized BERT Pretraining Approach.
Shayne Longpre, Gregory Yauney, Emily Reif, Katherine Lee, Adam Roberts, Barret Zoph, Denny Zhou, Jason Wei, Kevin Robinson, David Mimno, and Daphne Ippolito. 2024. A pretrainer’s guide to training data: Measuring the effects of data age, domain coverage, quality, & toxicity. In Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers), pages 3245–3276, Mexico City, Mexico. Association for Computational Linguistics.
Ilya Loshchilov and Frank Hutter. 2016. SGDR: Stochastic Gradient Descent with Restarts. ArXiv, abs/1608.03983.
Ilya Loshchilov and Frank Hutter. 2017. Decoupled Weight Decay Regularization. In International Conference on Learning Representations.
Andrew Maas, Raymond E Daly, Peter T Pham, Dan Huang, Andrew Y Ng, and Christopher Potts. 2011. Learning word vectors for sentiment analysis. In Proceedings of the 49th annual meeting of the association for computational linguistics: Human language technologies, pages 142–150.
Pekka Malo, Ankur Sinha, Pekka Korhonen, Jyrki Wallenius, and Pyry Takala. 2014. Good debt or bad debt: Detecting semantic orientations in economic texts. Journal of the Association for Information Science and Technology, 65(4):782–796.
Michał Marcinczuk, Marcin Ptak, Adam Radziszewski, and Maciej Piasecki. 2013. Open dataset for development of polish question answering systems. In Proceedings of the 6th Language & Technology Conference: Human Language Technologies as a Challenge for Computer Science and Linguistics, Wydawnictwo Poznanskie, Fundacja Uniwersytetu im. Adama Mickiewicza.
Marc Marone, Orion Weller, William Fleshman, Eugene Yang, Dawn Lawrie, and Benjamin Van Durme. 2025. mmBERT: A Modern Multilingual Encoder with Annealed Language Learning. Preprint, arXiv:2509.06888.
Arkadiusz Modzelewski, Giovanni Da San Martino, Pavel Savov, Magdalena Anna Wilczyńska, and Adam Wierzbicki. 2024. MIPD: Exploring manipulation and intention in a novel corpus of Polish disinformation. In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, pages 19769–19785, Miami, Florida, USA. Association for Computational Linguistics.
Robert Mroczkowski, Piotr Rybak, Alina Wróblewska, and Ireneusz Gawlik. 2021. HerBERT: Efficiently pretrained transformer-based language model for Polish. In Proceedings of the 8th Workshop on Balto-Slavic Natural Language Processing, pages 1–10, Kyiv, Ukraine. Association for Computational Linguistics.
Maciej Ogrodniczuk and Mateusz Kopeć. 2014. The Polish summaries corpus. In Proceedings of the Ninth
International Conference on Language Resources and Evaluation (LREC'14), pages 3712–3715, Reykjavik, Iceland. European Language Resources Association (ELRA).
Team OLMo, Pete Walsh, Luca Soldaini, Dirk Groeneveld, Kyle Lo, Shane Arora, Akshita Bhagia, Yuling Gu, Shengyi Huang, Matt Jordan, Nathan Lambert, Dustin Schwenk, Oyvind Tafjord, Taira Anderson, David Atkinson, Faeze Brahman, Christopher Clark, Pradeep Dasigi, Nouha Dziri, and 24 others. 2025. 2 olmo 2 furious. Preprint, arXiv:2501.00656.
Lucas F. A. O. Pellicer and Guilherme Rinaldo. 2026. NorBERTo: A ModernBERT model trained for Portuguese with 331 billion tokens corpus. In Proceedings of the 17th International Conference on Computational Processing of Portuguese (PROPOR 2026) - Vol. 1, pages 183–193, Salvador, Brazil. Association for Computational Linguistics.
Guilherme Penedo, Hynek Kydlíček, Amir Hossein Kargaran, and Leandro von Werra. 2026. Finetranslations. https://huggingface.co/datasets/HuggingFaceFW/finetranslations.
Telmo Pires, Eva Schlinger, and Dan Garrette. 2019. How multilingual is multilingual BERT? In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4996–5001.
Jacob Portes, Alexander Trott, Sam Havens, Daniel King, Abhinav Venigalla, Moin Nadeem, Nikhil Sardana, Daya Khudia, and Jonathan Frankle. 2023. Mo-saicBERT: A Bidirectional Encoder Optimized for Fast Pretraining. In Advances in Neural Information Processing Systems, volume 36, pages 3106–3130. Curran Associates, Inc.
Adam Przepiórkowski, Rafał L. Górski, Marek Łaziński, and Piotr Pęzik. 2010. Recent developments in the National Corpus of Polish. In Proceedings of the Seventh International Conference on Language Resources and Evaluation (LREC'10), Valletta, Malta. European Language Resources Association (ELRA).
Michal Ptaszynski, Agata Pieciukiewicz, and Paweł Dybała. 2019. Results of the PolEval 2019 Shared Task 6: first dataset and Open Shared Task for automatic cyberbullying detection in Polish Twitter, page 89–110. Polska Akademia Nauk.
Steven J. Rennie, Vaibhava Goel, and Samuel Thomas. 2014. Annealed dropout training of deep networks. In 2014 IEEE Spoken Language Technology Workshop (SLT), pages 159–164.
Akseli Reunamo, Laura-Maria Peltonen, Hans Moen, and Sampo Pyysalo. 2025. Pretraining Finnish ModernBERTs. Preprint, arXiv:2511.09213.
Sebastian Ruder, Noah Constant, Jan Botha, Aditya Siddhant, Orhan Firat, Jinlan Fu, Pengfei Liu, Junjie Hu, Dan Garrette, Graham Neubig, and Melvin Johnson. 2021. XTREME-R: Towards more challenging and nuanced multilingual evaluation. In Proceedings of the 2021 Conference on Empirical Methods in
Natural Language Processing, pages 10215–10245, Online and Punta Cana, Dominican Republic. Association for Computational Linguistics.
Piotr Rybak. 2023. Maupqa: Massive automatically-created polish question answering dataset. In Proceedings of the 9th Workshop on Slavic Natural Language Processing 2023 (SlavicNLP 2023), pages 11–16.
Piotr Rybak, Robert Mroczkowski, Janusz Tracz, and Ireneusz Gawlik. 2020. KLEJ: Comprehensive benchmark for Polish language understanding. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 1191–1201, Online. Association for Computational Linguistics.
Shaltiel Shmidman, Avi Shmidman, and Moshe Koppel. 2025. NeoDictaBERT: Pushing the Frontier of BERT models for Hebrew. Preprint, arXiv:2510.20386.
Ankur Sinha and Tanmay Khandait. 2021. Impact of news on the commodity market: Dataset and results. In Future of Information and Communication Conference, pages 589–601. Springer.
Harold J. Spaeth, Lee Epstein, Andrew D. Martin, Jeffrey A. Segal, Theodore J. Ruger, Sara C. Benesh, and Michael J. Nelson. 2020. Supreme court database, version 2020 release 01. Available at https://scdb.la.psu.edu/data/2020-release-01/.
Melik,sah Türker, A. Ebrar Kiziloglu, Onur Güngör, and Susan Üsküdarli. 2025. TabiBERT: A large-scale modernbert foundation model and unified benchmarking framework for turkish. ArXiv, abs/2512.23065.
Liang Wang, Nan Yang, Xiaolong Huang, Linjun Yang, Rangan Majumder, and Furu Wei. 2024. Multilingual e5 text embeddings: A technical report. arXiv preprint arXiv:2402.05672.
Benjamin Warner, Antoine Chaffin, Benjamin Clavié, Orion Weller, Oskar Hallström, Said Taghadouini, Alexis Gallagher, Raja Biswas, Faisal Ladhak, Tom Aarsen, Griffin Thomas Adams, Jeremy Howard, and Iacopo Poli. 2025. Smarter, better, faster, longer: A modern bidirectional encoder for fast, memory efficient, and long context finetuning and inference. In Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2526–2547, Vienna, Austria. Association for Computational Linguistics.
Guillaume Wenzek, Marie-Anne Lachaux, Alexis Conneau, Vishrav Chaudhary, Francisco Guzmán, Armand Joulin, and Edouard Grave. 2020. CCNet: Extracting high quality monolingual datasets from web crawl data. In Proceedings of the Twelfth Language Resources and Evaluation Conference, pages 4003–4012, Marseille, France. European Language Resources Association.
Alexander Wettig, Tianyu Gao, Zexuan Zhong, and Danqi Chen. 2023. Should you mask 15% in masked language modeling? In Proceedings of the 17th
Conference of the European Chapter of the Association for Computational Linguistics, pages 2985–3000, Dubrovnik, Croatia. Association for Computational Linguistics.
Konrad Wojtasik, Kacper Wołowiec, Vadim Shishkin, Arkadiusz Janz, and Maciej Piasecki. 2024. BEIR-PL: Zero shot information retrieval benchmark for the Polish language. In Proceedings of the 2024 Joint International Conference on Computational Linguistics, Language Resources and Evaluation (LREC-COLING 2024), pages 2149–2160.
Mitchell Wortsman, Tim Dettmers, Luke Zettlemoyer, Ari Morcos, Ali Farhadi, and Ludwig Schmidt. 2023. Stable and low-precision training for large-scale vision-language models. In Proceedings of the 37th International Conference on Neural Information Processing Systems, NIPS '23, Red Hook, NY, USA. Curran Associates Inc.
Alina Wróblewska and Katarzyna Krasnowska-Kieraś. 2017. Polish evaluation dataset for compositional distributional semantics models. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 784–792.
Puxuan Yu, Luke Merrick, Gaurav Nuti, and Daniel F Campos. 2025. Arctic-embed 2.0: Multilingual retrieval without compromise. In Second Conference on Language Modeling.
Manzil Zaheer, Guru Guruganesh, Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, and Amr Ahmed. 2020. Big bird: transformers for longer sequences. In Proceedings of the 34th International Conference on Neural Information Processing Systems, NIPS '20, Red Hook, NY, USA. Curran Associates Inc.
Yanzhao Zhang, Mingxin Li, Dingkun Long, Xin Zhang, Huan Lin, Baosong Yang, Pengjun Xie, An Yang, Dayiheng Liu, Junyang Lin, and 1 others. 2025. Qwen3 embedding: Advancing text embedding and reranking through foundation models. arXiv preprint arXiv:2506.05176.
A Corpus Composition and Cleaning
A.1 Domain Composition
To characterize the diversity of the pretraining data, we estimate the domain composition of the main corpus after cleaning and deduplication. Documents are assigned to topical categories using a lightweight multinomial Naive Bayes classifier operating on lemmatized document tokens represented as TF-IDF-weighted bag-of-words features. The classifier was trained on approximately 15 GB of Polish text assembled from public sources that could be mapped to specific domains and achieved validation accuracy.
Because several fine-grained labels are closely related and the classifier provides only approximate domain assignments, we aggregate them into broader categories to obtain more robust and interpretable corpus-level estimates. For reporting, predicted document-level labels are aggregated into the eight broad categories shown in Table 6, and category shares are computed by token count. The original classifier predicts 19 fine-grained domains, which are aggregated as follows: technology and social networks into Technology / Internet; science and engineering and biomedicine into Science / Biomedicine; humanities and social sciences, history, religion, and art into Humanities; finance and e-commerce into Finance / Commerce; lifestyle and entertainment, food, sport, and automotive content into Lifestyle; and housing and construction, agriculture, and other content into Home / Other. News remains a separate category, while law is reported under Law / Public Affairs.
The resulting statistics should therefore be interpreted as approximate corpus-level estimates rather than manual document-level annotations. No single domain dominates the token-weighted corpus. Common Crawl contains a larger share of news and technology-related content, while the curated corpus contains higher proportions of legal, scientific, and humanities text; FineTranslations is more evenly distributed across news, technology, science, and humanities.
Table 6: Approximate domain composition of the main pretraining corpus after cleaning and deduplication. Values denote token percentages within each corpus component; the Total column is computed as a token-weighted average using the component sizes reported in Table 2. Curated denotes the curated Polish corpus, CC denotes Common Crawl, and FineTran denotes FineTranslations.
| Domain | Curated | CC | FineTran | Total |
|---|---|---|---|---|
| News | 8.0 | 28.0 | 20.0 | 18.7 |
| Technology / Internet | 10.0 | 25.0 | 18.0 | 17.7 |
| Science / Biomedicine | 20.0 | 10.0 | 18.0 | 15.8 |
| Law / Public Affairs | 22.0 | 6.0 | 8.0 | 12.2 |
| Humanities | 18.0 | 8.0 | 14.0 | 13.2 |
| Finance / Commerce | 7.0 | 10.0 | 8.0 | 8.4 |
| Lifestyle | 8.0 | 9.0 | 6.0 | 7.8 |
| Home / Other | 7.0 | 4.0 | 8.0 | 6.2 |
A.2 Corpus Cleaning
All corpus components are processed with a shared cleaning and filtering pipeline. Documents are first segmented into sentences using NLTK-based sentence segmentation extended with Polish abbreviation lists. We then apply punctuation and whitespace normalization based on CCNet-style rules (Wenzek et al., 2020) and remove URLs. Sentences longer than 100 characters with less than alphabetic characters are discarded, and documents shorter than 500 characters are removed.
Language filtering is performed at the sentence level with a FastText-based language-identification model (Joulin et al., 2017, 2016). Sentences not assigned to Polish with sufficient confidence are removed, while the threshold is kept low to avoid discarding valid Polish sentences that may be difficult to classify reliably.
We additionally apply classifier-based quality filtering. The quality filter is a lightweight binary random-forest classifier implemented with scikit-learn. It uses 23 numeric features describing character-, word-, and sentence-level statistics of each document, including the proportion of letters, digits, whitespace and punctuation, capitalization patterns, word-length statistics, sentence-length statistics, and repetition features. The classifier was trained on 2,520 manually labeled Polish documents, consisting of 1,417 high-quality and 1,103 low-quality examples, using an 80/20 train–validation split. It achieved 96% validation accuracy. Documents classified as low quality are removed from the corpus.
Finally, we apply KenLM-based perplexity filtering (Heafield, 2011). Perplexity is computed with a lightweight statistical language model, and documents exceeding the selected perplexity threshold are discarded. This step is intended to remove documents with abnormal language-model scores, including noisy extraction artifacts, poorly encoded texts, and other low-quality content that may not be captured by the preceding filters.
Deduplication After cleaning, we apply exact and near-duplicate removal. Exact duplicates are removed using SHA-256 document hashes stored in a Bloom filter, which provides a memory-efficient way to track previously observed documents at corpus scale.
Near-duplicate removal is based on MinHash locality-sensitive hashing. Each document is converted into a set of unique word trigrams, represented with a 128-permutation MinHash signature. Candidate near-duplicate pairs are retrieved with LSH and grouped when their estimated Jaccard similarity exceeds 0.7. Within each near-duplicate cluster, we retain the document with the highest available quality score. If no quality score is available, we retain the earliest processed document. The final deduplicated corpus is then used to construct the main pretraining corpus and the stage-specific mixtures described in Section 3.2.
B Recipe-Selection Experiments
B.1 Direct Transfer of the ModernBERT Recipe
As an initial baseline, we trained a Polish ModernBERT-Base-8K model by directly adapting the original ModernBERT pretraining recipe (Warner et al., 2025). The baseline followed the original sequence of main pretraining, long-context continuation, and final learning-rate annealing as closely as possible, while using the same cleaned Polish data sources as the final models.
This experiment was intended to test whether the original recipe could be transferred to Polish without additional recipe selection. We therefore did not apply the staged modifications introduced in our final schedule, including the four-stage 512-token curriculum, stage-specific corpus refinement, progressive masking-ratio re- duction, and independently restarted learning-rate schedules.
Table 7: Validation performance of the direct-transfer ModernBERT recipe, averaged over five fine-tuning runs.
| Task group | Average |
|---|---|
| KLEJ (9 tasks) | 83.76 |
| FinBench (6 tasks) | 83.69 |
| KLEJ + FinBench (15 tasks) | 83.73 |
As shown in Table 7, the direct-transfer baseline achieved 83.76 on KLEJ, 83.69 on FinBench, and 83.73 on the combined 15-task development suite. While this represents a strong initial baseline, the staged search identified configurations with higher validation performance, motivating the final recipe-selection procedure described in Appendix B.2.
B.2 Pretraining Recipe Selection
Common training settings. Unless stated otherwise, all stages use decoupled StableAdamW (Wortsman et al., 2023; Loshchilov and Hutter, 2017) with , , , and weight decay . Bias and normalization parameters are excluded from weight decay. Training uses BF16 mixed precision and dynamic masking. At each stage transition, only the selected model parameters are carried over; the optimizer and learning-rate scheduler states are reinitialized. The data loader is also reinitialized with a new random seed, yielding a new document order, while masks are sampled dynamically throughout training. Gradient clipping with a threshold of 1.0 is applied in all stages except Stage I. Embedding and MLP dropout are disabled throughout training. Unless stated otherwise, the selected configuration at each stage uses an independently initialized cosine schedule with linear warm-up.
Checkpoint selection. Intermediate checkpoints are evaluated every 10% of the stage budget, starting at 30%. For each checkpoint and task, validation scores are averaged over five fine-tuning runs; the resulting task-level scores are then macro-averaged across KLEJ. For each configuration, we report the highest KLEJ average observed across its evaluated checkpoints. The best-performing configuration and checkpoint within each stage are propagated to the subsequent stage. Table 8 summarizes the explored configurations and selected variants.
Stage I: optimization schedule. We retained the original ModernBERT Base token-level MLM objective, masking probability of 0.30, and peak learning rate of (Warner et al., 2025). We compared warmup-stable-decay schedules with decay phases covering the final 5%, 10%, and 15% of training against cosine decay with 6% linear warm-up. All remaining settings were fixed. The corresponding average KLEJ scores were
Table 8: Recipe-selection experiments conducted on the Base model. Each stage starts from the checkpoint selected in the preceding stage. For each configuration, we report the highest KLEJ validation average observed across the evaluated checkpoints; task-level scores are averaged over five fine-tuning runs before macro-averaging across KLEJ. Bold indicates the configuration selected for continuation. For WSD variants, the percentage denotes the fraction of the stage allocated to learning-rate decay.
| Stage | Variant | Corpus | Objective | Masking | Peak LR | Attn. dropout | Avg. KLEJ |
|---|---|---|---|---|---|---|---|
| I | WSD-5% | Full | MLM | 0.30 | 0.10 | 82.87 | |
| I | WSD-10% | Full | MLM | 0.30 | 0.10 | 83.05 | |
| I | WSD-15% | Full | MLM | 0.30 | 0.10 | 83.18 | |
| I | Cosine | Full | MLM | 0.30 | 0.10 | 83.42 | |
| II | MLM-30 | Full | MLM | 0.30 | 0.10 | 83.88 | |
| II | MLM-15 | Full | MLM | 0.15 | 0.10 | 84.16 | |
| II | WWM-25 | Full | WWM | 0.25 | 0.10 | 84.48 | |
| II | WWM-15 | Full | WWM | 0.15 | 0.10 | 84.29 | |
| III | Full-corpus continuation | Full | WWM | 0.25 | 0.10 | 84.72 | |
| III | Curated corpus | Curated | WWM | 0.25 | 0.10 | 85.39 | |
| III | Curated + lower masking | Curated | WWM | 0.15 | 0.10 | 85.62 | |
| IV | Annealing | Annealing | WWM | 0.08 | 0.10 | 86.62 | |
| IV | Annealing without dropout | Annealing | WWM | 0.08 | 0.00 | 87.00 |
82.87, 83.05, 83.18, and 83.42, respectively. Cosine decay performed best and was retained for the subsequent stages.
Recipe selection was conducted on Base for 200K steps, with a nominal token budget of 64.4B. The selected schedule was transferred to Large using the original ModernBERT Large peak learning rate of and 250K steps, corresponding to a nominal token budget of 80.5B. The final Stage I checkpoints initialized Stage II.
Stage II: masking objective and ratio. Stage II compared token-level MLM with masking probabilities of 0.30 and 0.15 against whole-word masking (WWM) with probabilities of 0.25 and 0.15 (Cui et al., 2021). The corresponding average KLEJ scores were 83.88, 84.16, 84.48, and 84.29. WWM with a masking probability of 0.25 performed best and was selected for Stage III. This comparison was motivated by prior evidence that the optimal masking rate can depend on the objective and training stage (Wettig et al., 2023; Ankner et al., 2024).
All Stage II variants used the full pretraining corpus, maximum sequence length of 512, attention dropout of 0.1, and batch token capacity of approximately 1.6M. We restarted the learning-rate schedule with 6% linear warm-up and cosine decay, reducing the common peak learning rate to for both Base and Large. The stage ran for 200K steps for Base and 250K steps for Large, corresponding to nominal token budgets of 320B and 400B tokens. The selected checkpoints occurred at 80% and 90% of the respective stage budgets.
Stage III: corpus and masking refinement. Stage III evaluated the transition from the full corpus to the curated corpus and a lower WWM probability. Continuing on the full corpus with WWM probability 0.25 yielded an average KLEJ score of 84.72. Replacing it with the curated corpus increased the score to 85.39, while additionally reducing the masking probability to 0.15 produced 85.62. The latter configuration was selected for Stage IV. These experiments were motivated by evidence that corpus quality and composition can substantially affect pretraining outcomes (Longpre et al., 2024).
The stage used a maximum sequence length of 512, attention dropout of 0.1, a batch token capacity of approximately 966K, and a peak learning rate of . Training continued for 100K steps, corresponding to a nominal budget of 96.6B tokens. The selected checkpoints occurred at 70% of the stage budget for Base and 90% for Large.
Stage IV: annealing. The final 512-token stage introduced the annealing corpus, reduced the WWM probability from 0.15 to 0.08, and lowered the peak learning rate from to . This late-stage refinement follows related pretraining strategies used in ModernBERT and OLMo 2 (Warner et al., 2025; OLMo et al., 2025). The complete annealing configuration obtained an average KLEJ score of 86.62, compared with 85.62 for the selected Stage III checkpoint. Because the corpus, masking probability, and learning rate were modified jointly, this comparison measures the effect of the complete annealing configuration rather than isolating individual factors.
We subsequently compared attention dropout values of 0.1 and 0.0 (Rennie et al., 2014), while keeping the corpus, objective, masking ratio, learning rate, and training budget fixed. The corresponding average KLEJ scores were 86.62 and 87.00, respectively. Zero attention dropout was selected. The stage used a batch token capacity of approximately 966K and ran for 100K steps, corresponding to a nominal budget of 96.6B tokens. The selected checkpoint occurred at the end of training for Base and at 90% of the stage budget for Large. These checkpoints constitute the final 512-token models.
Context extension. The selected Stage IV checkpoints initialized the 8K variants. We retained the tokenizer, architecture, and pretrained parameters, increased the maximum sequence length from 512 to 8,192, and changed the global RoPE base from 10,000 to 160,000; the local RoPE base remained 10,000. Context extension used the dedicated long-context corpus, WWM with a masking probability of 0.30, and zero dropout. The schedule was restarted with a peak learning rate of , 6% linear warm-up, and cosine decay. The stage used a batch token capacity of approximately 491K and ran for 200K steps, corresponding to a nominal budget of 98.2B tokens. The selected checkpoints occurred at 70% and 80% of the stage budget for Base and Large, respectively.
C Evaluation Details
This appendix provides additional details on the evaluation datasets, task formulations, dataset splits, and the analysis of model performance across input-length ranges.
C.1 Task Overview
The evaluation suite comprises 30 tasks drawn from four benchmark groups: KLEJ, FinBench, Other Tasks, and LongContext. These tasks cover diverse formulations and domains, including classification, regression, sequence labeling, semantic similarity, finance, social media, legal documents, and literary texts. Tables 12 and 13 report macro-averaged performance grouped by task type and domain, respectively. Table 9 summarizes the complete task set together with the task type, domain, and primary evaluation metric.
Table 10 reports the number of test examples, token-length statistics, long-input shares, and unknown-token rates for all evaluation datasets. These statistics support the distinction between standard short-context tasks, datasets containing some long inputs, and the LongContext tasks designed to evaluate document-level processing.
C.2 LongContext and NKJP-NER* Dataset Splits
Table 11 summarizes the dataset splits used for the LongContext benchmark and the document-level NKJP-NER* analysis. For SCOTUS and ECtHR-PL, we retain the original train, validation, and test splits after translation and filtering. For BookSummary, we retain the longest 25% of summaries and split the resulting set into approximately 70%/10%/20% training, validation, and test partitions. NKJP-NER-SENT and NKJP-NER-DOC are derived from the same underlying NKJP texts and annotations, but differ in sentence- and document-level segmentation; no separate validation split is used for these variants.
C.3 Performance by Input Length
To complement the aggregate LongContext results, we analyze performance as a function of input length. For each task, test examples are grouped into four length buckets, and the mean task score is computed separately within each bucket. Input lengths are measured using the tokenizer of polish-roberta-base-v2 for all models, ensuring that each example is assigned to the same bucket across model comparisons.
The SCOTUS tasks use wider ranges because their examples are more evenly distributed across longer input sequences, whereas BookSummary and the ECtHR tasks contain a larger proportion of shorter examples. Table 14 reports the number and proportion of test examples assigned to each bucket. Figures 2 and 3 present the corresponding performance breakdowns for Base-and Large-scale models.
Length-dependent trends. The bucket-level results show that the relative performance of Polish ModernBERT is particularly consistent at the Base scale. Descriptively, it achieves the highest mean score in 18 of the 20 task–bucket comparisons for Base models, compared with 9 of 20 comparisons at the Large scale. The advantages at the Large scale are therefore more task-dependent, partly because the corresponding Polish RoBERTa and EuroBERT baselines are already strong.
The SCOTUS tasks do not exhibit a monotonic decline with increasing input length. On SCOTUS-Dom, scores generally increase for the intermediate-length buckets, and Polish ModernBERT-8K-Base obtains the highest score in three of the four ranges. The Large-scale results are more mixed: Polish RoBERTa-8K performs best in the 2K–4K and 4K–6K buckets, while Polish ModernBERT-8K achieves the strongest result for inputs longer than 6K. On SCOTUS-Dec, Polish ModernBERT-8K-Base leads in all four buckets. The Large variant leads in three buckets and is effectively tied with EuroBERT-610 in the 2K–4K range.
A clearer length-related degradation is observed on BookSummary and the ECtHR tasks. On BookSummary, Polish ModernBERT-8K-Base leads for inputs up to 2K tokens, whereas Polish RoBERTa-8K-Base performs best in the longest bucket. At the Large scale, Polish RoBERTa-8K obtains the highest score in all four BookSummary ranges, although the difference from Polish ModernBERT-8K remains small for inputs longer than 2K tokens. On both ECtHR tasks, Polish ModernBERT-8K-Base provides the strongest results across all length buckets. The Large-scale comparison is less uniform, but Polish ModernBERT remains competitive and obtains the best result in the longest ECtHR-PL-AVA bucket.
These patterns indicate that input length alone does not fully explain task difficulty: the SCOTUS results vary non-monotonically across buckets, whereas Book-Summary and ECtHR show more systematic declines for longer inputs. The results should also be interpreted together with the bucket sizes reported in Table 14, par-
Table 9: Overview of evaluation tasks grouped by benchmark source. Type and domain labels are used for aggregate analyses; metrics denote the primary score reported for each task.
| Task | Type | Domain | Metric |
|---|---|---|---|
| KLEJ Benchmark (Rybak et al., 2020) | |||
| NKJP-NER (Przepiórkowski et al., 2010) | single-label | mixed | Accuracy |
| CDSC-E (Wróblewska and Krasnowska-Kieraś, 2017) | single-label | semantics | Accuracy |
| CDSC-R (Wróblewska and Krasnowska-Kieraś, 2017) | regression | semantics | Spearman |
| CBD (Ptaszynski et al., 2019) | single-label | social media | Binary F1 |
| POLEMO-IN (Kocon et al., 2019) | single-label | reviews | Accuracy |
| POLEMO-OUT (Kocon et al., 2019) | single-label | reviews | Accuracy |
| DYK (Marcinczuk et al., 2013) | single-label | mixed | Binary F1 |
| PSC (Ogrodniczuk and Kopeć, 2014) | single-label | news | Binary F1 |
| AR (Rybak et al., 2020) | regression | reviews | 1 - wMAE |
| FinBench (Dadas et al., 2026) | |||
| Banking-Short (Dadas et al., 2026) | single-label | finance | Accuracy |
| Banking-Long (Dadas et al., 2026) | single-label | finance | Accuracy |
| Banking77 (Casanueva et al., 2020) | single-label | finance | Accuracy |
| FPB (Malo et al., 2014) | single-label | finance | Accuracy |
| GCN (Sinha and Khandait, 2021) | multi-label | finance | Weighted F1 |
| Stooq (Dadas et al., 2026) | single-label | finance | Accuracy |
| Other Tasks (Dadas et al., 2026) | |||
| 8TAGS (Dadas et al., 2020a) | single-label | soc. media | Accuracy |
| BAN-PL (Kolos et al., 2024) | single-label | soc. media | Accuracy |
| MIPD (Modzelewski et al., 2024) | multi-label | news | Weighted F1 |
| PPC (Dadas, 2022) | single-label | semantics | Accuracy |
| SICK-E (Dadas et al., 2020a) | single-label | semantics | Accuracy |
| SICK-R (Dadas et al., 2020a) | regression | semantics | Spearman |
| TwitterEMO (Bogdanowicz et al., 2023) | multi-label | soc. media | Weighted F1 |
| IMDB (Maas et al., 2011) | single-label | reviews | Accuracy |
| EURLEX (Chalkidis et al., 2019) | multi-label | law | Weighted F1 |
| NKJP-NER* (Przepiórkowski et al., 2010) | seq label | mixed | entity-lvl micro-F1 |
| LongContext (our) | |||
| SCOTUS-Dom (Spaeth et al., 2020) | single-label | law | Accuracy |
| SCOTUS-Dec (Spaeth et al., 2020) | single-label | law | Accuracy |
| BookSummary | single-label | literature | Accuracy |
| ECtHR-PL-AVA (Chalkidis et al., 2021) | multi-label | law | Weighted F1 |
| ECtHR-PL-VA (Chalkidis et al., 2021) | multi-label | law | Weighted F1 |
particularly for the longest BookSummary range, which contains only 101 test examples.
D Efficiency Analysis
We provide additional efficiency measurements for all evaluated encoder models. For each model, we report peak GPU memory usage, per-sample latency, and the corresponding average task score.
Measurement setup. All measurements were conducted on a single NVIDIA H100 GPU using BF16 precision. We used a batch size of 256 for the 512-token measurements on POLEMO2.0-IN and a batch size of 64 for the long-context measurements on SCOTUS-Dom. Each measurement was repeated five times, and we report the mean throughput and peak GPU memory usage across repetitions. GPU operations were synchronized before and after each timed region. Peak memory usage was measured using torch.cuda.max_memory_allocated() after resetting the peak-memory statistics. The timed region covered model inference and excluded tokenization. Within each setting, all compared models were evaluated on the same examples under an otherwise identical inference configuration.
Per-sample latency was derived as the inverse of throughput and expressed in milliseconds per sample. The 512-token measurements are based on POLEMO2.0-IN, whereas the long-context measurements are based on SCOTUS-Dom. Tables 17 and 18 provide the numerical results, while Figure 4 visualizes the quality–efficiency trade-offs.
Short-context models. In the 512-token setting, pl-ModernBERT-base achieves the lowest latency and peak memory usage among all evaluated short-context models, while also obtaining the highest average score among the base-size models. Compared with pl-RoBERTa-v2-base, it improves the average score from 83.77 to 84.96, reduces latency from 0.65 to 0.48 ms per sample, and lowers peak memory usage from 2,344 to 1,084 MB.
Table 10: Token-length statistics for the evaluation datasets, computed on the test splits using the Polish RoBERTa-v2 Base tokenizer used to train the Polish ModernBERT Base models. Test size denotes the number of test examples. Input length denotes the number of tokens per test example. Long-input share denotes the percentage of test examples exceeding each token-length threshold, and UNK denotes the percentage of tokenized pieces mapped to the unknown token. Slash-separated task names indicate tasks sharing the same input texts.
| Dataset | Test size | Input length (tokens) | Long-input share (%) | UNK (%) | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Mean | Median | P95 | Max | >512 | >1K | >2K | >4K | |||
| KLEJ | ||||||||||
| NKJP-NER | 2018 | 23 | 20 | 48 | 1003 | 0.1 | 0.0 | 0.0 | 0.0 | 1.2 |
| POLEMO2.0-IN | 722 | 183 | 163 | 381 | 719 | 1.5 | 0.0 | 0.0 | 0.0 | 1.3 |
| POLEMO2.0-OUT | 483 | 152 | 143 | 279 | 1894 | 0.4 | 0.2 | 0.0 | 0.0 | 1.5 |
| CBD | 2000 | 31 | 30 | 54 | 80 | 0.0 | 0.0 | 0.0 | 0.0 | 10.7 |
| CDSC-E / CDSC-R | 1000 | 36 | 35 | 54 | 90 | 0.0 | 0.0 | 0.0 | 0.0 | 0.1 |
| DYK | 1029 | 68 | 57 | 142 | 450 | 0.0 | 0.0 | 0.0 | 0.0 | 2.2 |
| AR | 1006 | 107 | 95 | 196 | 474 | 0.0 | 0.0 | 0.0 | 0.0 | 1.1 |
| PSC | 1078 | 212 | 189 | 376 | 543 | 0.7 | 0.0 | 0.0 | 0.0 | 0.9 |
| FinBench | ||||||||||
| Banking-Short | 2800 | 16 | 16 | 26 | 50 | 0.0 | 0.0 | 0.0 | 0.0 | 2.0 |
| Banking-Long | 2800 | 548 | 377 | 1593 | 7014 | 36.7 | 12.5 | 2.4 | 0.3 | 1.9 |
| Banking77 | 3080 | 21 | 18 | 46 | 132 | 0.0 | 0.0 | 0.0 | 0.0 | 2.1 |
| FPB | 970 | 47 | 43 | 85 | 141 | 0.0 | 0.0 | 0.0 | 0.0 | 2.1 |
| GCN | 2264 | 19 | 18 | 31 | 51 | 0.0 | 0.0 | 0.0 | 0.0 | 0.8 |
| Stooq | 363 | 95 | 79 | 194 | 611 | 0.3 | 0.0 | 0.0 | 0.0 | 0.8 |
| Other tasks | ||||||||||
| 8TAGS | 4372 | 20 | 17 | 38 | 100 | 0.0 | 0.0 | 0.0 | 0.0 | 1.8 |
| BAN-PL | 4000 | 47 | 27 | 137 | 3036 | 0.3 | 0.0 | 0.0 | 0.0 | 1.9 |
| EURLEX | 5000 | 2258 | 687 | 9508 | 243863 | 65.1 | 34.3 | 18.3 | 10.1 | 2.2 |
| IMDB | 2000 | 1244 | 1145 | 1896 | 4509 | 100.0 | 67.5 | 1.2 | 0.2 | 2.9 |
| MIPD | 1521 | 1156 | 790 | 3027 | 17098 | 77.0 | 37.7 | 10.8 | 2.8 | 2.3 |
| PPC | 1000 | 21 | 18 | 40 | 99 | 0.0 | 0.0 | 0.0 | 0.0 | 0.6 |
| SICK-E / SICK-R | 4906 | 20 | 18 | 34 | 66 | 0.0 | 0.0 | 0.0 | 0.0 | 0.1 |
| TwitterEMO | 4000 | 40 | 34 | 80 | 224 | 0.0 | 0.0 | 0.0 | 0.0 | 7.3 |
| NKJP-NER-SENT | 36079 | 15 | 12 | 36 | 214 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| NKJP-NER-DOC | 1828 | 295 | 278 | 340 | 2676 | 1.1 | 1.1 | 0.3 | 0.0 | 0.0 |
| LongContext | ||||||||||
| SCOTUS-Dom / Dec | 931 | 5534 | 6572 | 7758 | 57573 | 95.4 | 91.8 | 86.9 | 74.5 | 2.9 |
| BookSummary | 1248 | 1057 | 871 | 2423 | 5916 | 87.9 | 38.7 | 8.1 | 0.3 | 1.9 |
| ECtHR-PL-AVA / VA | 819 | 1454 | 1219 | 3172 | 6363 | 83.4 | 58.6 | 23.3 | 2.4 | 1.8 |
Table 11: Split sizes for LongContext datasets and NKJP-NER* variants. A dash indicates that no separate validation split is used.
| Task | Train | Valid | Test | Total |
|---|---|---|---|---|
| SCOTUS-Dom | 7,413 | 912 | 931 | 9,256 |
| SCOTUS-Dec | 7,413 | 912 | 931 | 9,256 |
| BookSummary | 4,460 | 620 | 1,248 | 6,328 |
| ECtHR-PL-AVA | 7,367 | 834 | 819 | 9,020 |
| ECtHR-PL-VA | 7,367 | 834 | 819 | 9,020 |
| NKJP-NER-SENT | 85,628 | - | 36,079 | 121,707 |
| NKJP-NER-DOC | 18,473 | - | 1,828 | 20,301 |
At the Large scale, pl-ModernBERT-large matches the average score of pl-RoBERTa-v2-large at 86.46, while reducing latency from 1.29 to 0.69 ms per sample and peak memory usage from 3,604 to 2,946 MB. This corresponds to approximately 47% lower latency, or equivalently about higher throughput, while preserving the same average task performance.
Long-context models. The long-context results show a similar trend. pl-ModernBERT-8K-base reaches a long-context average score of 77.15, outperforming pl-RoBERTa-8K-base by 9.68 points, while also using less memory and slightly lower latency. Among larger long-context models, pl-ModernBERT-8K-large obtains the highest long-context average score of 78.49. Compared with pl-RoBERTa-8K-large, it improves the score by 2.61 points, reduces latency from 28.97 ms to 21.69 ms per sample, and decreases peak memory usage from 22,166 MB to 17,554 MB.
E Retrieval experiments
One of the common applications of encoder-only models is dense text retrieval. We therefore evaluate how Polish ModernBERT performs in this setting relative to other encoders supporting Polish. We first apply contrastive fine-tuning to all models using a training corpus
Table 12: Macro-average performance grouped by task type. Averages are computed over 20 single-label, 6 multi-label, 3 regression, and 1 sequence-labeling tasks. Best results within each model-scale block are shown in bold; underlined values indicate the best result among models using the same context length.
| Task type | 512 tokens | 8K tokens | ||||||
|---|---|---|---|---|---|---|---|---|
| XLM-RoBERTa(m) | HerBERT | pl-RoBERTa-v2 | pl-ModernBERT | EuroBERT(m) | mmBERT(m) | pl-RoBERTa-8K | pl-ModernBERT | |
| Base models | ||||||||
| single-label | 81.01 | 82.63 | 84.16 | 84.98 | 77.85 | 79.72 | 84.52 | 85.95 |
| multi-label | 54.15 | 63.22 | 58.14 | 71.84 | 67.45 | 70.07 | 66.34 | 74.21 |
| regression | 84.74 | 86.47 | 88.35 | 88.60 | 75.09 | 80.48 | 88.70 | 88.76 |
| sequence labeling | 84.36 | 85.49 | 85.41 | 85.54 | 84.76 | 83.82 | 88.97 | 89.21 |
| Large models | ||||||||
| single-label | 84.28 | 85.75 | 86.85 | 86.70 | 81.84 | 82.98 | 87.05 | 87.28 |
| multi-label | 70.89 | 71.42 | 70.28 | 73.25 | 74.25 | 72.29 | 71.98 | 75.12 |
| regression | 88.92 | 89.54 | 90.18 | 89.63 | 81.70 | 85.20 | 90.26 | 89.42 |
| sequence labeling | 86.23 | 87.79 | 84.62 | 86.84 | 86.53 | 86.67 | 87.36 | 88.66 |
Table 13: Macro-average performance grouped by domain. Averages are computed over 3 mixed-domain, 5 semantic, 4 social-media, 4 review, 6 financial, 2 news, 5 legal, and 1 literary task. Best available results within each model-scale block are shown in bold; underlined values indicate the best available result among models using the same context length.
| Domain | 512 tokens | 8K tokens | ||||||
|---|---|---|---|---|---|---|---|---|
| XLM-RoBERTa(m) | HerBERT | pl-RoBERTa-v2 | pl-ModernBERT | EuroBERT(m) | mmBERT(m) | pl-RoBERTa-8K | pl-ModernBERT | |
| Base models | ||||||||
| mixed | 80.58 | 82.81 | 83.37 | 82.27 | 68.45 | 74.36 | 84.16 | 83.66 |
| semantics | 85.28 | 87.04 | 89.01 | 88.53 | 75.01 | 82.93 | 88.99 | 88.92 |
| social media | 73.22 | 75.82 | 76.81 | 77.84 | 68.51 | 69.51 | 77.48 | 78.71 |
| reviews | 86.31 | 86.60 | 87.24 | 89.31 | 84.45 | 85.73 | 88.90 | 89.51 |
| finance | 83.13 | 83.65 | 85.14 | 86.95 | 82.38 | 83.07 | 85.98 | 86.69 |
| news | 76.1 | 78.3 | 78.73 | 82.45 | 80.13 | 82.03 | 81.65 | 82.86 |
| law | 49.57 | 60.78 | 55.56 | 70.71 | 68.56 | 67.29 | 62.50 | 75.03 |
| literature | 78.53 | 81.12 | 85.02 | 83.71 | 82.27 | 82.58 | 88.96 | 90.22 |
| Large models | ||||||||
| mixed | 84.69 | 85.72 | 85.08 | 85.06 | 72.91 | 81.08 | 85.68 | 85.89 |
| semantics | 89.65 | 90.25 | 90.73 | 90.07 | 81.80 | 86.52 | 90.92 | 89.75 |
| social media | 77.38 | 78.78 | 79.81 | 79.83 | 71.20 | 71.54 | 79.81 | 79.39 |
| reviews | 88.55 | 88.96 | 90.27 | 90.16 | 87.30 | 87.38 | 90.41 | 90.66 |
| finance | 85.44 | 87.33 | 87.90 | 88.18 | 86.11 | 85.69 | 87.98 | 87.82 |
| news | 83.24 | 82.82 | 82.82 | 83.55 | 84.45 | 83.00 | 83.53 | 83.73 |
| law | 67.07 | 69.28 | 68.83 | 72.24 | 74.94 | 71.34 | 70.11 | 76.09 |
| literature | 83.43 | 84.59 | 87.47 | 86.54 | 91.91 | 87.31 | 93.11 | 91.74 |
composed of Polish retrieval datasets. We then evaluate the resulting models on PIRB (Dadas et al., 2024), a comprehensive Polish retrieval benchmark spanning 41 datasets. PIRB consolidates previously introduced evaluation suites, including BEIR-PL (Wojtasik et al., 2024), MaupQA (Rybak, 2023), and PolEval-2022 retrieval challenge (Kobylinski et al., 2023), and extends them with 10 new datasets.
Because PIRB includes datasets containing long documents, we restricted the comparison to models supporting a context length of 8K tokens. The fine-tuning corpus comprised 12 datasets. Nine of these were training splits from datasets included in Polish BEIR (Wojtasik et al., 2024): MS MARCO, SciFact, SciDocs, Natural Questions, NFCorpus, HotpotQA, FiQA, FEVER, and ArguAna. We additionally included Polish translations of ELI5 (Fan et al., 2019) and GooAQ (Khashabi et al., 2021), as well as the Polish ZnanyLekarz dataset (Dadas and Grębowiec, 2024). In total, the corpus contained approximately 4.5 million queries and more than 15 million passages. We fine-tuned each model for 10 epochs using contrastive learning with in-batch negatives and a batch size of 1024. We used a learning rate scheduler with 200 warmup steps, a maximum learning rate of , and linear decay.
For each model, we report the mean NDCG@10 score across all 41 retrieval datasets. Table 5 presents the encoders fine-tuned using our shared contrastive-learning protocol, divided into two size groups using 300M parameters as the cutoff. Table 19 provides additional context through external PIRB results for dedicated multilingual embedding models, including Qwen3-Embedding (Zhang et al., 2025), BGE-M3 (Chen et al., 2024), Jina-Embeddings-V5 (Akram et al., 2026), Multilingual-E5 (Yu et al., 2025), and Snowflake-Arctic (Wang et al., 2024).
Under the shared fine-tuning protocol, the monolingual Polish encoders outperform the multilingual mmBERT and EuroBERT models in both size groups. Among the smaller models, Polish ModernBERT-8K-Base achieves the highest score, outperforming Polish RoBERTa-8K-Base by 1.26 NDCG@10 points (55.36 vs. 54.10). At the larger scale, the two Polish encoders obtain comparable results, with Polish RoBERTa-8K-Large slightly outperforming Polish ModernBERT-8K-Large by 0.26 points (58.42 vs. 58.16).
Table 14: Input-length bucket definitions and test-set distributions for the SCOTUS, BookSummary, and ECtHR-PL LongContext tasks. SCOTUS-Dom and SCOTUS-Dec share the same input documents, as do ECtHR-PL-AVA and ECtHR-PL-VA; therefore, example counts are reported jointly for each task pair.
| Dataset | Bucket | N | Share (%) |
|---|---|---|---|
| SCOTUS-Dom/Dec | <2K | 122 | 13.10 |
| 2K-4K | 115 | 12.35 | |
| 4K-6K | 154 | 16.54 | |
| >6K | 540 | 58.00 | |
| BookSummary | <512 | 151 | 12.10 |
| 512-1K | 614 | 49.20 | |
| 1K-2K | 382 | 30.61 | |
| >2K | 101 | 8.09 | |
| ECtHR-PL-AVA/VA | <512 | 136 | 16.61 |
| 512-1K | 203 | 24.79 | |
| 1K-2K | 289 | 35.29 | |
| >2K | 191 | 23.32 |
The fine-tuned Polish encoders also compare favorably with dedicated multilingual embedding models. The Polish models were adapted using only the shared contrastive-learning procedure, whereas dedicated embedding models may rely on more elaborate multistage pipelines involving retrieval-oriented pretraining, knowledge distillation, or additional training data. Nevertheless, both larger Polish encoders outperform all dedicated embedding baselines included in the comparison except Snowflake-Arctic-Embed-L-v2.0, which achieves the highest overall score of 59.22.
E.1 Reference Embedding Models
We additionally report dedicated multilingual embedding models as external reference points for the PIRB score range. These models are not treated as directly comparable baselines because they differ from the shared-protocol encoders in training data, objectives, and evaluation setup. As shown in Table 19, their scores range from 50.71 to 59.22 NDCG@10, with Snowflake-Arctic-Embed-L-v2.0 obtaining the highest result.
E.2 BookSummary Claim-Generation Prompts
The BookSummary task was constructed using a two-stage generation procedure. First, GLM-4.6 generated a short claim supported by the corresponding plot summary, with an explicit preference for information appearing in the second half of the document. Second, the model transformed the supported claim into a closely matched but factually inconsistent claim. Because the documents and generated claims were in Polish, both prompts were executed in Polish. English translations are provided below for readability, followed by the original Polish prompts used during dataset construction. The English versions were not used for generation. The placeholders {{doc}} and {{claim}} denote the plot summary and the previously generated supported claim, respectively.
E.2.1 Supported-Claim Generation English translation.
System message.
Based on the document below, generate one short claim consisting of 2–3 sentences. Requirements:
-
The claim must be consistent with the content of the document.
-
The claim should concern one or two facts from the document.
• The claim should consist of 2–3 sentences.
- The claim must be unambiguous and verifiable solely on the basis of the document.
• Do not use external knowledge.
• Do not quote the document verbatim.
-
The claim should describe important information from the document.
-
Whenever possible, focus the claim on facts appearing in the second half of the document.
-
Return only the claim, without any additional comments.
User message.
{{doc}}
Original Polish prompt.
System message.
Na podstawie poniższego dokumentu wygeneruj jedno krótkie, 2–3 zdaniowe stwierdzenie. Wymagania:
-
Twierdzenie musi być zgodne z treścią dokumentu.
-
Twierdzenie powinno dotyczyć jednego lub dwóch faktów z artykułu.
-
Twierdzenie powinno mieć długość 2 lub 3 zdań.
-
Twierdzenie musi być jednoznaczne i możliwe do zweryfikowania wyłącznie na podstawie dokumentu.
• Nie należy używać wiedzy zewnętrznej.
• Nie należy cytować dokumentu dośłownie.
-
Twierdzenie powinno opisywać istotną informację z dokumentu.
-
Postaraj się, jeśli to możliwe, żeby stwierdzenie skupiało się na faktach z drugiej połowy dokumentu.
-
Zwróć wyłącznie treść stwierdzenia bez dodatkowych komentarzy.
User message.
{{doc}}
E.2.2 Unsupported-Claim Generation English translation.
System message. Based on the document and the provided claim, generate a new false claim that is highly similar to the original one but inconsistent with the content of the document. Requirements:
-
Preserve a similar length, style, and structure.
-
The claim should still consist of 2–3 sentences.
Table 15: Mean scores and sample standard deviations across five fine-tuning runs for the principal matched Polish-model comparisons. Aggregate scores are computed independently for each random seed and then summarized across seeds. All metrics are reported on a 0–100 scale. Boldface marks the higher mean within each matched RoBERTa–ModernBERT pair.
| Model | Short-context Avg | LongContext Avg | Overall Avg |
|---|---|---|---|
| Base scale | |||
| pl-RoBERTa-v2-base | |||
| pl-ModernBERT-base | |||
| pl-RoBERTa-8K-base | |||
| pl-ModernBERT-8K-base | |||
| pl-RoBERTa-v2-large | |||
| pl-ModernBERT-large | |||
| pl-RoBERTa-8K-large | |||
| pl-ModernBERT-8K-large | |||
Table 16: Performance by input length across all LongContext tasks. Each cell reports the mean score and standard deviation across the available fine-tuning runs. Boldface marks the highest mean within each model-scale group for a given length bucket. Bucket definitions and example counts are provided in Table 14.
| Task | Length | Base scale | Large scale | ||||||
|---|---|---|---|---|---|---|---|---|---|
| EuroBERT 210m | mmBERT small | pl-RoBERTa 8K-base | pl-ModernBERT 8K-base | EuroBERT 610m | mmBERT base | pl-RoBERTa 8K-large | pl-ModernBERT 8K-large | ||
| SCOTUS-DOM | ≤2K | ||||||||
| 2K–4K | |||||||||
| 4K–6K | |||||||||
| >6K | |||||||||
| SCOTUS-DEC | ≤2K | ||||||||
| 2K–4K | |||||||||
| 4K–6K | |||||||||
| >6K | |||||||||
| BOOKSUMMARY | ≤512 | ||||||||
| 512–1K | |||||||||
| 1K–2K | |||||||||
| >2K | |||||||||
| ECTHR-PL-AVA | ≤512 | ||||||||
| 512–1K | |||||||||
| 1K–2K | |||||||||
| >2K | |||||||||
| ECTHR-PL-VA | ≤512 | ||||||||
| 512–1K | |||||||||
| 1K–2K | |||||||||
| >2K | |||||||||
-
The factual inconsistency should be easy to verify using the passages of the document to which the supported claim refers.
-
The inconsistency should not be limited to a single fact, but should more broadly contradict the facts stated in the original claim.
-
Do not introduce new information unrelated to the document.
-
Do not explain the introduced changes.
Return only the new claim.
User message.
Document: {{doc}}
Original claim: {{claim}}
Original Polish prompt.
System message. Na podstawie dokumentu oraz podanego stwierdzenia wygeneruj nowe, fałszywe stwierdzenie, które będzie bardzo podobne do oryginalnego, ale będzie niezgodne z treścią dokumentu. Wymagania:
-
Zachowaj podobną długość, styl i strukturę.
-
Twierdzenie powinno nadal składać się z 2–3 zdań.
-
Fałszywość stwierdzenia powinna być latwo zweryfikowana na podstawie fragmentów treści dokumentu, do których odnosi się prawdziwe stwierdzenie.
-
Fałszywość nie powinna dotyczyć jednego faktu, ale raczej powinna szerzej zaprzeczać faktom w oryginalnym stwierdzeniu.
-
Nie dodawaj nowych informacji, które nie są związane z dokumentem.
-
Nie wyjaśniaj wprowadzonych zmian.
Zwróć wyłącznie nowe stwierdzenie.
User message.
Dokument: {{doc}}
Oryginalne stwierdzenie: {{claim}}
Table 17: Efficiency measurements for 512-token encoder models. Latency denotes per-sample latency derived from throughput on POLEMO2.0-IN, and memory denotes the observed peak memory usage during inference. The final column reports the average over the short-context tasks.
| Model | Memory [MB] | Latency [ms/sample] | Short-context avg. |
|---|---|---|---|
| XLM-RoBERTa-base | 2,764 | 0.71 | 81.19 |
| HerBERT-base | 1,784 | 0.74 | 82.69 |
| pl-RoBERTa-v2-base | 2,344 | 0.65 | 83.77 |
| pl-ModernBERT-base | 1,084 | 0.48 | 84.96 |
| XLM-RoBERTa-large | 4,144 | 1.50 | 84.98 |
| HerBERT-large | 3,304 | 1.49 | 85.95 |
| pl-RoBERTa-v2-large | 3,604 | 1.29 | 86.46 |
| pl-ModernBERT-large | 2,946 | 0.69 | 86.46 |
Table 18: Efficiency measurements for long-context encoder models. Latency denotes per-sample latency derived from throughput on SCOTUS-Dom, and memory denotes the observed peak GPU memory usage during inference. The final column reports the average over the five LongContext tasks.
| Model | Memory [MB] | Latency [ms/sample] | LongContext avg. |
|---|---|---|---|
| EuroBERT-210m | 14,286 | 22.57 | 72.30 |
| mmBERT-small | 8,546 | 12.12 | 69.02 |
| pl-RoBERTa-8K-base | 12,208 | 14.91 | 67.47 |
| pl-ModernBERT-8K-base | 9,250 | 13.98 | 77.15 |
| EuroBERT-610m | 19,670 | 57.63 | 77.36 |
| mmBERT-base | 11,500 | 17.04 | 73.44 |
| pl-RoBERTa-8K-large | 22,166 | 28.96 | 75.88 |
| pl-ModernBERT-8K-large | 17,554 | 21.69 | 78.49 |
Table 19: Mean NDCG@10 on PIRB for dedicated multilingual embedding models.
| Model | NDCG@10 |
|---|---|
| Qwen3-Embedding-0.6B (596M) | 50.71 |
| BGE-M3 (568M) | 55.98 |
| Jina-Embeddings-V5-Text-Small (677M) | 57.19 |
| Multilingual-E5-Large (560M) | 57.29 |
| Snowflake-Arctic-Embed-L-v2.0 (568M) | 59.22 |
SCOTUS-Dom — Base models

(a) SCOTUS-DOM: Base models.
SCOTUS-Dec — Base models
SCOTUS-Dom — Large models
(b) SCOTUS-DOM: Large models.

(c) SCOTUS-DEC: Base models.
SCOTUS-Dec — Large models
(d) SCOTUS-DEC: Large models.
BookSummary — Base models

(e) BOOKSUMMARY: Base models.
BookSummary — Large models

(f) BOOKSUMMARY: Large models.
Figure 2: Performance by input length on the SCOTUS-Dom, SCOTUS-Dec, and BookSummary LongContext tasks. Each point shows the mean test score for examples within the corresponding length bucket. Results are presented separately for Base and Large models. Bucket definitions and example counts are provided in Table 14.

(a) ECTHR-PL-AVA: Base models.

(b) ECTHR-PL-AVA: Large models.

(c) ECTHR-PL-VA: Base models.

(d) ECTHR-PL-VA: Large models.
Figure 3: Performance by input length on the ECtHR-PL-AVA and ECtHR-PL-VA LongContext tasks. Each point shows the mean test score for examples within the corresponding length bucket. Results are presented separately for Base and Large models. Bucket definitions and example counts are provided in Table 14, and detailed results with variability across runs are reported in Table 16.

(a) Short-context setting (512 tokens)
(b) Long-context setting (8K tokens)
Model family
pl-ModernBERT / pl-ModernBERT-8K
pl-RoBERTa-v2 / pl-RoBERTa-8K
HerBERT / EuroBERT
XLM-RoBERTa / mmBERT
Model size
Base (smaller)
Large (larger)
Peak memory (approx.)
1/8 GB 2/16 GB
4/24 GB
1/8 GB 2/16 GB
4/24 GB
Figure 4: Quality–efficiency trade-offs for the evaluated encoder models on Polish tasks. The x-axis shows latency per sample (lower is better), the y-axis shows the average task score (higher is better), marker size reflects peak memory usage, and marker shape distinguishes Base and Large variants. Panel (a) presents short-context results, while panel (b) shows long-context results. Marker sizes are scaled separately for the two panels; slash-separated model-family names and memory labels correspond to panels (a) and (b), respectively.