Gerwin commited on
Commit
55f3aaf
·
1 Parent(s): cd64e12

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +44 -0
README.md CHANGED
@@ -1,3 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
  ---
 
1
+ # Legal BERT model applicable for Dutch and English
2
+ A legal BERT model further trained from [mBERT](https://huggingface.co/bert-base-multilingual-uncased).
3
+
4
+ The thesis can be downloaded using this [link](https://www.ru.nl/publish/pages/769526/gerwin_de_kruijf.pdf)
5
+
6
+ ## Data
7
+ The model is further trained the same way as [EurlexBERT](https://huggingface.co/nlpaueb/bert-base-uncased-eurlex): 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.
8
+ Further training was done for 60k steps, since 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.
9
+
10
+ ## How to use
11
+ ```python
12
+ from transformers import AutoTokenizer, AutoModel, TFAutoModel
13
+ tokenizer = AutoTokenizer.from_pretrained("Gerwin/legal-bert-dutch-english")
14
+ model = AutoModel.from_pretrained("Gerwin/legal-bert-dutch-english") # PyTorch
15
+ model = TFAutoModel.from_pretrained("Gerwin/legal-bert-dutch-english") # Tensorflow
16
+ ```
17
+
18
+ ## Benchmarks
19
+ The thesis lists various benchmarks. 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.
20
+
21
+ ### Legal Topic Classification
22
+ | Model | [Multi-EURLEX (NL)](https://huggingface.co/datasets/multi_eurlex) |
23
+ | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
24
+ | **legal-bert-dutch-english** | **0.786** |
25
+ | [mBERT](https://huggingface.co/bert-base-multilingual-uncased) | 0.779 |
26
+ | [BERTje](https://huggingface.co/GroNLP/bert-base-dutch-cased) | 0.775 |
27
+
28
+ | Model | [Multi-EURLEX (EN)](https://huggingface.co/datasets/multi_eurlex) |
29
+ | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
30
+ | **legal-bert-dutch-english** | 0.786 |
31
+ | [mBERT](https://huggingface.co/bert-base-multilingual-uncased) | 0.772 |
32
+ | [BERTje](https://huggingface.co/bert-base-uncased) | 0.791 |
33
+ | [LegalBERT](https://huggingface.co/nlpaueb/legal-bert-base-uncased) | 0.791 |
34
+ | [EurlexBERT](https://huggingface.co/nlpaueb/bert-base-uncased-eurlex) | **0.795** |
35
+
36
+
37
+ ### Multi-class classification (Rabobank)
38
+ This dataset is not open-source, but it is still an interesting case since the dataset contains both Dutch and English long legal documents that have to be classified. The dataset only consisted of 8000 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.
39
+
40
+ | Model | Rabobank |
41
+ | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
42
+ | **legal-bert-dutch-english** | **0.732** |
43
+ | [mBERT](https://huggingface.co/bert-base-multilingual-uncased) | 0.713 |
44
+
45
  ---
46
  license: apache-2.0
47
  ---