Skip to content
beginnertext

CUAD Contract Clause Extraction as Extractive QA

Highlight the span in a real contract excerpt that answers a clause-review question, or mark it unanswerable, using CUAD's own wording across eight categories.

Get This Design

View on GitHub(opens in a new tab)

Clone or download from the repository

Quick start:

bash
git clone https://github.com/davidjurgens/potato-showcase.git
cd potato-showcase/text/legal/cuad-contract-clause-extraction
potato start config.yaml

About this dataset

CUAD, the Contract Understanding Atticus Dataset, is a legal contract review corpus released by The Atticus Project. Hendrycks, Burns, Chen, and Ball describe 510 contracts and 13,101 labeled clauses across 41 clause categories, with contracts drawn from public SEC EDGAR filings. For each category, a model must highlight the parts of a contract that a lawyer should review, and a contract may contain no such part.

Law students labeled the contracts after 70-100 hours of training, and each annotation was verified by three additional annotators. The design reproduces the answer-span step in Potato's extractive_qa scheme. Each item shows one clause-review question above a contract excerpt, and the annotator selects the answering text or presses Unanswerable. The questions use the wording of the released SQuAD-style CUAD_v1.json, in the form 'Highlight the parts (if any) of this contract related to ... that should be reviewed by a lawyer'.

The demo covers 8 of the 41 categories (Governing Law, Anti-Assignment, Termination For Convenience, Non-Compete, Exclusivity, Cap On Liability, Audit Rights, and Insurance) over ten short excerpts from real CUAD contracts, two of which hold no answer. Excerpts are cut from the full contract text, so character offsets differ from the dataset. The dataset's own answers are kept in a reference_answers field for comparison. No model_training block is included, because no Potato trainer consumes extractive_qa answers.

Contracts
510
Labeled clauses
13,101
Clause categories
41
Annotator training
70-100 hours
Verification
each annotation checked by three additional annotators
Categories in this demo
8

Configuration File

This Potato config reproduces the annotation task. Save it as config.yaml and run potato start config.yaml to try it.

yaml
# CUAD: Contract Clause Extraction as Extractive QA
#
# Dataset: CUAD, the Contract Understanding Atticus Dataset v1 (The Atticus Project).
# 510 contracts from public SEC EDGAR filings, 13,101 labeled clauses, 41 clause categories.
# Dataset page: https://www.atticusprojectai.org/cuad
# Dataset DOI:  10.5281/zenodo.4595826
# Licence:      CC BY 4.0 (Zenodo record 4595826). The excerpts in sample-data.json are
#               real CUAD contract text, attributed to The Atticus Project.
#
# Paper:
#   @misc{hendrycks2021cuad,
#     doi = {10.48550/ARXIV.2103.06268},
#     url = {https://arxiv.org/abs/2103.06268},
#     author = {Hendrycks, Dan and Burns, Collin and Chen, Anya and Ball, Spencer},
#     title = {CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review},
#     publisher = {arXiv},
#     year = {2021}
#   }
# DOI: 10.48550/arXiv.2103.06268
# Published in the NeurIPS 2021 Datasets and Benchmarks Track. The proceedings
# record carries no DOI, so the arXiv DOI is the one cited.
#
# Task (paper, Section 1): "For each of 41 different labels, models must learn to
# highlight the portions of a contract most salient to that label." A contract may
# hold no such portion, as in SQuAD 2.0.
#
# Question wording (CUAD_v1.json, one template filled per category; the Details text
# is the category description from the CUAD README). The paper's Section 4.1 template
# says "this clause" where CUAD_v1.json says "this contract"; this design follows the JSON:
#   Highlight the parts (if any) of this contract related to "<Category>" that should
#   be reviewed by a lawyer. Details: <description>
#
# Categories used in this demo, with their Details text as released:
#   Governing Law              Which state/country's law governs the interpretation of the contract?
#   Anti-Assignment            Is consent or notice required of a party if the contract is assigned to a third party?
#   Termination For Convenience Can a party terminate this contract without cause (solely by giving a notice and allowing a waiting period to expire)?
#   Non-Compete                Is there a restriction on the ability of a party to compete with the counterparty or operate in a certain geography or business or technology sector?
#   Exclusivity                Is there an exclusive dealing commitment with the counterparty? (full text in sample-data.json)
#   Cap On Liability           Does the contract include a cap on liability upon the breach of a party's obligation? This includes time limitation for the counterparty to bring claims or maximum amount for recovery.
#   Audit Rights               Does a party have the right to audit the books, records, or physical locations of the counterparty to ensure compliance with the contract?
#   Insurance                  Is there a requirement for insurance that must be maintained by one party for the benefit of the counterparty?
#
# Labeling process (paper, Section 3): law students labeled the contracts after
# 70-100 hours of training, and "Each annotation was verified by three additional
# annotators."
#
# Adaptations:
#   - 8 of the 41 categories are used.
#   - Contracts are cut to short excerpts (400 to 1,150 characters) from the full
#     contract text, with whitespace runs collapsed to single spaces and non-breaking
#     spaces in the question text replaced by spaces. Answer offsets therefore differ
#     from CUAD_v1.json. Items 009 and 010 are excerpts with no answer for the asked
#     category, which Potato records through the Unanswerable button.
#   - The dataset's own answer spans are kept in each item's reference_answers field
#     for comparison, and listed in item_properties.private_keys so Potato does not
#     send them to the annotator's page. Only answers that occur inside the excerpt
#     are kept (item 005 keeps one of the dataset's two Exclusivity answers).
#   - CUAD collects every answering span per category in a contract. Potato's
#     extractive_qa scheme stores one span per question, so an excerpt with several
#     answers is a lossy fit.
#   - The two-annotator setting stands in for the paper's three-annotator verification
#     and is not the original review workflow.
#
# Training: no model_training block. No trainer in potato/training/registry.py
# consumes extractive_qa answers, so none is claimed here.

