orgrctera's picture
Upload README.md with huggingface_hub
0b832ee verified
|
Raw
History Blame Contribute Delete
9.13 kB
---
language:
- en
license: cc-by-4.0
tags:
- legal
- question-answering
- rag
- contracts
- cuad
pretty_name: LegalBenchRAG CUAD (QA)
size_categories:
- "1K<n<10K"
task_categories:
- question-answering
---
# LegalBenchRAG: CUAD (question answering)
This dataset is the **CUAD** slice of [**LegalBench-RAG**](https://arxiv.org/abs/2408.10343), packaged as a **question answering (QA)** task over commercial contract text. Each row pairs a natural-language **query** about a named agreement with one or more **gold answer strings**: verbatim (or minimally normalized) spans from the underlying contract that answer the question. This mirrors how practitioners review contracts—locating the clauses that substantiate a yes/no or fact-seeking question—while staying aligned with the LegalBench-RAG benchmark family’s focus on **legally grounded** supervision.
## Background: CUAD (Contract Understanding Atticus Dataset)
[**CUAD**](https://www.atticusprojectai.org/cuad) (*CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review*, Hendrycks et al., NeurIPS 2021 Datasets and Benchmarks Track) is a large, expert-annotated resource for **legal contract review**. It was built with legal experts from [The Atticus Project](https://www.atticusprojectai.org/) and comprises **510** PDF commercial contracts and **over 13,000** labels across **41** clause categories relevant to transactions such as M&A (e.g. termination, liability caps, assignment, confidentiality, IP, and payment terms).
The **original CUAD modeling task** is to identify **salient spans** in a contract that a lawyer should examine for a given clause type—i.e. **highlighting** important text for human review. Transformer baselines show promising but far-from-saturated performance, and CUAD remains a standard benchmark for **long-document legal NLP**.
- **Original resources:** [The Atticus Project — CUAD](https://www.atticusprojectai.org/cuad) · [GitHub: TheAtticusProject/cuad](https://github.com/TheAtticusProject/cuad)
- **License:** [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) (see the official CUAD release for full terms).
## Task: question answering for CUAD (LegalBenchRAG QA)
In this Hugging Face distribution, the task is **question answering** on the **CUAD** corpus under the **LegalBench-RAG** benchmark: given an `input` query that names an agreement and asks a concrete legal question (often phrased in a yes/no style), a system should produce **answer text** that is **supported by** the contract—here represented as a **JSON-encoded list of strings**, each string being a gold answer span (one or more disjoint clauses may be required for a single question).
Typical uses include:
- Training or evaluating **extractive QA** and **long-context** models on real contracts.
- **RAG** pipelines where the retriever must surface passages that a generator can quote as answers.
- Benchmarking **legal** LMs against human-annotated reference strings rather than only automatic metrics on generic QA.
This slice is explicitly labeled **`qa`** in the LegalBenchRAG export (as opposed to span-offset **retrieval** formulations used for other sub-benchmarks).
## Relation to LegalBench and LegalBench-RAG
- [**LegalBench**](https://hazyresearch.stanford.edu/legalbench/) aggregates many tasks for evaluating legal reasoning in language models.
- [**LegalBench-RAG**](https://arxiv.org/abs/2408.10343) (Pipitone & Alami, 2024) evaluates the **retrieval** component of legal RAG with **thousands** of query–answer pairs and **minimal relevant segments** annotated by legal experts across multiple corpora, including **CUAD**, ContractNLI, MAUD, and PrivacyQA. Public artifacts are linked from the paper and community repositories (e.g. [zeroentropy-ai/legalbenchrag](https://github.com/zeroentropy-ai/legalbenchrag)).
When citing work that uses this dataset, cite **CUAD** for the underlying contracts and annotations, **LegalBench-RAG** for the benchmark framing, and this dataset card for this **QA** packaging.
## Dataset structure
| Field | Description |
|-------|-------------|
| `id` | Unique example identifier (UUID string). |
| `input` | Natural-language **query**, typically opening with “Consider the …” and naming parties and the agreement, followed by a **yes/no-style or factual** legal question (e.g. anti-assignment, liability caps). |
| `expected_output` | JSON **string** encoding a **list of strings**. Each string is a **gold answer**: contract language that answers the question (multiple strings when several clauses jointly support the answer). |
| `metadata.item` | JSON **string** with auxiliary export fields (e.g. duplicated query and answer list for traceability). |
The **`default`** split contains **4,042** rows.
## Example records
**Example 1** — single gold span (`expected_output` is a string containing JSON):
- **`input`:**
`Consider the First Amendment to Distributor Agreement between Peregrine/Bridge Transfer Corporation, NEON Systems, Inc., and Skunkware, Inc.; Is there an anti-assignment clause in this contract?`
- **`expected_output`** (parsed):
```json
[
"Any sale, transfer or other conveyance of all or any part of the stock in, or assets of, Licensor in violation of this Section shall be null and void."
]
```
**Example 2** — multiple gold spans for one query (excerpt; liability-related question with several supporting passages):
- **`input`:**
`Consider the Global Master Supply Agreement between ExxonMobil Chemical Company and West Pharmaceutical Services, Inc.; Is there a cap on liability under this contract?`
- **`expected_output`** (parsed; first two strings shown; the full list contains five gold strings in the dataset):
```json
[
"In no event shall either party be responsible for any special, punitive, or consequential damages whatsoever.",
"All claims for any cause whatsoever, whether based in contract, negligence or other tort, strict liability, breach of warranty or otherwise, shall be deemed waived unconditionally and absolutely unless Seller receives written notice of such claim not later than one hundred fifty (150) days after Buyer's receipt of Product as to which such claim is made. …"
]
```
Evaluators typically parse `expected_output` and compare model outputs using **token- or span-level** overlap, **exact match** on normalized text, or **LLM-as-judge** protocols—consistent with the LegalBench-RAG emphasis on **faithful** quoting from source contracts.
## References
1. **CUAD (original dataset and contract-review task)**
Dan Hendrycks, Collin Burns, Anya Chen, Spencer Ball. *CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review.* NeurIPS 2021 Datasets and Benchmarks Track.
[NeurIPS Proceedings](https://datasets-benchmarks-proceedings.neurips.cc/paper/2021/hash/6ea9ab1baa0efb9e19094440c317e21b-Abstract.html) · [arXiv:2103.06268](https://arxiv.org/abs/2103.06268) · [PDF](https://arxiv.org/pdf/2103.06268.pdf)
**Abstract (short):** Expert-annotated contract review dataset with 13,000+ labels over 510 agreements; task is to highlight text important for review; Transformer models show nascent performance with large headroom for improvement.
```bibtex
@inproceedings{hendrycks2021cuad,
title = {{CUAD}: An Expert-Annotated {NLP} Dataset for Legal Contract Review},
author = {Hendrycks, Dan and Burns, Collin and Chen, Anya and Ball, Spencer},
booktitle = {Proceedings of the Neural Information Processing Systems Track on Datasets and Benchmarks},
year = {2021},
url = {https://datasets-benchmarks-proceedings.neurips.cc/paper/2021/hash/6ea9ab1baa0efb9e19094440c317e21b-Abstract.html}
}
```
2. **LegalBench-RAG (retrieval benchmark; includes CUAD among sources)**
Nicholas Pipitone and Ghita Houir Alami. *LegalBench-RAG: A Benchmark for Retrieval-Augmented Generation in the Legal Domain.* arXiv:2408.10343, 2024.
[arXiv](https://arxiv.org/abs/2408.10343) · [PDF](https://arxiv.org/pdf/2408.10343)
**Abstract (short):** Proposes evaluating **retrieval** for legal RAG with **minimal human-annotated segments** so metrics can be precise and generations can cite sources without huge irrelevant chunks.
```bibtex
@article{pipitone2024legalbenchrag,
title = {{LegalBench-RAG}: A Benchmark for Retrieval-Augmented Generation in the Legal Domain},
author = {Pipitone, Nicholas and Alami, Ghita Houir},
journal = {arXiv preprint arXiv:2408.10343},
year = {2024}
}
```
3. **LegalBench (umbrella)**
[LegalBench](https://hazyresearch.stanford.edu/legalbench/) — broader suite of legal NLP tasks.
## Acknowledgments
Data lineage traces to **CUAD** (The Atticus Project) and the **LegalBench-RAG** benchmark construction. Use of the original CUAD materials remains subject to **CC BY 4.0** and any additional terms on the official CUAD release. This Hugging Face export was produced from a **Langfuse**-tracked export (`metadata.item` may mirror query/answer fields for provenance).