Concept guide · Embeddings and vector search
A relevant document exists but is not retrieved. How do you debug it?
A slower explanation for when the short interview answer is not enough. Start with the intuition, then connect it to the technical idea and the way an interviewer expects you to reason about it.
ML area
Generative AI → Retrieval debugging
Interview format
Advanced · Debugging
Question
GENAI-046
Start with the idea
In simple terms
If the correct document exists but is not returned, debug the retrieval path before changing the prompt. Check ingestion, chunks, metadata, embeddings, filters, candidate depth, and ranking one layer at a time.
Make it concrete
A policy answer may fail because the PDF parser dropped the heading, the chunk split the exception from its rule, the tenant filter excluded it, or the query used an exact code that dense search missed.
Build the answer
What to inspect first
- 1Verify that the source was parsed, chunked, embedded, indexed, and not filtered out.
- 2Compare retrieval modes and inspect candidate rankings, not just the final answer.
- 3Trace the evidence into the prompt before changing the model or wording.
Go one level deeper
The technical explanation
Start with a known document and test exact-term, paraphrase, and metadata-filtered queries separately. Inspect the stored text and metadata, compare dense and sparse candidates, measure recall against an exact or labelled baseline, and log the query, rewritten query, candidate IDs, scores, filters, and reranker order. Only after retrieval is correct should you debug context assembly or generation.
Say this in the interview
Check parsing and metadata first, then chunk boundaries, embedding model and metric, query rewriting, filters, index freshness, candidate count, and reranking. Search the exact phrase and the semantic query separately. Store retrieval traces so you can identify whether the miss happened before or after ranking.
Keep preparing