The answer is wrong, so the team edits the prompt. Still wrong, so they try a bigger model. Still wrong, and two weeks are gone.

The relevant document was never retrieved, and nothing downstream could have rescued that. Generation cannot ground itself in text it never received, and no amount of prompt work makes a missing chunk appear.

Retrieval needs its own test set and its own number. Fifty to two hundred real questions, each labelled with the document IDs that should come back, scored on recall at k before a language model is involved at all. That one metric tells you whether a bad answer is a retrieval failure or a generation failure, and without it the guess defaults to the prompt.

Vector search loses exactly the queries enterprises type

Semantic similarity is excellent at paraphrase and poor at identity.

"Error code PS-4471", "the Q3 amendment to MSA-2019-114", part numbers, ticket IDs, surnames: these are tokens that mean one specific thing, and embedding them into a dense vector smears them across a neighbourhood of things that merely look similar. BM25 finds them instantly. Enterprise corpora are full of them.

So run both and fuse the results, usually with reciprocal rank fusion, which needs no score calibration between the two systems. The price is two indexes to keep in step, deletes and permission filters included.

Then rewrite the query before it reaches either index. Expand acronyms, resolve pronouns against conversation history, and for ambiguous questions issue two or three variants and union what comes back. A good share of "the model does not understand our domain" complaints are really a query that arrived at the retriever stripped of context the user assumed was obvious. Rewriting adds a model call to the request path and can change the question (an acronym expanded wrongly).

Embeddings and indexes are versioned dependencies

An embedding model is a dependency that silently rewrites your entire index when it changes.

Version it explicitly, store the model ID on every chunk, and treat migration as a planned operation: build the new index alongside the old one, run the retrieval test set against both, compare recall, then cut over. Re-embedding in place gives you a corpus where half the vectors live in one space and half in another, and similarity scores across that boundary are noise. The new index must also take every update and delete from the start of its backfill, or it cuts over stale.

Index parameters deserve the same discipline. HNSW ef_search and M, or IVF nlist and nprobe, are latency against recall trade-offs. Do not just inherit the defaults from a tutorial. Changing them changes quality with no error message anywhere. Rebuilds should be rehearsed before they are urgent, because the first time you need one will be mid-incident.

Make retrieval legible while you are at it. A trace should show the rewritten query, the candidates each retriever produced, their raw scores, the fused ranking, and what the permission filters removed. Without that trace, debugging retrieval means reconstructing each of those steps by hand.

Before the next prompt change

Run the test set and sort the failures. Where the labelled document missed the top k, the fix is in retrieval; where it came back and the answer still went wrong, the prompt and the model are fair game.

Terms in this piece

About this explainer

Format
Explainer
Level
Practitioner
Read
2 min read
Published
Aug 12, 2026

Short mental models: one idea, why it matters, what to do about it.

Checklist · · 12 checks

RAG production-readiness checklist

Twelve checks to pass before a retrieval system answers a real user. Tick them locally; progress stays in your browser.