While decoder-only Large Language Models (LLMs) have recently dominated the NLP landscape, encoder-only architectures remain a cost-effective and parameter-efficient standard for discriminative tasks. However, classic encoders like BERT are limited by a short context window, which is insufficient for processing long documents. In this paper, we address this limitation for the Polish by introducing a high-quality Polish model capable of processing sequences of up to 8192 tokens. The model was developed by employing a two-stage training procedure that involves positional embedding adaptation and full parameter continuous pre-training. Furthermore, we propose compressed model variants trained via knowledge distillation. The models were evaluated on 25 tasks, including the KLEJ benchmark, a newly introduced financial task suite (FinBench), and other classification and regression tasks, specifically those requiring long-document understanding. The results demonstrate that our model achieves the best average performance among Polish and multilingual models, significantly outperforming competitive solutions in long-context tasks while maintaining comparable quality on short texts.
Figures & tables
Model
Size
Size excluding embedding
Encoder layers
GFLOPs
polish-roberta-8k
443M
303M
24
167.5
polish-roberta-8k-12L
291M
152M
12
83.8
polish-roberta-8k-6L
216M
77M
6
41.9
sdadas/polish-roberta-base-v2
124M
86M
12
48.3
allegro/herbert-base-cased
124M
86M
12
48.3
FacebookAI/xlm-roberta-base
278M
86M
12
48.3
Table 1: Comparison of encoder architectures for the Polish language. The upper section of the table presents our trained models with extended context, while the lower section lists popular base-sized models supporting Polish. We report the model size in terms of total parameters and parameters excluding the embedding layer, the number of encoder layers, and the estimated number of floating-point operations required for a single forward pass with a sequence length of 512 tokens.
Task type
Domain
Metric
Task name
HerBERT
RoBERTa V2
RoBERTa 8K
KLEJ Benchmark
single-label
mixed
accuracy
NKJP-NER
96.07
95.75
95.64
single-label
semantics
accuracy
CDSC-E
94.78
94.16
94.28
regression
semantics
spearman
CDSC-R
95.01
95.25
95.33
single-label
soc.media
binary-F1
CBD
70.21
73.10
73.23
single-label
reviews
accuracy
POLEMO-IN
91.39
93.55
93.05
Table 2: A detailed comparison of fine-tuning polish-roberta-8k , polish-roberta-large-v2 , and herbert-large-cased models on 25 tasks. The reported scores are averaged across five independent training runs.
Model
Size
KLEJ
FinBench
Other tasks
Long tasks
All tasks
9 tasks
7 tasks
9 tasks
4 tasks
25 tasks
Bigger models (>300M params)
EuroBERT/EuroBERT-610m
608M
80.10
78.36
78.10
83.24
78.89
jhu-clsp/mmBERT-base
307M
83.17
76.59
80.14
82.08
80.24
FacebookAI/xlm-roberta-large
560M
87.29
79.17
82.24
81.10
83.20
allegro/herbert-large-cased
355M
87.83
83.60
82.94
81.67
84.88
Table 3: Comparison of Polish and multilingual models.
Model
Size (params)
Context (tokens)
Banking e-mails
Mortgage agreements
herbert-large-cased (baseline)
355M
512
82%
93%
polish-roberta-8k (original)
443M
8192
88%
95%
polish-roberta-8k (domain-adapted)
443M
8192
90%
95%
Table 4: Evaluation on bank’s internal classification datasets.
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.
Michał Perełkiewicz, Sławomir Dadas, Rafał Poświata +1
National Information Processing Institute, Warsaw, Poland
Encoder-only transformer models remain essential for production NLP pipelines. We introduce moBERTo, a Portuguese adaptation of ModernBERT obtained through continued pretraining of the ModernBERT-base checkpoint on 60 billion tokens (5 epochs over a 12-billion-token corpus curated from FineWeb2 and filtered with educational and STEM classifiers). We preserve the original architecture, including rotary positional embeddings, alternating local-global attention, flash attention, and unpadding. We evaluate moBERTo across information retrieval (including long-context retrieval at up to 8,192 tokens), document classification, named entity recognition, and natural language understanding. Our best variant, which combines a Portuguese tokenizer with subword-matching embedding transfer and long-context post-training, achieves the highest average reranking nDCG@10 across three Portuguese retrieval benchmarks and the best results on PLUE-PT. Through ablation studies, we show that (i) continued pretraining is strongly preferable to training from scratch, particularly for preserving long-context capabilities; (ii) tokenizer adaptation improves token-level tasks but degrades long-context retrieval; (iii) a dedicated long-context post-training phase at 8,192 tokens further improves reranking and NER; and (iv) encoder-only architectures remain competitive with larger decoder-only alternatives for discriminative tasks. We publicly release the model weights at https://huggingface.co/Tropic-AI/moBERTo and training data at https://huggingface.co/datasets/Tropic-AI/moberto-pretraining-dataset-c4-compatible on Hugging Face.
Thiago Laitz, Thales Sales Almeida, João Guilherme Alves Santos +1
UNICAMP, Campinas, Brazil · Tropic AI · Maritaca AI
The development of the Bielik v3 PL series, encompassing both the 7B and 11B parameter variants, represents a significant milestone in the field of language-specific large language model (LLM) optimization. While general-purpose models often demonstrate impressive multilingual capabilities, they frequently suffer from a fundamental architectural inefficiency: the use of universal tokenizers. These tokenizers, typically designed to cover a broad spectrum of languages, often fail to capture the morphological nuances of specific languages like Polish, leading to higher fertility ratios, increased inference costs, and restricted effective context windows. This report details the transition from the universal Mistral-based tokenization to a dedicated Polish-optimized vocabulary for the Bielik v3 models, exploring the FOCUS-based embedding initialization, the multi-stage pretraining curriculum, and the subsequent post-training alignment involving Supervised Fine-Tuning, Direct Preference Optimization, and Reinforcement Learning through Group Relative Policy Optimization with verifiable rewards.