ld.← ALL FIELD NOTESTHE RELATED CASE STUDY ↗
FIELD NOTES / 01PRODUCTION AI   ·   RETRIEVAL & RAG

Production RAG is a retrieval problem.

The hardest part of a production RAG system is often getting the right information in front of the model in the first place.

Beyond the demo

A simple RAG demo can retrieve a few documents, send them to an LLM, and produce a convincing answer. In production, that answer is only as useful as the context behind it. Missing the right information early in the pipeline can affect everything that follows.

Working on a multi-stage retrieval pipeline gave me a closer look at the choices behind that first step: embeddings, vector search configuration, hybrid retrieval, fusion, and reranking.

A pipeline, not a prompt

We combined dense and sparse retrieval to find candidates using both meaning and exact terms. Reciprocal Rank Fusion brought their rankings together, and a cross-encoder reranked the candidates before the selected context reached the LLM.

Each stage has parameters and trade-offs. A more complex configuration is not automatically a better one; it needs to earn its place through measurement.

THE RETRIEVAL PIPELINE
QueryDense + sparseRRFRerankLLM

Measure what changes

Building the pipeline was only half the work. We evaluated different approaches against BEIR datasets using retrieval metrics, so we could compare configurations instead of relying on a few convincing examples.

The lesson I keep coming back to: AI systems need evaluation, not just implementation. The biggest improvement does not always come from changing the LLM; sometimes it comes from asking better questions about the system around it.

Continue the conversation

THE NOTEBOOKExplore all field notes.

More ideas from the work.