NLP · RAG · Legal tech · 2026
Searchable case law with local LLMs
Hundreds of thousands of passages from Mexican federal court rulings, made searchable with hybrid retrieval and answered with literal citations by a model that runs locally.

364,521indexed passages from ten district courts
1,161rulings summarised into structured argument cards
99%agreement of our ruling segmentation with the official outcome field
100% localno document leaves the machine
The problem
Federal district courts in Mexico City publish their rulings, but as thousands of long documents with no structure. A lawyer preparing a case wants to know how these courts have decided arguments like theirs, with the exact paragraph to cite.
How it works
- Rulingspublic court documents
- Textextraction + section segmentation
- IndexBM25 + bge-m3 embeddings
- Cardslocal LLM fills a structured schema
- Answerretrieval + literal citations
Design choices
- Structure first. Text extraction keeps footnotes apart by font size; each ruling is segmented into its legal sections (background, admissibility, merits, outcome).
- Hybrid retrieval. Keyword search (BM25) and dense embeddings, compared side by side on a hand-labelled question set before choosing.
- Argument cards. A local LLM fills a fixed schema per ruling (claims, arguments, outcome), checked against hand-written gold cards.
- Answers cite, never paraphrase. Every answer points to the literal passage and ruling it comes from.
- Consistency checks for free. Comparing each ruling's reasoning with its operative part flagged 2 of 656 rulings whose reasoning concludes one way and whose decision goes the other.
About the data. The corpus and the collection process are not published. Screens shown are anonymised. The dataset can be shared on request for research purposes.