Build a cost efficient two-stage search pipeline for legal discovery documents.
Test retrieval-augmented generation cost savings using synthetic legal documents.
Benchmark token cost and latency tradeoffs between quick and precise search stages.
Learn how to combine binary quantized vectors with ColBERT rescoring in Qdrant.
| cappybara12/legal-rag | 0xallam/my-recipe | 0xhassaan/nn-from-scratch | |
|---|---|---|---|
| Stars | 0 | — | 0 |
| Language | Python | Python | Python |
| Last pushed | — | 2022-11-22 | — |
| Maintenance | — | Dormant | — |
| Setup difficulty | moderate | moderate | moderate |
| Complexity | 4/5 | 2/5 | 4/5 |
| Audience | developer | general | developer |
Figures from each repo's GitHub metadata at analysis time.
Requires running Qdrant locally via Docker before ingesting documents.
This project is a demonstration pipeline for making AI powered legal document search cheaper to run, specifically for legal discovery, the process of digging through large sets of documents for a case. It is built around a search database called Qdrant along with a tool called FastEmbed that turns text into number based representations a computer can compare quickly. The pipeline works in two steps. First, it does a fast rough search across all documents using a compressed, low precision version of those number representations, which lets it quickly narrow down a huge pile of documents to a smaller set of likely matches. Second, it takes that smaller set and rescans it with a slower but much more precise comparison method, so the final results are accurate even though the first pass was quick and approximate. The real cost saving trick is what happens after a match is found. Instead of sending an entire matching document to an AI language model for further analysis, which can be expensive when billed by the amount of text processed, the pipeline isolates just the specific sentence or sentences that actually caused the match and sends only that small piece of text onward. The project reports this cuts the amount of text sent to the AI model by about two thirds. The repository includes scripts to set up the search database, load documents into it, run searches, and measure how well the approach performs, comparing token counts and speed against simpler alternatives. It also includes a script that generates fake, made up legal documents and contract clauses so anyone can test the whole pipeline without needing real case files. Setting it up involves creating a Python virtual environment, installing the listed dependencies, and running the Qdrant database locally through Docker before generating sample data and trying the searches.
A demo pipeline that cuts the cost of AI-powered legal document search by combining a fast rough search with a precise recheck, then sending only the matching sentence to the AI model.
Mainly Python. The stack also includes Python, Qdrant, FastEmbed.
No license information is stated in the README.
Setup difficulty is rated moderate, with roughly 1h+ to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.