File size: 6,495 Bytes
d540073
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b469d17
d540073
 
 
 
 
 
 
b469d17
 
 
d540073
 
 
 
 
 
 
 
 
 
 
b469d17
 
 
 
d540073
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b469d17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d540073
 
 
b469d17
d540073
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b469d17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d540073
 
b469d17
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
---
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.

- **Dataset**: <https://huggingface.co/datasets/Leanmcp/lawfulbench>
- **Paper**: Under review at ARR/EACL. Link added here when the preprint is posted.
- **Code / harness**: released separately, link added here when public.

## 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

```python
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:

```python
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:

```bibtex
@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`.