Building AI that lawyers could trust.
The biggest weakness of large language models isn't intelligence. It's confidence.
They can sound correct while being completely wrong — and that makes them dangerous for legal work.
How do you build an assistant that answers from trusted legal material instead of imagination? A model that has never seen a specific statute or case will still produce a fluent, confident-sounding answer about it. In most domains that's a minor annoyance. In legal research, it's the difference between a useful tool and a liability.
Accuracy in legal research isn't just about getting the right answer — it's about being able to show where the answer came from. A generic chat interface over an LLM can't do that. The system had to retrieve real source material before generating anything, and had to make that retrieval step visible, not just trustworthy in theory.
Building this required learning Retrieval-Augmented Generation, vector databases, embeddings and Python properly — not as concepts, but as a system to be assembled: how legal documents get ingested and chunked, how they're embedded and indexed, and how a query retrieves the right material before the model ever generates a response.
The pipeline is retrieval-first: documents are ingested and embedded into a vector database by a Python backend; a query is embedded the same way and matched against that index; the retrieved, grounded material is passed to the model alongside the question. The model's job shrinks from "know the answer" to "summarise this evidence accurately" — a much safer job for an LLM to have. Legal professionals interact with the system through a Next.js interface, kept deliberately simple so the retrieval work underneath is what carries the trust, not the chat window on top of it.
AI is still the part that reads and synthesises — but only after retrieval has already narrowed the field to real, sourced legal material. Generation is grounded by design, not by prompting alone.
The core decision was architectural, not prompt-level: retrieval had to happen before generation, every time, with no path for the model to answer purely from its own training. That constraint shaped everything downstream, from how documents are chunked to how confidently the system is allowed to answer when retrieval comes back thin.
Legal material is unforgiving of the small mistakes RAG systems are prone to — a poorly chunked document or a weak embedding match doesn't just produce a slightly-off answer, it can produce a confidently wrong one, in a domain with no tolerance for that. Grounding had to be treated as the whole point, not a safety net.
This project changed how I think about AI products generally.
The prompt isn't the product. The system is.
The next iteration is the same idea, taken further: retrieval quality is the ceiling on trust, so that's where the ongoing work is — better chunking, better source coverage, better answers about when the system doesn't know enough to answer at all.