Module 3 · Lesson 7 of 7

Why a RAG answer is wrong

What goes wrong
Customer, asks a questionCustomerasks a questionSupport assistant, searches, then asks, NOWSupport assistantsearches, then asksquestion inNOWDocument index, chunks and vectorsDocument indexchunks and vectorsModel, writes the answerModelwrites the answer
  • Customer — asks a question — healthy
  • Support assistant — searches, then asks — healthy — NOW — question in
  • Document index — chunks and vectors — healthy
  • Model — writes the answer — healthy
  • Question or prompt
  • Search
  • Chunks or answer
Step 1 of 7

Step 1 of 7 · Support assistant

Done: A customer asks about the Team plan

What happens
"How much storage does the Team plan include?"
Why
The answer is a fact that changes with each price update, so the assistant looks it up in your documents.
What changes
The assistant searches the index first.
Next
The index finds the 2 closest chunks

Event log

6 more to go. Press a line to go back to that step.

Current pricing chunk
not searched yet
The answer says
nothing yet
Which part failed
not checked yet

The index, closest chunk first

Not searched yet.

Step 1 of 7: Support assistant. A customer asks about the Team plan. "How much storage does the Team plan include?"

What this simplifies. The four chunks and their scores are stated examples, not real embeddings, and the model's answer is fixed for each case. A real index holds thousands of chunks, and a real check reads every claim in a long answer. The method is the same: look at what the search found before you blame the model.

When a answer is wrong, one of two parts failed: the search or the answer. The fixes are different, so find the failing part first. Look at the sent with the . Is the fact the answer needed in one of them?

If it is not, the search failed. The right page may be missing from the , ranked too low, or beaten by an old copy that was never deleted.

If it is, the answer failed. The model dropped a detail, mixed up two chunks, or added a fact of its own. Asking it to quote its source, and checking each claim against the chunks, catches much of this.

A missing fact also tests the prompt. Tell the model to reply that it does not know when no chunk answers the question. Otherwise it may fill the gap with a number from somewhere else.

Example. In the picture, one question goes wrong three ways. Old copies outrank the current page, so the answer says 1 TB. The new page is not indexed, so the model borrows 200 GB from another plan. The current chunk ranks first, but the answer drops "per user".

In system design: Log the chunk ids sent with every answer, so a bad answer can be traced to the search or the model. Test each part on its own.

Check yourself

A RAG assistant says a plan costs $20 a month, but the pricing page says $25. The logs show the $25 chunk was sent in the prompt. Which part failed?