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.