How a RAG Agent Learns to Say "I Don't Know"
A RAG agent abstains reliably when the decision is made before generation, by a calibrated relevance floor on reranker scores, not by asking the model to notice that its context is irrelevant. If no retrieved passage clears the floor, the agent gets an explicit "nothing found" signal and answers that the information is not in its knowledge. The floor is a trade: set it low and unanswerable questions get junk; set it high and real answers get dropped. You pick the point on that curve with a sweep, and you re-sweep whenever the reranker changes.
I'm Mahmoud Zalt, an AI architect who has spent the last years taking agent systems from demo to production, mostly through Sista AI.
This piece is the abstention half of the retrieval pipeline we built for Sistava, where AI agents answer questions from customers' own documents. The numbers come from our own threshold sweep, published in full in our research report on document answer accuracy. We built the system and wrote the test corpora, so read them as a builder's measurement, with the limits section taken seriously.
Why "Say You Don't Know" in the Prompt Is Not Enough
Every RAG system prompt I have ever reviewed contains some version of "if the answer is not in the context, say you don't know". It helps. It is not a mechanism.
Here is what the model actually sees when your corpus has no answer: eight passages that are the closest text in your index to the question. Not random text. Closest. They share vocabulary, entities and topic with the question, because that is what the retriever optimises for. Asking a generator to read eight topically adjacent passages and conclude "none of these answer it" is asking it to do the hardest kind of judgement, under an instruction-following prior that rewards producing an answer.
We measured what our pipeline did with a permissive floor. At 0.2, our starting value, all 22 questions in our test set that had no answer got passages back. Not one came back empty. The abstain rate at the retrieval layer was 0%. Every one of those questions relied entirely on the model's restraint.
Moving the decision upstream changes the problem. The reranker already read each passage next to the question and scored it. If the best score is low, you know before generation that there is nothing worth answering from, and you can tell the model so in plain words instead of hoping it infers it.
The Mechanism: Rerank, Floor, Explicit Empty Signal
The relevant part of the pipeline, after hybrid dense plus BM25 search and reciprocal rank fusion have produced about 50 candidates:
- Rerank. A reranker (Voyage rerank-2.5-lite in production) reads the question with each candidate and returns a relevance score from 0 to 1.
- Floor. Every candidate under the floor is dropped. Ours is 0.6.
- Empty signal. If nothing survives, the knowledge block handed to the agent says so explicitly, and the agent answers that the information is not in its knowledge. It can still run another search itself if the question looks like it needs a different query.
- Otherwise, the top eight survivors are expanded to their parent sections and passed with numbered citations.
Two properties make this robust. The empty case is a first-class state with its own wording, not an empty list the model has to interpret. And it composes with access control for free: permissions are applied as a filter inside the search, before ranking, so a question about a document the caller may not see looks identical to a question with no answer. Our test set includes three such questions (payroll, salary bands and a private strategy memo, asked by a colleague without access), and they count as abstention cases.
I walked through the retrieval stages before the floor in accurate RAG answers with hybrid search and reranking. This article is only about the floor.
Why No Floor Is Perfect: Score Distributions Overlap
If relevant passages always scored high and junk always scored low, you would pick any value in the gap and be done. They do not. In one of our runs, an answerable question's correct passage scored 0.29, while the best junk passage for a question with no answer scored 0.33. A floor of 0.3 would have dropped the real answer and kept the junk.
That overlap is the whole problem in one example. Reranker scores are relevance estimates, not calibrated probabilities, and the tails of the "relevant" and "irrelevant" distributions cross. Every floor value is therefore a choice of which errors you prefer: false abstentions on real questions, or false answers on unanswerable ones. The only honest way to choose is to measure both sides at several values.
The Sweep: Six Floors, Both Sides of the Trade
We ran the same 236 questions at six floors, 0.2 to 0.7 in steps of 0.1, with the production embedding and reranking models. Two business corpora we wrote for the purpose: a fictional hardware company (32 documents, 106 hand-written questions, 15 without an answer) and a fictional marketing agency (96 documents, 130 questions, 4 without an answer plus the 3 restricted-file questions). For each floor we tracked three things: recall (right document in the top five), abstain rate (share of no-answer questions that came back with zero passages) and context size (average tokens of passages handed to the agent).
| Floor | Right document in top five | Empty on no-answer questions | Context tokens per question |
|---|---|---|---|
| 0.2 | 98.9 to 100% | 0% | 884 |
| 0.3 | 98.9 to 100% | 0 to 14% | 863 |
| 0.4 | 98.9 to 100% | 20 to 43% | 680 |
| 0.5 | 95.6 to 100% | 47 to 71% | 424 |
| 0.6 (production) | 91.2 to 100% | 87 to 100% | 190 |
| 0.7 | 75.8 to 96.7% | 100% | 111 |
Each range spans the two corpora. Full method and figures are in the report.
Reading it top to bottom:
- 0.2 to 0.4 costs nothing on the answerable side and starts clearing junk. If you run a permissive floor today, raising it to here is close to free.
- 0.5 is where real answers start dropping on the hardware set.
- 0.6 is silent on 20 of 22 no-answer questions (13 of 15 and 7 of 7). The agency set still finds the right document every time. The hardware set pays: 8 of its 91 answerable questions lose their right document from the top five.
- 0.7 abstains perfectly and drops the hardware set to 75.8% recall. Too much.
We chose 0.6. The reasoning is a product judgement, not a statistical one: for a business, a confident wrong answer about a contract or a refund costs more than "I could not find that in your documents, can you point me to it?" The second costs a minute and usually ends with the missing document being added.
The Side Effect Nobody Mentions: Smaller Context
Look at the last column again. At 0.6 the average context handed to the agent falls from 884 tokens to 190. On answerable questions the floor strips low-relevance padding that was never helping; on unanswerable ones it strips everything.
That has two effects. Each answer is cheaper to process, on every single turn that touches knowledge. And the model has less irrelevant text pulling the answer off course. A higher floor is one of the rare changes that improves safety, cost and focus at the same time, and only costs recall at the margin.
Rules for Running a Floor in Production
- The floor belongs to one reranker. Scores from a different reranker sit on a different distribution, so 0.6 is meaningless after a model swap. We re-run the sweep before the reranker ever changes and pin the value in a test so nobody edits it in passing.
- Your golden set must contain questions with no answer. Without them, a permissive floor looks perfect: at 0.2 our recall was 98.9 to 100%. The damage only shows on the questions that should come back empty. Include questions about restricted documents too.
- Measure abstention at the retrieval layer, separately from the model. "Zero passages returned" is countable by code, free and deterministic. Whether the model then behaves is a second, judged measurement.
- Make the empty case explicit to the model. An instruction plus a clear "nothing found" block beats an empty context the model has to interpret.
- Keep a second line after delivery. We sample one in ten real answers that used knowledge and have an independent AI judge check whether they stayed within their sources. The layered approach is described in our report on how we evaluate AI employees.
A note on synthetic test data, since you will need a lot of no-answer and answerable questions: our synthesizer produced 175 candidate questions from documents and our source check kept only 33, dropping 142 whose answer was not actually supported by the source. A cheap generator invents. The source check is what makes synthetic eval data usable.
Where This Falls Short
- Two of 22 still get passages at 0.6, both on the hardware set. For those, the model's own restraint is the last line.
- Real answers are lost. 8 of 91 answerable hardware questions lose their document from the top five. Some of those can end as an unnecessary "not in my knowledge".
- Small samples. The no-answer result rests on 22 questions. One more failure moves a percentage by several points.
- Public benchmarks are harder. On SQuAD 2.0's no-answer questions, free stand-in models (bge-small-en-v1.5 and a MiniLM cross-encoder) came back empty for 61.1% of 18. Those are not our production models, so this compares settings, not products, but it shows the floor does not transfer automatically.
- Our corpora, in English. Templated agency questions and hand-written hardware questions resemble real business files, but they are not yours.
Frequently Asked Questions
How do I stop a RAG system from hallucinating when the answer is not in the documents?
Decide before generation. Rerank candidates, drop everything below a calibrated relevance floor, and pass an explicit "nothing found" state when nothing survives. Prompt instructions alone leave the model judging eight topically similar passages, and with a low floor our pipeline returned passages for every unanswerable question.
What is a good reranker relevance threshold?
There is no universal value. It depends on the reranker's score distribution. Ours is 0.6 for Voyage rerank-2.5-lite, chosen by sweeping 0.2 to 0.7 on a test set that includes unanswerable questions. Sweep your own.
Does a higher threshold hurt recall?
At the margin. In our sweep, raising the floor up to 0.4 cost nothing on answerable questions; 0.6 kept one corpus at 100% and dropped the other from 98.9% to 91.2% in the top five.
How do I measure abstention?
Count the share of no-answer questions that return zero passages after the floor. It is deterministic, cheap and catches the failure that recall metrics hide.
Should permission-denied questions behave like no-answer questions?
Yes. Filter by permission inside the search, before ranking. The caller then cannot distinguish a restricted document from a missing one, which is exactly what you want.
Three Things to Take Away
One. Abstention is a retrieval decision. Make it with a floor on reranker scores and an explicit empty state, not with a sentence in the prompt.
Two. Pick the floor from a sweep that measures both sides: recall on answerable questions and empty results on unanswerable ones. If your test set has no unanswerable questions, you are measuring half the trade.
Three. A floor is calibrated to one reranker. Pin it in a test and re-sweep before any model change.
If you want help building a golden set with real no-answer cases, or calibrating the floor on your own corpus, that is the kind of work I do in an agent development engagement.








