Skip to main content
QUICK REVIEW

[Paper Review] Playing with Words at the National Library of Sweden -- Making a Swedish BERT

Martin Malmsten, Love Börjeson|arXiv (Cornell University)|Jul 3, 2020
Natural Language Processing TechniquesComputer Science50 citations
TL;DR

The paper introduces KB-BERT, a Swedish BERT model trained on diverse Swedish corpora from the National Library of Sweden, and shows it outperforms multilingual and existing Swedish models on NER and POS tasks.

ABSTRACT

This paper introduces the Swedish BERT ("KB-BERT") developed by the KBLab for data-driven research at the National Library of Sweden (KB). Building on recent efforts to create transformer-based BERT models for languages other than English, we explain how we used KB's collections to create and train a new language-specific BERT model for Swedish. We also present the results of our model in comparison with existing models - chiefly that produced by the Swedish Public Employment Service, Arbetsf\\"ormedlingen, and Google's multilingual M-BERT - where we demonstrate that KB-BERT outperforms these in a range of NLP tasks from named entity recognition (NER) to part-of-speech tagging (POS). Our discussion highlights the difficulties that continue to exist given the lack of training data and testbeds for smaller languages like Swedish. We release our model for further exploration and research here: https://github.com/Kungbib/swedish-bert-models .

Motivation & Objective

  • Describe how KB's collections were used to build a Swedish BERT model (KB-BERT).
  • Evaluate KB-BERT against existing Swedish and multilingual models on downstream NLP tasks (NER, POS).
  • Highlight data, preprocessing, and training choices that impact performance for a lower-resourced language.

Proposed method

  • Assemble a Swedish pre-training corpus from newspaper OCR, government reports (SOU), legal e-deposits, social media, and Swedish Wikipedia (1940s–2019).
  • Clean and unify data with OCR error fixes and a custom sentence/paragraph segmentation pipeline; use spaCy for sentence splitting with Swedish considerations.
  • Apply SentencePiece to create a ~50k subword vocabulary and train BERT from scratch using Google’s BERT framework across multiple training stages.
  • Train on Cloud TPUs with mixed in-house and TFRC-supported resources; conduct pre-training up to around 2M steps with varying max sequence lengths and batch sizes.
  • Evaluate on downstream NER and POS tasks using established Swedish corpora; compare KB-BERT to Google’s M-BERT and Arbetsförmedlingen models.

Experimental results

Research questions

  • RQ1Can a Swedish-specific BERT model trained on diverse, democratically sourced corpora outperform multilingual and existing Swedish models on NER and POS tasks?
  • RQ2How do data types, preprocessing, and training duration affect Swedish BERT performance and robustness?
  • RQ3What are the practical challenges and limitations in creating and evaluating Swedish language models due to data/testbed scarcity?

Key findings

  • KB-BERT outperforms M-BERT and Arbetsförmedlingen’s Swedish model on NER across multiple entity types.
  • POS tagging improvement with KB-BERT over M-BERT is smaller, indicating some tasks saturate more quickly; overall POS results remain high.
  • Evaluation during pre-training shows NER gains plateau after initial improvements, with marginal gains beyond ~150k–1M steps depending on checkpoint.
  • In harder NER tasks, performance can vary and may require more fine-tuning data or steps; stabilization is not guaranteed beyond 1–2M steps.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.