lawfulbench / README.md
dheerajpai's picture
LAWFUL-Bench 24 tasks @ eac7cd1
b469d17 verified
|
Raw
History Blame Contribute Delete
6.5 kB
metadata
license: other
license_name: mixed-eurlex-and-synthetic
task_categories:
  - question-answering
language:
  - en
tags:
  - gdpr
  - legal
  - compliance
  - agents
  - tool-use
  - privacy
size_categories:
  - n<1K
pretty_name: LAWFUL-Bench
configs:
  - config_name: default
    data_files: tasks.jsonl

LAWFUL-Bench

LAWFUL-Bench: Measuring Whether LLM Agents Apply Data Protection Law Dheeraj Pai, Lu Xian (Leanmcp)

An agentic benchmark for operational data protection duties under the GDPR. An agent under test and a simulated data subject each hold tools over one shared database, and 44 documents of primary law are reachable through retrieval rather than pasted into the prompt.

The graded artifact is a justification triple -- (decision, lawful_basis, record_action) -- filed through a compliance tool, alongside the resulting world state and what the person was actually told. An agent that reaches the right outcome for the wrong reason is not compliant, and this benchmark scores that difference.

Read this before using it

  • Gold labels have not been reviewed by a qualified data protection practitioner.
  • No human baseline exists, so absolute scores are uninterpretable.
  • Redistribution terms for the EDPB/WP29 document are unconfirmed (excluded for now).
  • No inter-annotator agreement has been measured on any item.

Treat these numbers as a research artifact, not as a compliance assurance. A high score is evidence about a model on 24 constructed items. It is not evidence that a deployment is lawful, and it must not be cited as such.

Composition

24 tasks across four stateful domains (bank_support, hospital, hr_enterprise, personal_assistant), 6 each.

Class n What it measures
must_act 8 Over-refusal: the law requires action
must_refuse 8 Under-refusal, measured on the executed action
must_partially_act 6 Partial outcomes (erase some, retain others)
out_of_scope 2 Scope false positives: the GDPR does not apply

Difficulty: easy 1, edge 5, hard 9, medium 9.

Files

Path Contents
tasks.jsonl One task per line: scenario, relevant/distractor documents, simulator spec, gold triple with rationale, evaluation block
domains/<d>/db.json The initial world for each domain
domains/<d>/policy.txt The controller's operating policy shown to the agent
docs/ The retrieval corpus (GDPR, EU AI Act, sector retention rules)
MANIFEST.json Source URL, sha256, and licence per document
results/summary.csv Baseline scores, one row per model

Quick start

from datasets import load_dataset

ds = load_dataset("Leanmcp/lawfulbench", split="train")
print(ds[0]["id"], ds[0]["class"], ds[0]["domain"])

The world state, the policy text and the retrieval corpus are plain files rather than dataset columns, so fetch them alongside:

from huggingface_hub import snapshot_download

path = snapshot_download("Leanmcp/lawfulbench", repo_type="dataset")
# path/domains/<d>/db.json, path/domains/<d>/policy.txt, path/docs/, path/MANIFEST.json

A task is only reproducible against the db.json it shipped with: the gold triple is defined relative to that initial world.

Metrics

The column names in results/summary.csv, in the order they matter.

Metric Definition
JustifiedAccuracy The headline. Decision and lawful basis and required record action all correct.
DecisionAccuracy Decision correct, basis ignored.
BasisAccuracy Cited lawful basis correct.
LuckyCompliance Right decision on a wrong or absent basis: the gap this benchmark exists to expose.
RecordRate Fraction of episodes where an accountability record was filed at all.
OverRefusal Refused when the law required action (must_act).
UnderRefusal Acted when the law required refusal, scored on the action actually executed.
ScopeFPR Applied GDPR reasoning to an out_of_scope item.
RetrievalRate Fraction of episodes that retrieved at least one relevant document.
MeanReward Harness-level scalar, reported for continuity with tool-use benchmarks.

Baseline

1 agents, one trial each, user simulator and judge held constant.

Model Justified Acc. Decision Acc. Basis Acc. Over-refusal Under-refusal
accounts/fireworks/models/kimi-k3 0.125 0.292 0.417 0.250 0.125

Justified accuracy stays near the floor while decision accuracy runs two to four times higher: most correct decisions are reached on a wrong legal basis. Over-refusal exceeds under-refusal in every model tested.

Licensing

  • GDPR and EU AI Act text: EUR-Lex, reuse permitted with attribution (Commission Decision 2011/833/EU).
  • Sector retention rules (docs/sector/): synthetic, written by the authors, not attributable to any real institution, and not authoritative law.
  • Tasks, databases, policies: released by the authors under the repository's licence.
  • The EDPB/WP29 guidance document used in the harness is excluded from this release pending confirmation of redistribution terms. MANIFEST.json carries its source URL and hash so it can be fetched locally.

Personal data

None. Every data subject, record and identifier in the four databases is fictitious. No real personal data was collected, processed, or stored at any point in constructing this benchmark.

Running it

The harness is not in this dataset repository. See the code release for lawful run / lawful eval, the four tool surfaces, and the judge prompts.

Citation

If you use LAWFUL-Bench, please cite the paper:

@misc{pai2026lawfulbench,
  title  = {LAWFUL-Bench: Measuring Whether LLM Agents Apply Data Protection Law},
  author = {Dheeraj Pai and Lu Xian},
  year   = {2026},
  note   = {Under review at ARR/EACL},
  howpublished = {Hugging Face dataset, \url{https://huggingface.co/datasets/Leanmcp/lawfulbench}}
}

Contact

Dheeraj Pai and Lu Xian, Leanmcp. Corrections to a gold label are welcome and wanted: open a discussion on this repository with the task id and the Article you think it turns on.


Generated from commit eac7cd1.