đ Legal BERT model applicable for Dutch and English
A BERT model further trained on legal documents for Dutch and English, offering enhanced performance in the legal domain.
đ Quick Start
This is a BERT model further trained from mBERT on legal documents. The thesis can be downloaded here.
⨠Features
- Multilingual Support: Applicable for both Dutch and English, making it suitable for a wide range of legal documents in these languages.
- Trained on Legal Data: Further trained on legal regulations, decisions, directives, and parliamentary questions, enhancing its performance in the legal domain.
đĻ Installation
The model is further trained in the same way as EurlexBERT. Regulations, decisions, directives, and parliamentary questions were acquired in both Dutch and English. A total of 184k documents, around 295M words, was used to further train the model. This is less than 9% the size of the original BERT model.
Further training was done for 60k steps, as it showed better results compared to a 100k checkpoint (which was suggested in the original BERT paper). Using more than 100k steps was not beneficial.
đģ Usage Examples
Basic Usage
from transformers import AutoTokenizer, AutoModel, TFAutoModel
tokenizer = AutoTokenizer.from_pretrained("Gerwin/legal-bert-dutch-english")
model = AutoModel.from_pretrained("Gerwin/legal-bert-dutch-english")
model = TFAutoModel.from_pretrained("Gerwin/legal-bert-dutch-english")
đ Documentation
Here are a couple of comparisons between popular BERT models and this model. The fine-tuning procedures for these benchmarks are identical for each pre-trained model, and are more explained in the thesis. You may be able to achieve higher scores for individual models by optimizing fine-tuning procedures. The table shows the weighted F1 scores.
Legal topic classification
Multi-class classification (Rabobank)
This dataset is not open-source, but it is still an interesting case since the dataset contains both Dutch and English legal documents that have to be classified. The dataset consists of 8000 long legal documents (2000 Dutch & 6000 English) with a total of 30 classes. Using a combined architecture of a Dutch and English BERT model was not beneficial, since documents from both languages could belong to the same class.
Model |
Rabobank |
legal-bert-dutch-english |
0.732 |
mBERT |
0.713 |
đ License
This project is licensed under the Apache 2.0 license.