WikiBERT models: deep transfer learning for many languages

Sampo Pyysalo, Jenna Kanerva, Antti Virtanen, Filip Ginter

Abstract

Deep neural language models like BERT have revolutionized natural language processing, yet their high computational cost often limits their availability to high-resource languages. This paper introduces a fully automated pipeline for creating language-specific BERT models using Wikipedia data. We present 42 new monolingual "WikiBERT" models and demonstrate that they generally outperform multilingual BERT (mBERT) in cloze tests and dependency parsing, particularly for languages with moderate resources. All models are available under open licenses.

Introduction

While massive multilingual models such as mBERT have expanded the reach of NLP to over 100 languages, they often suffer from the "curse of multilinguality." By sharing a fixed parameter capacity across dozens of diverse languages, these models may fail to capture the nuances of individual languages as effectively as dedicated monolingual models. However, training dedicated models is traditionally a manual, resource-intensive process. WikiBERT addresses this by providing an automated pipeline to lower the barrier for creating high-quality, language-specific BERT models.

Methodology: The WikiBERT Pipeline

The researchers developed a streamlined pipeline to transform raw Wikipedia dumps into BERT-ready training data with minimal manual intervention. The process consists of four primary stages:

  1. Extraction: Plain text is extracted from XML Wikipedia dumps using WikiExtractor.
  2. Segmentation & Tokenization: Sentence segmentation is performed via UDPipe. Subword vocabularies are generated using SentencePiece and subsequently converted to the WordPiece format used by BERT.
  3. Filtering: To ensure data quality, the pipeline applies heuristic rules and statistical language detection to remove non-target language content and "noisy" pages.
  4. Pre-training: Models follow the standard BERT-base architecture (12 layers, 768 hidden units). Training is conducted for 1 million steps on Nvidia V100 GPUs, utilizing a sequence length of 128 for the first 900k steps and 512 for the final 100k steps.

Data and Experimental Setup

The study utilized Wikipedia as the primary source for unannotated pre-training data across 42 selected languages. These languages represent a wide spectrum of data availability, ranging from 18 million tokens for Urdu to 2.7 billion tokens for English.

Table 1: Pre-training data sizes (in tokens) for the 42 languages included in the WikiBERT project.

For evaluation, the models were tested on dependency parsing using the Universal Dependencies (UD) v2.3 dataset, which includes 129 treebanks. The UDify parser was employed to measure the Labeled Attachment Score (LAS) across the target languages.

Results and Performance Analysis

WikiBERT models were compared against the standard mBERT baseline in both intrinsic and extrinsic tasks.

Intrinsic Evaluation (Cloze Tests)

In cloze tests—where the model must predict a masked word—WikiBERT models outperformed mBERT in 41 out of 42 languages. The dedicated monolingual vocabulary allowed WikiBERT to achieve gains of over 10 percentage points in several instances, highlighting the advantage of language-specific subword units.

Extrinsic Evaluation (Dependency Parsing)

On average, WikiBERT achieved a slight edge in parsing performance (86.6% vs. 86.1% LAS). However, the results varied significantly by language. The most substantial gains were observed in languages with moderate resources, typically between 100 million and 1 billion tokens.

Figure 1: Relative change in Labeled Attachment Score (LAS) when using WikiBERT instead of mBERT, plotted against the size of the pre-training data.

Discussion: The "Sweet Spot" and Language Families

The data suggests a "sweet spot" for monolingual pre-training. Languages like Finnish (fi) saw massive improvements, likely due to their linguistic uniqueness and sufficient data (97M tokens) to train a dedicated model. Conversely, languages with very low resources (under 100M tokens) or those with many high-resource linguistic relatives sometimes performed better under mBERT. For example, Belarusian (be) saw a performance decrease with WikiBERT, likely because mBERT allows it to leverage knowledge from the much larger Russian dataset.

Japanese (ja) emerged as an outlier with unexpectedly low performance, which the authors attribute to potential issues in the automated tokenization pipeline for that specific script. For very low-resource languages, the authors suggest that multilingual training within smaller, linguistically related clusters may remain the optimal strategy.

Conclusion

The WikiBERT project demonstrates that an automated pipeline can successfully produce competitive monolingual models for a wide array of languages. By releasing 42 new models and the underlying pipeline, this work provides a valuable foundation for researchers working on languages that have previously been underserved by the NLP community. All resources are available at https://github.com/turkunlp/wikibert.

Summary updated

BibTeX
@inproceedings{pyysalo2020wikibert,
  author = {Sampo Pyysalo and Jenna Kanerva and Antti Virtanen and Filip Ginter},
  title = {{WikiBERT models: deep transfer learning for many languages}},
  booktitle = {NoDaLiDa},
  year = {2020},
}
Figure