A support assistant answers a billing question by quoting the refund policy. The quote is accurate, the answer is fluent and correctly cited. It is also wrong, because an exception to that policy sits in the next paragraph of the same document and the assistant did not mention it.
The team fixes the prompt, then adds a reranker, then tries a better model. None of it works, because the exception never reached the model. It was cut into a different chunk during ingestion eight months ago by a script nobody has opened since.
That pattern runs through the whole of retrieval. Retrieval is the only stage of a RAG system that can add information. Reranking reorders, prompting frames, the model reasons. All three operate on a candidate set that retrieval already decided, and none of them can put back something that was never returned.
So retrieval sets the ceiling on everything downstream, and that ceiling is fixed long before any user types a question.
The document gets cut before anyone asks anything
Chunking is the least interesting topic in RAG and one of the biggest levers on answer quality. It happens once, early, usually as a default copied from a tutorial, and it silently caps everything built afterwards.
A bad boundary separates a claim from the thing that qualifies it. A rule loses its exception, a figure loses its unit or its date, and a table loses the header row that explains the columns, leaving a grid of numbers about nothing. What comes back is individually plausible and collectively misleading, and nothing flags it, because an incomplete chunk does not know it is incomplete.
Hold chunks to a simple bar. Each one should make sense to a person reading it with no surrounding document. If a human cannot follow it in isolation, the model has no advantage over that human.
Treating chunking as a setting skips the fact that changing your chunking strategy changes what is findable across the entire corpus. Answers that worked break, answers that were broken start working. That blast radius is release-sized, and it deserves a fixed evaluation set run before and after, with someone actually reading the diff.
Semantic search gets you to the neighbourhood, not the house
Embeddings turn text into coordinates, positioned so distance approximates similarity of meaning. That is what lets a user ask about "money back" and reach a document that only ever says "refund".
The production problem is a quiet substitution. Embeddings measure similarity, but a pipeline that ranks on the similarity score alone treats it as relevance. The two agree often enough to be convincing and diverge often enough to hurt. "What is our refund policy" and "customers furious about refunds" sit close together in embedding space. One is a policy lookup, one is a complaints analysis, and the score will not tell you which you got.
The sharpest version is negation. In many embedding models, "eligible" and "not eligible" embed remarkably close together, because a negating word barely moves the coordinates. Any domain where a "not" flips the outcome, which is to say eligibility, compliance, safety and permissions, needs a signal that is not purely semantic.
Two traps follow. General-purpose embedding models are trained on general-purpose text, so your internal product names and acronyms may be positioned arbitrarily. And a similarity score of 0.87 looks like a probability of correctness, but it only measures the angle between two vectors in a space you did not design, and a threshold that looked sensible on sample data can mean nothing on real queries.
The index stops matching what your organisation knows
A vector store gets marketed as memory for your AI, and memory sounds like something that maintains itself, which a database very much does not.
The failure here is slow decay. When a document is retracted, corrected or superseded, do its vectors actually leave the index? In a surprising number of systems, no. The old vectors stay perfectly retrievable, still answering questions with content the company formally withdrew. Under a deletion request, that stops being an engineering problem and becomes a legal one.
The quieter versions matter too. Metadata filters interact badly with approximate nearest-neighbour indexes such as HNSW, so a query scoped to one department can return worse results than the unfiltered version, because the filter shrinks the candidate pool the index was tuned for. Without scheduled re-indexing, content drifts from reality and nothing alerts you, because stale vectors return results just as confidently as fresh ones.
The unfashionable observation is that at small scale you may not need a dedicated vector database. Postgres with pgvector covers a wide middle ground in a system your team already backs up. The dedicated store earns its place when scale, latency or filtering genuinely demand it.
Picking one search method is picking which users to fail
Search for an error code semantically and you may get a thoughtful paragraph about error handling in general. Search for "why do customers stop paying" by keyword and you get nothing, because no document contains that sentence.
Keyword matching with BM25 is fast, precise, explainable, and completely indifferent to the fact that "cancel" and "terminate" mean the same thing to your users. Semantic search handles paraphrase beautifully and is unreliable on exactly the strings where one character changes everything: part numbers, invoice references, policy names.
You can settle this empirically in about an hour. Pull a day of real production queries and sort them into the ones that hinge on an exact string and the ones that describe an intent. Almost every real query stream has serious volume in both piles, and the ratio is rarely what the team assumed in the design meeting.
Then notice why this persists. When keyword-only search misses a paraphrase, the user sees no results and rephrases or leaves. When semantic-only search mangles an invoice number, the user sees a plausible wrong document and may never realise. Neither looks like an architecture problem, since each looks like one unlucky answer, and the gap only shows up when you review queries in aggregate.
Running both is easy, merging both is the actual work
Hybrid search declines the choice. It runs both retrievers, combines the results, and covers each blind spot with the other's strength. It is the boring answer and usually the right one.
What "combine" hides is a real decision. Keyword scores and vector similarities live on completely different scales, so something has to reconcile them, typically Reciprocal Rank Fusion, which uses positions instead of raw scores and so discards how confident each retriever was. That fusion step now decides what the model sees, and its defaults were tuned on someone else's corpus. It is a first-class part of retrieval quality and needs testing like one.
Three things worth settling before shipping. Decide deliberately what happens when the same chunk arrives from both paths, since two independent signals agreeing is real evidence. Budget latency across two searches plus fusion plus a likely reranker, and measure p95 rather than average. And log which path won, because a merged result with no per-path attribution is undebuggable.
Then make it earn its complexity on your data. Sometimes the gain is dramatic, and sometimes your corpus is almost entirely natural language and semantic-only is fine. Decide it by measuring on your own queries.
Relevance and sensitivity rise together
The last one turns a quality problem into an incident.
Your system finds the perfect document for the question. It is the executive compensation file, and the person asking is an intern. Retrieval was accurate, ranking was sensible, the answer was well grounded, and you have a serious problem.
Semantic search has the uncomfortable property that sensitive documents surface exactly when they are most relevant to whoever is asking. The moment someone asks about salaries is the moment the compensation file ranks first. Relevance and sensitivity correlate, so this happens routinely rather than at the edges, with the system working as designed for the wrong audience.
There are two places the rule can live and they are not equivalent. In the prompt, "do not reveal salary information" is a request to a probabilistic system that has already read the salary information. In the query, the retrieval call is pre-filtered by the requesting user's identity, groups and clearance, and the file never enters the candidate set. Only the second is a control, and an instruction to the model is not a security measure.
Two rules follow. Mirror your existing permissions rather than rebuilding them, because a parallel copy of your access model will drift from the real one and drift silently. And fail closed, because degrading to unfiltered retrieval when the permission service times out is an availability decision that quietly becomes a disclosure decision. The price is that the permission service now sits in your critical path.
Six failures, none of which throws an error
The six posts make one argument. Retrieval decides what your system is capable of knowing, and every decision that sets it is made early, is expensive to reverse, and fails silently.
A bad chunk boundary, an overtrusted similarity score, a stale index, a missing search signal, an untested fusion step and an unscoped query all fail without an exception or an alert. Each produces a confident answer built on the wrong evidence, which at a glance is indistinguishable from a confident answer built on the right evidence.
Three of them behave like schema migrations rather than configuration. Change your chunking, change your embedding model, or let your index drift, and you have altered what is findable across the whole corpus. Teams that treat these as parameters hear about the regression from a user.
Retrieval quality has more than one dimension. Evidence can be relevant and incomplete, relevant and stale, relevant and unauthorised. Measure retrieval separately from generation. Keep a fixed set of questions with known answer passages, track recall@k on it, and rerun it on every chunking change, embedding upgrade and re-index. On the same schedule, ask your most sensitive questions as your least-privileged user, because recall@k cannot show you a disclosure.
The six posts in full
Each of these is a short standalone post in the journal, with the specifics, the failure modes and what to actually do:
- Chunk boundaries decide what your RAG system can know
- Similar is not the same as correct: the limits of embeddings
- A vector store is infrastructure, not magic memory
- Production retrieval needs exact words and meaning
- Hybrid search is the practical default
- Relevant data can still be data the user may not see
They are the third chapter, Retrieval Foundations, of 60 Days of Production AI Systems, a series on building AI that survives real users. If you would rather start from the beginning, the series page lays out all sixty in ten chapters.
About this deep dive
- Format
- Deep dive
- Level
- Practitioner
- Read
- 7 min read
- Published
- Aug 15, 2026
- Disciplines
Long-form engineering, further than a blog post goes.
More on these topics
Decision note · · 2 min read
We chose Azure AI Search for retrieval because ingestion and filtering stay simple
Why our retrieval runs on Azure AI Search: our Databricks ingestion pipelines feed it directly, filtering is simple, and several semantic configurations share one index.
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.
Failure story · · 1 min read
The retrieval cache that served stale policies
A well-meaning cache in front of retrieval kept answering from last quarter's HR policy for eleven days.
Discussion