Home

Awesome

AGB-DE: A Corpus for the Automated Legal Assessment of Clauses in German Consumer Contracts

AGB-DE is a legal NLP corpus for the automated detection of potentially void clauses in German standard form consumer contracts. It consists of 3,764 clauses that have been legally assessed by experts and annotated as potentially void (1) or valid (0). Additionally, each clause is annotated with a topic label. This repository contains the corpus itself, code that was uses to anonymize the data, code that was used to train and evaluate baseline models, and the results of the baseline evaluation itself.

How to cite

@inproceedings{braun-matthes-2024-agb,
    title = "AGB-DE: A Corpus for the Automated Legal Assessment of Clauses in German Consumer Contracts", 
    author = "Braun, Daniel and Matthes, Florian",
    booktitle = "Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)",
    year = "2024",
    publisher = "Association for Computational Linguistics"
}

Data

The dataset consists of 3,764 clauses from 93 German consumer standard form contracts. Each clause has been annotated with its topic(s) and whether the clause is valid (0) or potentially void (1). The table below shows the distribution of topics among the clauses and the share of potentially void clauses per topic. For more details about the data please take a look at the paper and the datasheet.

topicnumber of clausesshare_void
age200
applicability1482.03
applicableLaw873.45
arbitration971.03
changes911.11
codeOfConduct290
conclusionOfContract5575.92
contractLanguage410
delivery4757.16
description460
disposal360
intellectualProperty390
language911.11
liability2119
party00
payment6426.07
personalData1150.87
placeOfJurisdiction531.89
prices1471.36
retentionOfTitle1252.4
severability3511.43
textStorage571.75
warranty3146.37
withdrawal5063.75
Total lvl 137984.8

Baseline Automated Legal Assessment

agb-de dataset

ModelPrecisionRecallF1-Score
svm0.370.270.31
bert-base-german-cased0.500.270.35
xlm-roberta-base0.000.000.00
gerpt20.710.140.23
gpt-3.5-turbo-0125 0.060.920.11

agb-de-under dataset

ModelPrecisionRecallF1-Score
svm0.400.320.36
bert-base-german-cased0.510.570.54
xlm-roberta-base0.750.080.15
gerpt20.640.430.52
gpt-3.5-turbo-0125 0.130.920.22

How to use

The easiest way to use the corpus is through the dataset and baseline model provided on 🤗 Huggingface. See also example.py.

from datasets import load_dataset
from transformers import AutoTokenizer
from transformers import AutoModelForSequenceClassification
from transformers import pipeline

# load corpus
ds = load_dataset("d4br4/agb-de")

# load model
modelname = "d4br4/AGBert"
model = AutoModelForSequenceClassification.from_pretrained(modelname)
tokenizer = AutoTokenizer.from_pretrained(modelname)

# create classification pipeline
clf = pipeline("text-classification", model, tokenizer=tokenizer, max_length=512, truncation=True)

# classify clause text
prediction = clf.predict(ds["test"][0]["text"])

# check classification output
if prediction[0]["label"] == "valid":
    print("This clause is valid.")

else:
    print("This clause is void.")

Contact

If you have any question, please contact:

Daniel Braun (University of Twente)<br> d.braun@utwente.nl

Acknowledgment

The data collection and annotation was supported by funds of the Federal Ministry of Justice and Consumer Protection (BMJV) based on a decision of the Parliament of the Federal Republic of Germany via the Federal Office for Agriculture and Food (BLE) under the innovation support programme.