Back to Portfolio
AI Product Development · RAG Pipeline · LLM Integration

LexAI — AI Legal Document Assistant for Meridian Law Partners LLP

A fully private, RAG-powered legal document assistant deployed inside Meridian's Azure VPC — reviewing NDAs, service agreements, and due diligence packs in under 60 seconds with full source citations, zero data leaving the Azure tenant.

RAG Pipeline Azure OpenAI (GPT-4o) LangChain pgvector NetDocuments Integration Private VPC Deployment
74%
Reduction in Document Review Time
$380K
Annual Billable Hours Recovered
99.1%
Accuracy on Contract Clause Extraction
12 Weeks
Idea to Production
Client
Meridian Law Partners LLP
Industry
Legal / Law Firm Technology
Location
London, UK
Duration
12 Weeks · Q3 2024
Project Overview

About This Project

Meridian Law Partners spent 40% of junior associate time on document review — reading through NDAs, service agreements, employment contracts, and due diligence documents to extract key clauses, flag risks, and summarise obligations. Partners wanted a private, secure AI tool that could replace this grunt work without sending client documents to third-party AI services.

We built LexAI: a fully private RAG-powered legal document assistant that runs inside their own Azure VPC, trained on 12,000 precedent documents, and accessible via a clean web interface integrated with their existing document management system (NetDocuments). A 150-page contract now returns a risk summary in 47 seconds.

Python / FastAPI
Azure OpenAI (GPT-4o)
LangChain
LlamaIndex
pgvector
React + TypeScript
NetDocuments API
Azure VPC Deployment
FAISS Embeddings
Azure Key Vault
74%
Document review time saved — what took 4 hours now takes 8 minutes
$380K
Annual billable hours recovered across 85 attorneys — validated by firm ops team
99.1%
Clause extraction accuracy validated by 3 senior partners vs. manual review
47 sec
Average processing time for a 150-page contract end-to-end
The Problem

Challenges We Solved

Client Data Privacy Requirement

The firm's professional indemnity insurer prohibited sending client documents to any third-party AI service. Required 100% private deployment with no data leaving the Azure tenant — a hard blocker from day one.

UK Legal Language Complexity

Standard LLMs hallucinate on UK-specific legal terminology, jurisdiction references, and clause structures. Required domain-adapted prompting and fine-tuning on UK common law precedents — generic models were rejected in early testing.

Multi-Document Cross-Referencing

Lawyers needed to query across 50–200 documents simultaneously during due diligence — "find all clauses restricting IP assignment across all 84 agreements in this acquisition folder" — in under 2 minutes.

NetDocuments Integration

Documents needed to flow from their existing DMS (NetDocuments) into the AI pipeline automatically, with bi-directional status updates and no double-entry workflow — the firm had 12 years of documents in NetDocuments and would not migrate.

Audit Trail for Professional Liability

Every AI-generated output needed a verifiable source citation for professional liability purposes — lawyers must be able to trace every AI claim back to the exact sentence and page number in the source document.

Speed Requirements at Scale

A 150-page contract needed to return a risk summary in under 60 seconds. Standard RAG chunking strategies with sequential embedding weren't fast enough at full document scale — early benchmarks showed 4–6 minute processing times.

Our Approach

How We Solved It

Private Azure VPC Deployment

Deployed entirely within Meridian's existing Azure tenant using Azure OpenAI private endpoints. Documents never leave their environment — same GPT-4o inference capabilities, zero third-party data exposure. Passed insurer audit on first submission.

UK Legal 4-Layer Prompt Engineering

Built a 4-layer prompt system: system context (UK law jurisdiction), document type classifier, clause extraction prompts per contract type (NDA / SLA / employment / M&A), and risk flagging instructions — calibrated against 200 human-reviewed test cases from Meridian's senior associates.

Hierarchical RAG Architecture

Implemented a two-tier retrieval system: fast BM25 keyword filtering for initial candidate selection, followed by dense vector search (pgvector + FAISS) for semantic relevance scoring. Multi-document queries fan out in parallel across document shards with result merging.

NetDocuments Webhook Integration

Built a real-time webhook listener that ingests new documents from NetDocuments automatically, processes them through the embedding pipeline (chunking → embedding → indexing), and returns structured metadata tags back to the DMS — no manual intervention required.

Citation-Grounded Response Engine

Every LexAI response includes exact source citations: document name, page number, paragraph, and a highlighted excerpt. Built a custom answer verification layer that cross-checks generated text against retrieved chunks — flagging any response where citations don't directly support the claim.

Streaming + Parallel Async Chunking

Implemented SSE streaming responses so users see output within 3 seconds of query submission. Large documents are chunked in parallel with 8 async FastAPI workers, reducing a 150-page contract from 4+ minutes to a 47-second average — comfortably under the 60-second requirement.

Results

The Outcomes

Month 1 — Pilot
74% Time Reduction Validated

Pilot with 8 junior associates on NDA and service agreement review. The average 4-hour document review dropped to 51 minutes. Associates reported the AI's source citations made spot-checking faster than reading from scratch.

Month 2 — Full Rollout
$380K Annual Recovery Calculated

Rolled out across all 85 attorneys. The firm's operations team calculated $380K in annualised billable hour recovery — time previously spent on non-billable document parsing now redirected to client-facing work.

Month 3+ — Validated Accuracy
99.1% Clause Extraction Accuracy

Three senior partners independently reviewed 340 AI-extracted clause sets against manual review. 99.1% accuracy was confirmed — with errors limited to highly ambiguous cross-referenced clauses that junior associates also frequently missed.

$380K Recovered. 12 Weeks. Zero Data Left Azure.
LexAI went from whiteboard to full production deployment across an 85-attorney London law firm — with 99.1% validated accuracy and insurer-approved privacy architecture.
★★★★★
"LexAI has fundamentally changed how our junior associates spend their time. What used to take a first-year 4 hours now takes 8 minutes — with better accuracy and full source citations. The fact that it runs entirely within our Azure environment was non-negotiable for us, and Digivance delivered exactly that."
JC
James Calloway
Managing Partner, Meridian Law Partners LLP

Build Your AI Product with Digivance

Ready to turn your AI idea into a production-grade product? Let's talk.

Back to All Portfolio Case Studies