A fine-tuned DeBERTa beat zero-shot GPT-4 at sorting contract clauses into 23 types
Made by Eoin O’Connell and seven co-authors
The result
The story
Sorting contract clauses
Lawyers reviewing a commercial contract look for specific clauses: who may terminate, how liability is capped, which law governs. CUAD, a dataset curated by legal experts at The Atticus Project, marks such clauses in 510 commercial contracts, with 41 label types and over 13,000 annotations by law students.

A team from Ulster University and the law firm A&O Shearman in Belfast rebuilt it as a cleaner single-label task, CUAD-SL. They cut each contract into segments with a version of the GraphSeg algorithm, gave each segment its dominant label and, with a legal domain expert, merged the 41 labels into 23. About 90% of segments had no label and were left out; the rest were split 7:3, stratified by clause type. Segments are short, a median of 10 to 11 words.
Data
CUAD-SL (single-label CUAD)
7,104 training and 3,045 test clause-label pairs (Table 3)
CUAD by The Atticus Project: 510 commercial contracts; re-segmented with GraphSeg and mapped from 41 labels to 23 with a legal domain expert
Unlabelled segments (about 90%) dropped; 7:3 split stratified by clause type. Table 1’s per-class counts add up to 8,881 and 3,819 instead. The dataset isn’t released with the article.
Seven models, one of them zero-shot
The lineup ran from a classic TF-IDF + SGD classifier through fine-tuned BERT base, RoBERTa large and DeBERTa large to GPT-3 Ada and Curie fine-tuned through OpenAI’s API, and GPT-4 with no training at all. DeBERTa was fine-tuned the standard way: a classification head on top, all weights trained for 5 epochs at a learning rate of 2e-5.
Small model
DeBERTa large (fine-tuned)
not stated in the article · Microsoft
Classification head added and all weights fine-tuned on the CUAD-SL training clauses
- Base
- The DeBERTa large model through Hugging Face; v1 or v3 checkpoint not named
Training
Full fine-tune with Hugging Face Transformers
5 epochs, batch size 1,000, learning rate 2e-5, 20 warm-up steps, AdamW, weight decay 0, seed 42
- Hardware
- Costed on an Azure Standard_NC24s_v3 VM (low priority, £2.25/h)
- Cost
- £17 of training compute plus £3,552 to label the training data (authors’ estimates)
Not reported: time.
Large model
GPT-4 (8K context)
Size not disclosed · OpenAI
Used as released through the GPT-4 API, zero-shot: the clause, ‘You are a lawyer’, the 23 labels and a label-only answer
- Base
- General model; fine-tuning wasn’t offered for GPT-4 at the time
GPT-4 got the clause, a one-line instruction to classify it as a lawyer would, and the list of 23 labels, with no examples; its answers were cleaned into labels afterwards. The authors name few-shot prompting as the obvious next step and did not test it.
What they found
Evaluation
3,045 test items per Table 3 (Table 1 and Section 4 give other counts)
- Test set
- CUAD-SL test split (30%, stratified by clause type)
- Metric
- Weighted accuracy over 23 clause types (each type weighted by its share of the test data)
- How it was compared
- Same test clauses and metric for all seven models. GPT-4 got a one-line instruction and the 23 label names, zero-shot, with no examples; temperature and snapshot not stated.
DeBERTa scored 87.8% weighted accuracy, RoBERTa 86.4%, Ada-FT 83.8%, TF-IDF + SGD 83.7%, Curie-FT 81.7%, BERT 78.9% and GPT-4 67.2%. GPT-4’s results were uneven rather than uniformly low: it was the best model on the two clause types every model found hardest, Price Restrictions (85.7%) and Competitive Restriction Exception (56.7%), and got every Governing Law clause right.
What a year would cost
The paper then priced each model for a year on Azure: labelling at £0.50 per clause, training and test compute, hosting and inference, at about one request a minute and about 120 a minute over a 1,650-hour working year. At the low volume GPT-4 is the cheapest option, about £7 a day against £38 for DeBERTa, most of which pays for a dedicated hosting machine. At the high volume GPT-4 rises to about £317 a day and DeBERTa to £134. Our own division of the yearly totals by the requests (an estimate, not the paper’s) gives roughly £0.14 vs £0.025 per request at low volume, and £0.00413 vs £0.00976 at high volume.
These are the authors’ estimates from price lists, not measured bills, and no latency is reported. Their own pick for cost-efficiency is the fine-tuned Ada (83.8%, £15 to £20 a day), with DeBERTa for when accuracy matters most.
All the numbers
Show all numbersHide all numbersEvery model · Cost, latency and energy · 2 more results
Every model on the headline test
The abstract calls the gap an improvement ‘of up to 20.6%’; it is the 87.8 vs 67.2 difference, in percentage points. Weighted accuracy weights each clause type by how common it is in the test data.
Cost, latency and energy, as reported
- Cost · GBP per day, as reported (one-year total cost in Table 3: DeBERTa £13,862 low / £48,968 high; GPT-4 £2,487 low / £115,958 high)
- DeBERTa large, fine-tuned38 low usage · 134 high usage
- GPT-4, zero-shot7 low usage · 317 high usage
- DeBERTa: trained and tested on Azure Standard_NC24s_v3 virtual machines (low priority, £2.25/hour); hosted on 1 (low usage) or 3 (high usage) dedicated Azure Standard_NC6 virtual machines at £1/hour each. GPT-4: OpenAI API, hardware not disclosed.
- The authors’ estimate for running each model for a year on Azure, not a measured bill. Low usage: about 1 inference per minute over a 1,650-hour working year (25 million tokens). High usage: about 120 inferences per minute (3 billion tokens). Costs include labelling data at £0.50 per clause (£3,552 for training data and £1,523 for test data, treated as a yearly cost; GPT-4 pays only the test data), training and testing compute, hosting and inference. GPT-4 is billed per token with a 50% token mark-up for the longer prompt; DeBERTa pays for dedicated hosting and no per-token fees. Result: GPT-4 is the cheapest option at low usage (£7 vs £38 a day) and the most expensive at high usage (£317 vs £134 a day).
- Latency
- Not reported
- Energy
- Not reported
More from the source
Weighted accuracy and standard deviation of accuracy across clause types, all models
model accuracy sd Across Classes GPT-4 (zero-shot) 67.2 24.1 BERT base (fine-tuned) 78.9 33.6 GPT-3 Curie (fine-tuned via OpenAI) 81.7 15.8 TF-IDF + SGD (classic, non-neural) 83.7 29 GPT-3 Ada (fine-tuned via OpenAI) 83.8 17 RoBERTa large (fine-tuned) 86.4 16.2 DeBERTa large (fine-tuned) 87.8 13.4 Table 2
Clause types where GPT-4 did best
Price Restrictions GPT-4 85.7% vs 57.1% for Curie-FT and DeBERTa Competitive Restriction Exception GPT-4 56.7%, best of all models (all-model average 29%) Governing Law GPT-4 100% Audit Rights, Termination Rights GPT-4 about 94% Section 4, Figure 1
Worth knowing
- GPT-4 was prompted zero-shot with only the list of labels; the fine-tuned models trained on labelled clauses. The authors suggest few-shot prompting as an improvement they did not test.
- Cost cuts both ways: in the paper’s low-usage scenario GPT-4 is the cheapest option (£7 vs £38 a day). DeBERTa is cheaper only in the high-usage scenario (£134 vs £317 a day).
- Costs are the authors’ estimates from Azure and OpenAI price lists in GBP and assumed labelling costs, not measured bills.
- GPT-4 beat every other model on some rare clause types (Price Restrictions, Competitive Restriction Exception).
3 more caveats
- Older OpenAI models (GPT-4 8K, GPT-3 Ada and Curie fine-tunes); the run dates are not stated.
- Segments with no clause label (about 90% of all segments) were excluded, so the benchmark does not test telling relevant clauses from everything else.
- Dataset counts differ between Table 1, Table 3 and the Section 4 text; repeated runs or confidence intervals are not reported.
Weights on Hugging Face
The paper names only ‘the DeBERTa large model’ used through Hugging Face, with no repo id. Both microsoft/deberta-large and microsoft/deberta-v3-large exist on Hugging Face (checked 03 Oct 2026), so the exact checkpoint is not identified.
Sources
- O’Connell et al., “Cost-benefit analysis of deploying shallow, deep learning and generative models for legal text classification”, Artificial Intelligence and Law (2025), open access
- Same article, DOI 10.1007/s10506-025-09484-4
- Artificial Intelligence and Law (Springer), version of record 11 Nov 2025; received 26 Jul 2024, accepted 2 Sep 2025. The paper does not say when the GPT-4 runs were made; it used GPT-4 with 8K context and fine-tuned GPT-3 Ada and Curie.