VersionQA-Legal / README.md
jofu's picture
Add Parquet copy of the evaluation set so load_dataset works
6490cd7 verified
|
Raw History Blame Contribute Delete
4.76 kB
---
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}
}
```