AWS Builder Center

Your RAG Demo Passed. Can It Say “I Don’t Know”?

Try five small test cases on your Amazon Bedrock RAG app to see whether retrieval found the right evidence, the answer used it, and the app handled missing information.

A chatbot answers “How long do I have to return an item?” with the right policy and a citation. Then someone asks whether engraved items are refundable. The chatbot confidently says yes and cites the general return policy, which says nothing about engraving.
That second question is the one I’d put in a regression test.

Build a tiny test set before changing your prompts

Imagine a fictional store with three short documents:
  • Returns policy: Standard items can be returned within 30 days of delivery.
  • Shipping FAQ: Delivery fees are refundable only when the store ships the wrong item.
  • Warranty policy: Refurbished items have a 90-day warranty.
Here are five questions to try. Keep the document set fixed while you compare configurations.
Question
What a grounded answer should do
How long do I have to return a standard item?
Say 30 days from delivery and cite the returns policy.
My parcel arrived two weeks ago. Am I still in the standard return window?
Say yes, given the stated delivery date, and cite the same rule.
Can I get my delivery fee back if the store sent the wrong item?
Say yes and cite the shipping FAQ.
Does the 90-day refurbished warranty give me 90 days to return a standard item?
Explain the two periods and cite both policies.
Can I return an engraved item?
Say the supplied policies don’t specify an engraving rule.

Run the same question through retrieval and generation

If your app uses Amazon Bedrock Knowledge Bases, start with the  Retrieve operation  and record the returned passages and source identifiers. Then run the question through your app’s normal answer path and capture the answer and its citations. If you use a custom knowledge base with RetrieveAndGenerate, that API returns citations you can inspect. If you use a managed knowledge base, check the supported retrieval and answer paths in the  Bedrock API reference .
Score each answerable question twice. Did the retrieved passages include all the evidence needed to answer? Did the final answer use that evidence correctly and cite it? For an unanswerable question, record whether the answer acknowledged the missing information or invented a policy. A citation only earns credit if the cited passage supports the claim.

Change one thing and rerun

If the 30-day rule never reaches the model, inspect the retrieval results. Try changing how many results you retrieve, or check whether the source text was split in a way that hides the rule. If the rule reaches the model and the answer still says 90 days, inspect the context your app actually passes to the model and how the prompt asks it to use that context.
Add one case every time you find a new failure. For example, add an archived returns policy with a different window. Decide which version should win, then check whether your retrieval and answer both respect that choice. Run the same cases before and after a change so you can see what improved and what regressed.
Try it on your own demo: Write one question your documents answer and one deceptively similar question they don’t. What happened on the second question? Did your app acknowledge the gap, pull an irrelevant passage, or give a confident answer with a citation that didn’t support it?
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article