AI Prototype for Document Classification

AI Prototype for Document Classification

Legal sector scale-up•Legal Tech•2025•3 weeks

The Problem

A law firm received hundreds of documents daily to manually classify into 15 categories. The process was slow, error-prone and created bottlenecks in the workflow.

  • Manual classification required 3-4 hours/day
  • 12% error rate in categorization
  • Impossible to scale with increasing volume

Constraints

Timeline: 3 weeks for working MVP
Budget: Startup budget, focus on rapid validation
Technical:
  • • Limited initial dataset (~500 labeled documents)
  • • Need for integration with existing document system
  • • GDPR requirements for data privacy
Compliance:
  • • GDPR compliance for sensitive legal data
  • • Audit trail for every classification

The Solution

Architecture

FastAPI with ML model (fine-tuned multilingual BERT) for automatic classification. React frontend for human review. Deployed on Railway with automated CI/CD.

Key Decisions

  • Fine-tuning pre-trained model instead of training from scratch (faster, small dataset)
  • Human-in-the-loop: AI suggests, human validates (increases trust)
  • Feature: confidence score for each prediction (transparency)
  • Complete logging for auditing and continuous improvement

Approach

MVP in 3 weeks: week 1 = data prep + baseline model, week 2 = fine-tuning + API, week 3 = frontend + integration + testing with real users.

Low-confidence predictions go to human review, never auto-filed
def classify(doc):
    # Low-confidence predictions are routed
    # to human review, never auto-filed.
    result = model.predict(doc.text)
    if result.confidence < 0.85:
        return Prediction(result.label, status="review")
    return Prediction(result.label, status="auto")

Measurable Results

from 3-4h/day to 30min
Classification time

AI classifies automatically, human validates only doubtful cases

88% on complex categories
Accuracy

Measured on test set of 100 documents

3x previous volume
Documents processed

With same team, thanks to automation

Overall Impact

The firm drastically reduced classification time and can now process 3x more documents with the same team. The system is now being extended to new categories and clients.

My Role

  • ML pipeline architecture design
  • Data preparation and labeling strategy
  • BERT model fine-tuning
  • API and frontend development
  • CI/CD and monitoring setup
  • Team training on usage and maintenance

Want similar results for your project?