Demo

Clause Classifier

Why fine-tune a small model when you could just prompt a large one? This demo runs the same classification task through both approaches so you can see the tradeoffs firsthand.

PyTorch Hugging Face Transformers Legal-BERT gpt-4o-mini FastAPI CUAD Dataset

How It Works

Legal-BERT (Fine-tuned)

A 110M-parameter transformer built with PyTorch and Hugging Face, fine-tuned on 15,700 labeled examples from 510 real SEC filings (the CUAD dataset). Multi-label classification head with sigmoid outputs. Runs on CPU in about 5ms. Cost per request: $0.

GPT-4o-mini (Prompt-based)

A general-purpose LLM given a structured prompt listing all 41 CUAD clause types. No contract-specific training. Runs via API in about 800ms at roughly $0.0002 per request.

What to Compare

Speed and cost at scale. Which labels each model catches and which it misses. Where they agree, and what disagreement tells you about both approaches.

Each classification takes 1-3 seconds. No data is stored.

Why This Matters

Every organization that handles contracts faces the same question: how do you review thousands of pages of legal text without missing something that costs you money?

Contract clause classification is one of the most practical applications of machine learning in legal and compliance work. A trained model can scan an entire contract in seconds, flagging non-compete restrictions, IP assignment terms, liability caps, termination conditions, and dozens of other clause types that a human reviewer might spend hours finding manually.

This demo shows two real paths to building that system. The fine-tuned approach (training your own model with PyTorch on domain-specific data) gives you speed, zero marginal cost, and full control over the model. The prompt-based approach (sending text to an LLM API) gets you up and running faster but costs money per request and depends on an external service. Most production systems end up using some combination of both.

The tradeoff isn't academic. A legal team processing 500 contracts per month, a procurement department onboarding new vendors, an M&A due diligence team reviewing a target's obligations — they all need this kind of automated classification to work at scale.

Pick a contract clause to classify: