Intelligence Artificielle (IA)
2025-03-01RAG Pipeline for Legal Contracts
CASE STUDY
The Challenge
Generic LLMs frequently hallucinate legal definitions or cross-reference inapplicable jurisdictions. The objective was building an enterprise pipeline that answers contract questions with exact paragraph and page citations.
Technical Architecture
- Semantic Chunking: Custom AST chunker for PDF contracts preserving section headers, definitions, and clause hierarchies.
- Hybrid Vector + BM25 Search: Reciprocal Rank Fusion (RRF) combining dense embeddings with sparse keyword search for clause numbering.
- Factuality Verifier: Secondary lightweight verification agent cross-checking generated claims against retrieved context before outputting to the user.