LLM-powered document ingestion system that classifies, extracts, and summarizes 500-page legal contracts in under 90 seconds.
A 200-person law firm spent an average of 12 hours per associate reviewing a single contract for key clauses, risks, and obligations. With 40+ contracts per week, the review backlog was costing the firm 480+ associate-hours weekly — a significant overhead they wanted cut by AI without sacrificing accuracy.
A RAG pipeline using GPT-4 Turbo with a custom chunking strategy optimized for legal document structure. Documents are ingested, semantically chunked, embedded into Pinecone, and retrieved per-question with citation tracking. A FastAPI service exposes the pipeline. A React frontend gives associates a chat-style interface with inline document references.
94% accuracy on a 200-document gold standard test set built by senior associates. Review time dropped from 12 hours to 90 minutes per contract. The firm reallocated 350 weekly associate-hours to billable work within the first month.
TECHNICAL DEPTH
Standard token-based chunking destroys legal document structure. We implemented a hierarchical chunker that respects clause boundaries, numbered sections, and cross-references. Chunks include metadata (clause type, section ID, page range) to power citation retrieval.
Every extraction is scored against a confidence threshold. Low-confidence outputs are flagged for human review rather than silently returned. Associates can flag incorrect extractions which feed back into a fine-tuning dataset.
All documents processed in an air-gapped deployment using Azure OpenAI (no data retention by OpenAI). Pinecone index is encrypted. No contract text leaves the client's Azure tenant. PII redaction runs before any external API call.