File size: 4,760 Bytes
7c688c5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b6d945d
 
 
6490cd7
7c688c5
 
 
 
 
 
 
 
 
 
fcc3eb4
7c688c5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b6d945d
6490cd7
b6d945d
 
7c688c5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b6d945d
 
 
 
7c688c5
 
 
 
 
 
 
b6d945d
7c688c5
 
 
 
 
 
 
 
 
 
 
 
 
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
---
pretty_name: VersionQA-Legal
license: other
license_name: ogl-v3.0
license_link: https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/
language:
  - en
task_categories:
  - question-answering
  - text-retrieval
size_categories:
  - 1K<n<10K
tags:
  - rag
  - retrieval-augmented-generation
  - version-aware
  - legal
  - legislation
  - uk-law
  - point-in-time
  - benchmark
configs:
  - config_name: chunks
    data_files:
      - split: train
        path: chunks/chunks.parquet
  - config_name: evaluation
    data_files:
    - split: test
      path: evaluation/evaluation_set.parquet
---

# VersionQA-Legal

Question answering over **amended UK legislation**: 547 questions against 355 point-in-time
versions of primary legislation from [legislation.gov.uk](https://www.legislation.gov.uk/).
Companion to [VersionQA-Software](https://huggingface.co/datasets/VersionRAG/VersionQA-Software),
which poses the same task over software documentation.

Introduced in *VersionRAG: Version-Aware Retrieval-Augmented Generation for Evolving Documents*
(Findings of EACL 2027). Code: [VersionRAG/versionrag](https://github.com/VersionRAG/versionrag).

Software documentation versions itself cooperatively: releases are numbered, and changelogs state
what changed. Legislation does neither. Amendments arrive as **micro-edits buried in documents
orders of magnitude longer than the edit itself**, there is no changelog anywhere in the corpus,
and versions are dates rather than semantic version strings.

That makes it a genuine transfer test: a system that only works because it can parse `2.14.1` out
of a filename will not survive here.

## Contents

| Path | What it is |
|---|---|
| `corpus/` | 355 Markdown files under `corpus/<act>/<part>/<part>_<date>.md` |
| `evaluation/evaluation_set.csv` | 547 question–answer pairs with a category label |
| `chunks/chunks.parquet` | the corpus pre-chunked (512 tokens, 50 overlap) with `(document, version)` provenance |
| `LICENSES.md` | per-file source URL, version and licence |
| `evaluation/evaluation_set.parquet` | the same questions in Parquet, used by `load_dataset` |
| `SOURCES.md` | where each Act's files were retrieved from |
| `gold_audit/` | two-annotator audit of 120 gold answers: sample, labels, codebook |

### Question categories

| Category | n | Version-sensitive |
|---|---:|:---:|
| Content Retrieval | 93 | no |
| Content Retrieval Complex | 86 | no |
| Content Retrieval Version-Specific | 97 | **yes** |
| Version Listing & Inquiry | 95 | **yes** |
| Change Retrieval (Explicit) | 91 | **yes** |
| Change Retrieval (Implicit) | 85 | **yes** |
| **Total** | **547** | |

Because the corpus contains no changelogs, every change in this domain is an implicit long-text
diff. "Explicit" here means the amendment is stated in the amending instrument, not that a
changelog announces it.

## Usage

```python
from datasets import load_dataset

qa = load_dataset("VersionRAG/VersionQA-Legal", "evaluation", split="test")
chunks = load_dataset("VersionRAG/VersionQA-Legal", "chunks", split="train")
```

## How the questions were built

Questions are generated per category from the indexed corpus and validated against it during
generation: items in the structure-dependent categories are re-checked against the index, ambiguous
ones dropped and wrong golds corrected. Implicit-change items are additionally verified by hand.

Gold answers are model-generated and corpus-validated rather than authored by legal experts. A
two-annotator audit of 60 released legal golds found no wrong gold and one partly correct gold. It
also found that 9 of 10 sampled implicit-change items are stated in an earlier version's amendment
annotation, so legal "implicit" changes are implicit in the version diff but not always in the
indexed text. The audit files are in `gold_audit/`. This is a retrieval benchmark
over statutory text and is **not legal advice**, nor a reliable statement of the law in force on
any given date — always check legislation.gov.uk directly.

## Licence

Source legislation is Crown copyright, made available under the
[Open Government Licence v3.0](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/).
Per-file source URLs are in `LICENSES.md`. The questions, gold answers and
chunking are released under CC BY 4.0.

## Citation

```bibtex
@inproceedings{stuhlmann2027versionrag,
  title     = {{VersionRAG}: Version-Aware Retrieval-Augmented Generation for Evolving Documents},
  author    = {Stuhlmann, Linus and Mathitharan, Kajaluxan and Huwiler, Daniel and
               Stockinger, Kurt and F{\"u}rst, Jonathan},
  booktitle = {Findings of the Association for Computational Linguistics: EACL 2027},
  year      = {2027}
}
```