Built to order

Legal Clause Risk Highlighter for Rental Agreements

This project builds an AI assistant that reads a rental agreement and highlights the clauses a tenant or small landlord should worry about — steep penalties, one-sided termination rights, unfair deposit terms — ranked by risk level with plain-language explanations. It uses Legal-BERT fine-tuned on the CUAD contract-understanding dataset, with each flagged clause mapped to its legal category and shown with the exact risky wording underlined. Suitable for B.E./B.Tech final-year projects in Computer Science, AI/ML and Data Science.

AI & Machine Learning PyTorchGitPython 3.11scikit-learn metricsFlask web demoLegal-BERT · Hugging Face TransformersCUAD contract datasetpdfminerSoftware
Legal Clause Risk Highlighter for Rental Agreements — project thumbnail preview
More project photos (3)

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.

SYSTEM FLOW

5 components 5 connections

Live flow
Drag to explore
100%
userUser

Uploads a rental agreement and reviews the highlighted risks.

Follow the working sequence

How it works

  1. The rental agreement text is segmented into clauses using heading and numbering structure, then tokenized for the model.
  2. Legal-BERT, fine-tuned on CUAD, assigns each clause its most likely clause categories with confidence scores (multi-label classification).
  3. 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.
  4. The demo highlights each clause in the document with its risk color; hovering or clicking opens the detail panel with category, confidence and explanation.
  5. A summary generator aggregates the findings into a risk report: high-risk clause count, the most severe items first, and suggested negotiation points.
  6. 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.

Related guides

All guides

Machine Learning Final Year Project Ideas with Datasets

This guide lists 30+ machine learning final-year project ideas grouped by type — tabular prediction, NLP, computer vision, and time series — each paired with a well-known public dataset from the UCI ML Repository or Kaggle. Pick a dataset with 1,000 to 50,000 rows: large enough to train a real model, small enough to iterate on a laptop. Confirm the license allows academic use and that it has a clear target column. Build a baseline model in week 1 so you always have something working. Avoid collecting your own dataset unless you have 2+ months to spare.

Read guide

CNN Transfer Learning for Students: Fine-Tuning ResNet and MobileNet in PyTorch

Train image classifiers on small datasets with transfer learning: load an ImageNet-pretrained backbone, freeze its early layers, replace the classification head for your classes, train the head first, then unfreeze late layers with a small learning rate for fine-tuning. This guide covers backbone choice (ResNet vs MobileNet vs EfficientNet), the exact PyTorch workflow, freezing strategy, data needs per class, and the errors that waste the most time.

Read guide

Best 10 AI & Machine Learning Projects for 2026

The ten AI/ML builds worth your final year in 2026: every one trains or fine-tunes a real model on a named public benchmark — FaceForensics++, MIT-BIH, LIAR, ShanghaiTech — with defensible evaluation and a working demo. No inflated accuracy claims; every entry links to its live project page.

Read guide
Get a quotation