Legal-BERT for Contract Review (ContractBERT / CUAD models)
A RoBERTa question-answering model fine-tuned on CUAD to highlight the contract clauses lawyers must review.
Language · 314 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Task
- Language
- Parameters
- 124.1M
- Operations
- 314
- Framework
- PyTorch
- Recurrent
- No
- Published
- NeurIPS 2021
- Cited by
- 98 (as of 18 October 2026)
- Authors
- Dan Hendrycks, Collin Burns, Anya Chen, Spencer Ball
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m13695
- Graph hash
- 87ebf6b3489b79b78d89fadeb97f949c74189d00325e045f3bb40d0b10c83c67
- Skeleton hash
- 1fde27467a83977dd36a3fc66179d31c5713cde34e4272dd06e473420dfbeca6
- Architecture hash
- 117c2989eb46768200d29d847ccbf47814a5bd07e89c492c066e5c68335325bd
- Diagram SHA-256
- e0dd0f8715866f01cfe420b3d45a3c2fc55c59101428e1551dafca4407f3dde3
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
How this diagram was made
transformers.AutoModelForQuestionAnswering.from_config()
What it is
CUAD is the Contract Understanding Atticus Dataset, a new dataset for legal contract review, and the models in this family are the Transformer baselines its authors fine-tuned on it. The task is to highlight salient portions of a contract that are important for a human to review. The traced member is the RoBERTa-base variant, one of three checkpoints the authors provide: RoBERTa-base (~100M parameters), RoBERTa-large (~300M parameters) and DeBERTa-xlarge (~900M parameters).
The motivation is cost: many law firms spend approximately 50% of their time reviewing contracts. The dataset was created with dozens of legal experts from The Atticus Project and consists of over 13,000 annotations. CUAD contains 510 contracts and 13101 labeled clauses. Since there are 41 label categories, on average only about 0.25% of each contract is highlighted for each label.
The models treat this as extractive question answering: for each contract and label category, they learn the start and end token positions of the substring that should be highlighted, if any. Each question identifies the label category under consideration, along with a short description of that category, and asks which parts of the context relate to it. To account for the long document lengths, a sliding window is run over each contract. More than 99% of the windows produced this way contain none of the 41 relevant labels, which is why the training recipe has to rebalance them. The network itself is unchanged from the library: the authors use the QuestionAnswering models in the Transformers library, which are suited for this task.
Performance is nascent, and model size matters here: RoBERTa-base at 42.6% AUPR has noticeably lower performance than RoBERTa-large at 48.2%. Pretraining on several gigabytes of unlabeled contracts increases AUPR by only about 3%, so the expert annotations do the heavy lifting. Increasing the amount of training data by an order of magnitude lifts RoBERTa-base from 27.6% to 42.6%, a 15% absolute difference.
Key idea. CUAD, a large expert-annotated dataset for legal contract review, framed so that a model learns the start and end token positions of the clause to highlight, if any. The finding is that Transformer models have nascent performance that is strongly influenced by model design and training dataset size.
- CUAD
- Contract Understanding Atticus Dataset
- ContractBERT
- Legal-BERT for Contract Review
- contract review
- legal NLP
- RoBERTa-base
- RoBERTa-large
- DeBERTa-xlarge
- extractive question answering
- clause extraction
- Atticus Project
- span classification head
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{hendrycks2021cuadexpertannotatednlpdataset,
title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review},
author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball},
year={2021},
eprint={2103.06268},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2103.06268},
}