Lesson 4 of 4 Troubleshooting GenAI Applications

Troubleshooting Retrieval Failures in RAG Systems

This lesson covers the diagnostics and remediations for common retrieval problems, following the data from documents to chunks to embeddings to search results, since poor RAG answers are often retrieval failures in disguise.

Learning outcomes

After completing this lesson, you will be able to:

  • Analyze what was retrieved for failing questions.
  • Diagnose embedding and vectorisation issues.
  • Fix chunking, drift and search performance problems.

Response relevance analysis

Start with failing questions and inspect what was retrieved (with Retrieve, or from logged chunk IDs). If the needed information is absent from the retrieved chunks, the problem is retrieval or the corpus. If it is present but unused or misused, the problem is the prompt, the model or too much noisy context. If the needed document does not exist or is outdated, the problem is content and synchronisation. This triage avoids changing the model when the index is at fault.

The following diagram shows the first triage step for a failing answer.

Triage for a failing RAG answer. Start by inspecting what was retrieved. If the needed information is absent, the problem is retrieval or the corpus; if it is present but unused, the prompt, the model or noisy context; if the document is missing or outdated, content and synchronisation.
Each branch leads to a different team and fix.
Put in order

Diagnosing a bad RAG answer

Exam skills 5.2.4

Put the steps of diagnosing a wrong RAG answer in order.

Log in to try this activity Interactive activities are free with an account.

Embedding and vectorisation issues

Embedding quality diagnostics check that queries and documents use the same embedding model and dimensions; a model change without re-embedding the corpus makes similarity scores meaningless. Other checks include whether near-duplicate texts score highly, whether domain terms and acronyms are represented (comparing similar and dissimilar pairs), and whether the language of queries matches the model's strengths. Vectorization issues include failed ingestion jobs, empty text from scanned PDFs or images (fixed with Bedrock Data Automation or a foundation model parser), truncated chunks above the embedding model's input limit, and documents with missing metadata that filters then exclude.

The following diagram compares the mixed index with the re-embedded one.

Why answer quality collapsed after an embedding model upgrade. New documents used the new model, but older documents were still embedded with the previous one, so query vectors from the new model were compared with vectors from a different space. Re-embedding the whole corpus into a new index, validating recall and cutting over fixes it.
Queries and documents must always use the same embedding model and dimensions.
Fix the problem

Retrieval after a change

Exam skills 5.2.4

Find the cause of each retrieval failure.

Log in to try this activity Interactive activities are free with an account.

Chunking, drift and search performance

Chunking and preprocessing remediation fixes chunks that split tables or procedures, lose headings, mix unrelated sections or include boilerplate such as navigation menus: change the chunking strategy (hierarchical, semantic, custom Lambda) in a new data source, strip boilerplate before ingestion, and prepend section titles. Drift monitoring watches for new query topics with low retrieval scores and new document types, signalling gaps in the corpus or a need for new connectors. Vector search performance optimisation addresses slow queries with filters, index parameter tuning, quantisation, shard and replica changes and smaller k. The following table summarises the diagnostics.

SymptomDiagnosticRemediation
Right document never retrievedInspect retrieved chunks; recall testsHybrid search, query rewriting, chunking changes
Scores meaningless after an updateCheck embedding model and dimensionsRe-embed the entire corpus with one model
Scanned documents never matchInspect chunk textAdvanced parsing (BDA or FM parser)
Answers miss table dataInspect chunk boundariesCustom or hierarchical chunking that keeps tables whole
Filtered queries return nothingCheck metadata on chunksFix metadata files and resync
New topics answered poorlyDrift monitoring of queries and scoresAdd documents or connectors
Slow retrievalVector store metrics and tracesFilters, index tuning, scaling, smaller k
Worked example

Quality collapse after an upgrade

After switching a custom RAG pipeline to a newer embedding model for new documents, answer quality drops sharply, especially for older content.

Older documents are still embedded with the previous model, so query embeddings from the new model are compared with vectors from a different space. The fix is to re-embed the whole corpus with the new model into a new index, validate recall on the test set, then switch queries to the new index in one cut-over.

Check yourself

Scanned documents produce empty chunks. What fixes this?

Show answer

Advanced parsing, such as Bedrock Data Automation or a foundation model parser, which extracts text from images.

Exam Tips

Remember for the exam

  • Triage: needed info absent (retrieval), present but misused (prompt or model), or missing (content).
  • Queries and documents must share one embedding model and dimension.
  • Empty chunks from scans: advanced parsing.
  • Split tables or procedures: change chunking in a new data source.