Why i started CariBlaw
My initial motivation for building CariBlaw, experimenting with LLMs and vector databases, and making Caribbean judgments more accessible.
CariBlaw / 2 MIN READ
A high-level overview of how i built CariBlaw using PostgreSQL, vector embeddings, full-text search, hybrid retrieval and an evaluation framework.
Trying to have one searchable source for all the judgments available in the Caribbean is a reasonable problem for one developer to solve in this modern age with the help of LLMs.
i believe the Caribbean, especially the English-speaking portion, has a data segmentation problem, and unified data available in one location could prove useful. Not only for law but also finance (stock data, central bank statistics), logistics, government spending (contract awards, procurement), tourism and other information along these lines that can be aggregated and made searchable.
i will give a high-level overview of how i went about creating this project.
The first requirement would be to obtain the data. With Caribbean judgments available online via PDFs, there is a starting point for obtaining the required data.
The second would be to ingest the data into a DB that allows for full-text or semantic search. In this case, i selected PostgreSQL.
The scale of this project allows PostgreSQL to handle both the vector database capabilities and full-text search, with the vector database capabilities being responsible for semantic search. The vectors required for my DB were created using OpenAI's APIs.
Once these steps were complete, the DB was queried for things i thought lawyers might find useful (i am not a lawyer, so an LLM was my aid), and the retrieval results were rated.
The results were rated using an evaluation framework that associated queries with relevant passages from judgments.
This led to an iterative process experimenting with full-text search (FTS), vector search (relying on semantic similarity rather than exact matches) and hybrid search (combining both using an algorithm called Reciprocal Rank Fusion).
The evaluation framework allowed me to vary parameters and measure improvements or deterioration in retrieval performance.
Not surprisingly, in the end, hybrid search performed the best.
My initial motivation for building CariBlaw, experimenting with LLMs and vector databases, and making Caribbean judgments more accessible.
Some thoughts on the accessibility of Caribbean judgments and the potential advantages of full-text and semantic search.