Cirevey Resources
← All case studies

AI-Powered Legal Research: Retrieval-Augmented Generation Meets Fuzzy Logic

Applied research project — federal case-law analysis

PythonOllamaChromaDBscikit-fuzzyRAG

The Problem

Legal research tools return documents, not judgment. The challenge: build a system that not only retrieves the right cases from a specialized corpus but scores how strongly each case supports a legal position — reasoning under the kind of uncertainty keyword search can't express.

The Solution

We engineered a retrieval-augmented generation (RAG) pipeline using locally hosted language models (Ollama) with a ChromaDB vector store over section-aware document chunks, then layered a Mamdani fuzzy-inference engine (scikit-fuzzy) on top. A shared eight-variable vocabulary translates retrieved passages into fuzzy scores across four distinct legal issue types, producing ranked, explainable relevance judgments instead of a raw similarity list.

The Results

The system passes 7/7 retrieval accuracy tests on its case corpus and demonstrates the kind of AI integration we bring to client work: local-first (no data leaves your infrastructure), explainable scoring rather than black-box answers, and rigorous test-driven calibration.