The problem
Rental agreements are long, dense, and almost never read fully — yet they contain clauses that can cost a tenant months of rent in penalties or lock them into one-sided terms. Professional contract review is expensive, and generic chatbots give unreliable legal-sounding answers with no grounding. This project takes the grounded route: a Legal-BERT classifier fine-tuned on CUAD (Contract Understanding Atticus Dataset, 510 real contracts with 41 labeled clause categories) identifies clause types in a rental agreement, and a risk-mapping layer scores each category as high, medium or low risk for the signing party. Every highlight is traceable — the demo shows the clause text, its CUAD category, the risk tier and a plain-language explanation of why it matters. The report is explicit that this is an educational aid, not legal advice.
Uploads a rental agreement and reviews the highlighted risks.
Follow the working sequence
How it works
- The rental agreement text is segmented into clauses using heading and numbering structure, then tokenized for the model.
- Legal-BERT, fine-tuned on CUAD, assigns each clause its most likely clause categories with confidence scores (multi-label classification).
- A risk-mapping table converts categories to risk tiers for the tenant — e.g. unilateral termination rights map to high risk, governing-law clauses to low.
- The demo highlights each clause in the document with its risk color; hovering or clicking opens the detail panel with category, confidence and explanation.
- A summary generator aggregates the findings into a risk report: high-risk clause count, the most severe items first, and suggested negotiation points.
- Evaluation runs on CUAD's held-out contracts with per-category precision/recall and AUPR, reported honestly in the report.
Tech stack:
- Python 3.11, Hugging Face Transformers
- Legal-BERT (nlpaueb/legal-bert-base-uncased)
- CUAD dataset (The Atticus Project)
- PyTorch (fine-tuning)
- scikit-learn (metrics: precision/recall/AUPR)
- Flask + HTML/CSS/JS (demo)
- pdfminer (agreement text extraction)
Dataset & model details
- Dataset: CUAD — Contract Understanding Atticus Dataset (Hendrycks et al., 2021): 510 real contracts, 13,000+ expert-labeled clause spans across 41 categories. Source: Hugging Face datasets (
cuad). The demo's sample rental agreement is written for the project and labeled in CUAD style. - Task: Multi-label clause classification — input = contract clause text, output = CUAD clause categories with confidence, mapped to tenant risk tiers.
- Model: Legal-BERT base (110M parameters) fine-tuned on CUAD clause spans; risk tiers from a documented category→risk mapping table.
- Metrics: Per-category precision/recall and area under the precision-recall curve (AUPR) on CUAD's test split — the published CUAD baseline reaches ~44% AUPR, which is cited as the literature reference; this project's achieved figures are design targets reported after training.
| Parameter | Value |
|---|---|
| Clause categories | 41 (CUAD label set) |
| Risk tiers | High / Medium / Low, documented mapping |
| Model | Legal-BERT-base fine-tune, ~110M parameters |
| AUPR | Design target vs ~44% published CUAD baseline (not claimed) |
| Demo input | Pasted agreement text or preloaded sample |
| Inference | Under 5 s per agreement on CPU (expected) |
| Fine-tuning | Approximately 2–4 h on a single GPU (expected) |
Project features
- [CUAD-trained clause classifier] Legal-BERT fine-tuned on the CUAD dataset recognizes 41 contract clause categories (termination, indemnity, governing law, renewal terms and more).
- [Risk-tier mapping] Each clause category is mapped to high/medium/low risk for the tenant, with a documented rationale for every mapping.
- [In-document highlighting] The demo renders a realistic rental agreement with risky clauses highlighted in place and the exact risky phrasing underlined.
- [Plain-language explanations] Every flagged clause carries a non-technical explanation of what it means and what to negotiate — written for students, not lawyers.
- [Clause detail panel] Click any highlight to see its CUAD category, model confidence, risk tier and the reference definition from the dataset's annotation guide.
- [Risk summary report] A one-page summary lists all high-risk clauses with counts, so the whole agreement's risk profile is visible at a glance.
- [Educational-use framing] The interface and report state clearly that this is a study aid, not legal advice — an honest scope boundary.
What is included
- Fine-tuned Legal-BERT clause classifier
- Clause segmentation + risk-mapping pipeline source
- Web demo with a realistic preloaded rental agreement
- CUAD evaluation notebook (per-category precision/recall/AUPR)
- Plain-language explanation bank for all risk-flagged categories
- Project report PDF (background, legal NLP, CUAD, methodology, results)
- PPT presentation for final review
- Viva Q&A preparation document (Legal-BERT, CUAD, multi-label classification, AUPR)
Limitations & prerequisites
- CUAD contracts are mostly US commercial agreements; Indian rental-agreement phrasing differs, so the demo agreement is labeled in CUAD style and the domain gap is discussed in the report.
- This is an educational aid, not legal advice — the interface and report state this explicitly.
- AUPR figures are design targets until the training run executes; the report records achieved scores.
- The model classifies clause types; it does not interpret enforceability under any jurisdiction's law.
- Handwritten or scanned agreements need OCR first, which is out of scope.
Frequently Asked Questions
Which dataset is used?
CUAD (Contract Understanding Atticus Dataset) — 510 real contracts with over 13,000 expert-labeled clauses across 41 categories. It is the standard public benchmark for contract understanding.
How does it decide a clause is risky?
The model first identifies what the clause is (e.g. a unilateral termination clause); a documented mapping table then assigns the risk tier. The mapping is visible in the report, not hidden.
Is this legal advice?
No — and the project is explicit about it. It is an educational NLP project that flags clause types worth a closer look; real agreements need a real lawyer.
Why rental agreements specifically?
They are the contracts students and young professionals actually sign, and their clause patterns (deposit, lock-in, termination, maintenance) map cleanly onto CUAD categories.
Can it read my own agreement?
The pipeline accepts pasted text; PDF upload extraction is included via pdfminer for text-based PDFs.
Is this project suitable for a final-year project?
Yes — for Computer Science, IT and AI/ML programs. It applies domain-adapted transformers to a socially useful document-understanding task with honest evaluation. Suitable for B.E./B.Tech final-year projects in Computer Science, IT and AI & Machine Learning.
Components & software requirements
- Python 3.11, Hugging Face Transformers
- Legal-BERT (nlpaueb/legal-bert-base-uncased)
- CUAD dataset (The Atticus Project)
- PyTorch (fine-tuning)
- scikit-learn (metrics: precision/recall/AUPR)
- Flask + HTML/CSS/JS (demo)
- pdfminer (agreement text extraction)
Dataset & model details
- Dataset: CUAD — Contract Understanding Atticus Dataset (Hendrycks et al., 2021): 510 real contracts, 13,000+ expert-labeled clause spans across 41 categories. Source: Hugging Face datasets (
cuad). The demo's sample rental agreement is written for the project and labeled in CUAD style. - Task: Multi-label clause classification — input = contract clause text, output = CUAD clause categories with confidence, mapped to tenant risk tiers.
- Model: Legal-BERT base (110M parameters) fine-tuned on CUAD clause spans; risk tiers from a documented category→risk mapping table.
- Metrics: Per-category precision/recall and area under the precision-recall curve (AUPR) on CUAD's test split — the published CUAD baseline reaches ~44% AUPR, which is cited as the literature reference; this project's achieved figures are design targets reported after training.
Delivery information
Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.
Support terms
Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.
Download free synopsis (PDF)
Enter your name and WhatsApp number — the synopsis PDF downloads immediately. We may send occasional project updates on WhatsApp; no spam.