annotation_task_name: "CUAD: Contract Clause Extraction"
task_dir: "."

data_files:
  - sample-data.json

item_properties:
  id_key: id
  text_key: passage
  private_keys: [reference_answers, cuad_qa_id, clause_category, source_contract]

output_annotation_dir: "annotation_output/"
export_annotation_format: "jsonl"

annotation_schemes:
  - annotation_type: extractive_qa
    name: clause_span
    description: "Highlight the part of the contract excerpt that answers the question, or press Unanswerable if the excerpt has none"
    question_field: question
    passage_field: passage
    allow_unanswerable: true
    highlight_color: "#FFEB3B"

user_config:
  allow_all_users: true
  users: []

num_annotators_per_item: 2

annotation_instructions: |
  Each item shows a clause-review question and an excerpt from a commercial contract.
  Select the text in the excerpt that is responsive to the question. If the
  excerpt has no such text, press Unanswerable.

Sample Data

json
[
  {
    "id": "cuad_001",
    "clause_category": "Governing Law",
    "question": "Highlight the parts (if any) of this contract related to \"Governing Law\" that should be reviewed by a lawyer. Details: Which state/country's law governs the interpretation of the contract?",
    "passage": "Neither party to this Agreement shall be liable to the other party, nor shall be subject to injunctive relief by the other party if that party's performance of its duties or obligations under this Agreement is the consequence of Force Majeure as defined in Section 2.2 hereunder. 6.9 Governing Law. This Agreement is to be construed according to the laws of the State of Illinois. 7. NEW PRODUCTS 7.1 Right of Option.",
    "source_contract": "LIMEENERGYCO_09_09_1999-EX-10-DISTRIBUTOR AGREEMENT",
    "cuad_qa_id": "LIMEENERGYCO_09_09_1999-EX-10-DISTRIBUTOR AGREEMENT__Governing Law",
    "reference_answers": [
      "This Agreement is to be construed according to the laws of the State of Illinois."
    ]
  },
  {
    "id": "cuad_002",
    "clause_category": "Anti-Assignment",
    "question": "Highlight the parts (if any) of this contract related to \"Anti-Assignment\" that should be reviewed by a lawyer. Details: Is consent or notice required of a party if the contract is assigned to a third party?",
    "passage": "All notices shall be deemed to have been given on receipt as verified by written or automated receipt or electronic log (as applicable). All other notices must be in English, in writing, addressed to the other party's primary contact and sent to their then current postal address or email address. 11.3 Assignment. [ * ] may [ * ]any of its rights or obligations under this Agreement without the prior written consent of [ * ]. For the avoidance of doubt, a Change of Control shall be deemed an assignment hereunder unless [ * ] does not exercise its [ * ]. 11.4 Force Majeure.",
    "source_contract": "WHITESMOKE,INC_11_08_2011-EX-10.26-PROMOTION AND DISTRIBUTION AGREEMENT",
    "cuad_qa_id": "WHITESMOKE,INC_11_08_2011-EX-10.26-PROMOTION AND DISTRIBUTION AGREEMENT__Anti-Assignment",
    "reference_answers": [
      "[ * ] may [ * ]any of its rights or obligations under this Agreement without the prior written consent of [ * ]."
    ]
  }
]

// ... and 8 more items

Dataset & paper

Hendrycks et al., NeurIPS Datasets and Benchmarks 2021

Paper DOI
10.48550/arXiv.2103.06268
Dataset DOI
10.5281/zenodo.4595826

Citation (BibTeX)

bibtex
@misc{hendrycks2021cuad,
  doi = {10.48550/ARXIV.2103.06268},
  url = {https://arxiv.org/abs/2103.06268},
  author = {Hendrycks, Dan and Burns, Collin and Chen, Anya and Ball, Spencer},
  title = {CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review},
  publisher = {arXiv},
  year = {2021}
}

Details

Annotation Types

extractive_qa

Domain

LegalNLP

Use Cases

Contract ReviewClause ExtractionExtractive Question Answering

Tags

cuadcontractslegalclause-extractionextractive-qaneurips2021

Found an issue or want to improve this design?

Open an Issue(opens in a new tab)