Projects

RobBERT

One of the first Dutch large language models, and for years the best one on most Dutch language tasks

View RobBERT Code Cite

RobBERT cover

RobBERT is a Dutch large language model: an AI model that has examined hundreds of millions of Dutch sentences, enabling it to excel in a wide variety of Dutch language tasks. You can show RobBERT a new dataset containing some new Dutch sentences and make it perform a particular task on them. For example, by giving it a dataset of positive and negative book reviews, it can then predict with 95% accuracy whether an unseen book review is positive or negative. By giving it sentences where the Dutch word “die” or “dat” is missing, it can correctly predict these in more than 99% of the cases.

How often each model was right
Book reviews: positive or negative?
RobBERT 95.1%
BERTje 93.0%
Die or dat? Learned from 10,000 sentences
RobBERT 97.8%
BERTje 93.1%
mBERT 92.2%
Die or dat? Learned from all 1.3 million
RobBERT 99.2%
BERTje 98.3%
mBERT 98.3%
Die or dat? Without any examples
RobBERT 98.8%
BERTje 94.9%
mBERT 90.2%

On sentences the models hadn’t seen before (our paper, Tables 1 and 2; RobBERT’s second version). BERTje is the Dutch BERT model of the University of Groningen, mBERT Google’s multilingual BERT. Without any examples, the models fill in die or dat with what they learned in pretraining alone.

RobBERT is not limited to these tasks: it can compare sentences, label the words in a sentence and classify texts. When we released it in 2020, it outperformed other models on most Dutch language tasks, especially when a task had little training data, and it remained the best model for most of them for years. It has been downloaded 5 million times, and many researchers and practitioners have used it to get the best results of their time on a wide range of Dutch language tasks, including:

and results close to the best on:

* These evaluations used RobBERT v1. RobBERT v2, with a Dutch tokenizer instead of an English one, does as well or better on every task we tested.

(Also note that this list is not exhaustive. If you used RobBERT for your application, we are happy to know about it! Send us a mail and we’ll add your application to the list!)

More about how RobBERT was made is in Pieter Delobelle’s blog post, our paper and our GitHub repository.

How RobBERT works

RobBERT is a Dutch version of RoBERTa, Facebook AI’s improved version of Google’s BERT model. We trained this transformer model on the Dutch part of the OSCAR corpus, text scraped from the web, using Facebook AI’s RoBERTa framework.

Like every transformer, RobBERT works out what a word means from the words around it: while reading a word, it pays attention to the other words in the sentence, before and after it. It does so in 12 layers, each with 12 attention heads, which each look at the sentence in their own way: some mostly at the previous word, others at the next word or at the word itself.

Pretraining and finetuning

Like BERT, RobBERT learns in two phases:

1 Pretraining

Lots of text without labels: expensive, but done once

Dutch text from the web a word hidden

De hoofdstad van België is <mask>.

“The capital of Belgium is <mask>.”

Hidden word: Brussel Brussels

RobBERT Reusable: anyone can download it

2 Finetuning

Fewer examples, with labels: relatively cheap, for each task

A book review labeled by people

Ik kon dit boek niet wegleggen.

“I couldn’t put this book down.”

Label: positive

RobBERT for book reviews Tells positive reviews from negative ones

Pretraining needs no labels: words are hidden in the text, and RobBERT learns to guess them. It took hundreds of millions of sentences and a lot of computing power, but it only had to happen once. Finetuning then teaches RobBERT one task, from a smaller set of examples that people labeled.

RobBERTje and RobBERT-2022

Two later models start from RobBERT:

  • RobBERTje (2021) is RobBERT distilled: smaller models that learned to give the same answers as RobBERT. Most have 74 million parameters, against RobBERT’s 116 million, which makes them quicker to finetune and lighter to run. For longer texts, such as book reviews, the version that learned from merged consecutive sentences works best.
  • RobBERT-2022 brings RobBERT, trained in 2019, up to date with how Dutch is used: we added words that had become common since, such as words about COVID-19, to its vocabulary, and trained it further on the 2022 version of the same web corpus. That made it better at some tasks, and worse at others.

In 2023, Pieter Delobelle and François Remy followed with RobBERT-2023, which also comes in a large version.

How to use

RobBERT uses the RoBERTa architecture and pre-training but with a Dutch tokenizer and training data. With the same architecture, RobBERT works with any code for RoBERTa models and most code for BERT models, such as the Hugging Face Transformers library.

To use RobBERT in Python, add the 🤗 transformers library as a dependency and load the model:

from transformers import RobertaTokenizer, RobertaForSequenceClassification
tokenizer = RobertaTokenizer.from_pretrained("pdelobelle/robbert-v2-dutch-base")
model = RobertaForSequenceClassification.from_pretrained("pdelobelle/robbert-v2-dutch-base")

By default, RobBERT has the masked language model head used in training, so it can fill in a hidden word in a sentence without any finetuning. You can try that for free on RobBERT’s page on HuggingFace. You can also create a new prediction head for your own task with HuggingFace’s guide to finetuning, their notebooks or any RoBERTa-specific classes, by changing the model name to pdelobelle/robbert-v2-dutch-base. RobBERTje and RobBERT-2022 work the same way, under their own names on HuggingFace, such as DTAI-KULeuven/robbert-2022-dutch-base.

View RobBERT

In the press

Papers

Citation

 

What people say about RobBERT

How to cite

RobBERT: a Dutch RoBERTa-based Language Model

@inproceedings{delobelle2020robbert,
    title = "{R}ob{BERT}: a {D}utch {R}o{BERT}a-based {L}anguage {M}odel",
    author = "Delobelle, Pieter  and
      Winters, Thomas  and
      Berendt, Bettina",
    booktitle = "Findings of the Association for Computational Linguistics: EMNLP 2020",
    month = nov,
    year = "2020",
    address = "Online",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/2020.findings-emnlp.292",
    doi = "10.18653/v1/2020.findings-emnlp.292",
    pages = "3255--3265",
    abstract = "Pre-trained language models have been dominating the field of natural language processing in recent years, and have led to significant performance gains for various complex natural language tasks. One of the most prominent pre-trained language models is BERT, which was released as an English as well as a multilingual version. Although multilingual BERT performs well on many tasks, recent studies show that BERT models trained on a single language significantly outperform the multilingual version. Training a Dutch BERT model thus has a lot of potential for a wide range of Dutch NLP tasks. While previous approaches have used earlier implementations of BERT to train a Dutch version of BERT, we used RoBERTa, a robustly optimized BERT approach, to train a Dutch language model called RobBERT. We measured its performance on various tasks as well as the importance of the fine-tuning dataset size. We also evaluated the importance of language-specific tokenizers and the model{'}s fairness. We found that RobBERT improves state-of-the-art results for various tasks, and especially significantly outperforms other models when dealing with smaller datasets. These results indicate that it is a powerful pre-trained model for a large variety of Dutch language tasks. The pre-trained and fine-tuned models are publicly available to support further downstream Dutch NLP applications.",
}

All projects