Manuscript Offprint

arXiv:2609.01379

Polish ModernBERT: The Long and Short of Polish Language Understanding

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

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 1^{1}, 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 2^{2}, 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

1^{1}https://huggingface.co/collections/OPI-PIB/pl-modernbert

2^{2}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.

References (50)