Pre-training Polish Transformer-Based Language Models at Scale

Slawomir Dadas, Michal Perelkiewicz, Rafal PoswiataICAISC 2020

TL;DR

This paper introduces two large-scale, transformer-based language models for Polish, addressing the scarcity of such resources for low-resource languages. Their larger model, trained on 135GB of text, sets a new benchmark for Polish NLP, outperforming previous approaches on eleven out of thirteen linguistic tasks.

What Problem Does This Paper Address?

Transformer-based language models, like BERT, have revolutionized Natural Language Processing (NLP), significantly advancing performance on various tasks, especially for English. However, this progress has not been mirrored for many "low-resource" languages, including Polish. While some Polish language models exist, they are considerably smaller in terms of training data and model parameters compared to their English counterparts. This gap limits the potential for applying state-of-the-art NLP techniques to Polish. The authors aim to bridge this gap by developing and releasing large-scale pre-trained language models for Polish.

Methods

The core of this work involves pre-training two BERT-based language models for Polish: a "base" model and a significantly larger "large" model. The pre-training process follows the methodology of RoBERTa, focusing on the Masked Language Modeling (MLM) objective, as the Next Sentence Prediction (NSP) objective was found to be less beneficial for downstream tasks. Key methodological aspects include:

  • Data Collection and Cleaning: A robust pipeline was developed to filter and clean data from Common Crawl, a massive web archive. This involved identifying Polish documents, extracting main content, removing short or irrelevant texts, and filtering based on perplexity using a KenLM model. Duplicates were also removed.
  • Model Architectures: The models adopt the standard BERT architecture. The base model uses hyperparameters similar to the original BERT-base, while the large model mirrors BERT-large with more encoder blocks, a larger hidden size, and more attention heads.
  • Training Procedure: Dynamic token masking was employed, and the models were trained with larger batch sizes than typically used for BERT to stabilize training. The Adam optimizer was used with a learning rate scheduler featuring linear decay and a warm-up phase.

Datasets

  • Training Data: The primary training corpus is derived from Common Crawl, amounting to approximately 115GB of cleaned web data. This is supplemented by a "base part" of 20GB, comprising publicly available Polish text corpora such as the Polish Wikipedia, the Polish Parliamentary Corpus, and smaller corpora from CLARIN and OPIN projects, as well as Polish books and articles. The total training corpus size is 135GB.
  • Evaluation Datasets: The models were evaluated on thirteen Polish linguistic tasks. Nine of these tasks are from the recently developed KLEJ benchmark [39], which aims to provide a comprehensive evaluation suite for Polish NLP. Three tasks were previously introduced by the authors [12], and one is a named entity recognition task from the PolEval evaluation challenge.

Key Insights and Ideas

  • Scale Matters for Low-Resource Languages: The paper strongly suggests that scaling up pre-training data and model size, similar to what has been done for English, is crucial for achieving state-of-the-art performance in low-resource languages like Polish.
  • Data Cleaning is Paramount: The authors highlight the importance of their meticulous data cleaning pipeline for Common Crawl data. This process is essential to mitigate the noise and unrepresentativeness often found in web-scraped text, thereby improving the quality of the pre-trained models.
  • MLM is Sufficient: The study reinforces findings that the Masked Language Modeling (MLM) objective alone is sufficient for effective pre-training, and the Next Sentence Prediction (NSP) objective does not consistently improve downstream performance.
  • Language-Specific Models Outperform Multilingual: While multilingual models like XLM-R are strong, the paper demonstrates that their specifically trained Polish BERT-large model achieves better results on several tasks, underscoring the benefit of monolingual pre-training.

Key Results

  • The larger Polish BERT model, trained on 135GB of text, achieved state-of-the-art or near state-of-the-art results on eleven out of thirteen evaluated Polish linguistic tasks.
  • On the KLEJ benchmark, the authors' base model outperformed existing Polish and multilingual BERT-base models, achieving an average score of 85.3.
  • The large model achieved an average score of 87.8 on the KLEJ benchmark, surpassing the XLM-R large model in seven out of nine tasks.
  • For the named entity recognition task (PolEval-NER 2018), their model achieved a 3.8-point improvement over the previous state-of-the-art without relying on external structured knowledge.

Limitations and Future Work

  • Computational Cost: The paper acknowledges the significant computational resources required for training large language models, which can be a barrier for researchers in less resourced institutions.
  • Data Representativeness: While efforts were made to clean the data, the inherent biases and limitations of web-scraped data might still influence model performance.
  • Future Work: The authors have released their pre-trained models and source code to facilitate further research in Polish NLP. Future work could involve exploring different pre-training objectives, architectures, or further expanding the training data. The paper also implicitly suggests that similar efforts are needed for other low-resource languages.

Summary updated

BibTeX
@misc{dadas2020pre,
  author = {Slawomir Dadas and Michal Perelkiewicz and Rafal Poswiata},
  title = {{Pre-training Polish Transformer-Based Language Models at Scale}},
  year = {2020},
  eprint = {2006.04229},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2006.04229},
}
Figure