Back to Work
production

Legal Archive RAG System

FLAR — Fondo Latinoamericano de Reservas2025

A production document intelligence platform over 30K+ sensitive legal and institutional documents, combining hybrid retrieval, cross-encoder reranking, automated ingestion, and enterprise authentication.

30K+
Documents Indexed
90%+
QA Accuracy
1M+
Legal Records

Context

FLAR, a regional reserve fund, needed to make its legal and institutional archive searchable and queryable without compromising document sensitivity or provenance.

Problem

30K+ sensitive documents needed hybrid retrieval — keyword and semantic — with high QA accuracy, automated ingestion from the institution’s existing SharePoint system, enterprise authentication, and a full audit trail, given the regulatory sensitivity of the content.

Architecture

Hybrid retrieval combines pgvector and Qdrant vector stores with BGE-M3 embeddings, followed by cross-encoder reranking for precision. Neo4j captures relational context between documents. vLLM handles generation, LangGraph orchestrates the pipeline, and FastAPI exposes the service. An automated SharePoint ingestion pipeline keeps the index current, and the platform runs on Azure behind enterprise authentication.

Technical decisions

  • Dual vector-store approach (pgvector + Qdrant): pgvector co-located with existing Postgres infrastructure for operational simplicity, Qdrant for specialized ANN performance at scale.
  • Cross-encoder reranking added after initial hybrid retrieval to lift QA accuracy beyond what first-pass retrieval alone could reach.
  • Neo4j introduced specifically to capture document relationships — cross-references, amendments — that pure vector similarity missed.

Evaluation

QA accuracy was validated through structured human review across a representative set of institutional queries.

Results

  • 30K+ documents indexed with 90%+ QA accuracy.
  • Retrieval spans 1M+ underlying legal records.
  • Automated SharePoint ingestion keeps the index current without manual re-uploads.
  • pgvector
  • Qdrant
  • BGE-M3
  • vLLM
  • Azure
  • Neo4j
  • LangGraph
  • Python
  • FastAPI