AI / LlamaIndex Interview Questions
How do you troubleshoot poor retrieval relevance in a LlamaIndex application?
When a RAG application returns answers that miss the point or cite the wrong context, the fix usually starts by actually inspecting the source_nodes on the response object, rather than guessing, since that tells you whether the problem is retrieval or synthesis.
- Check what was actually retrieved. If the correct Node never shows up in
source_nodes, the problem is retrieval, not the LLM. - Re-examine chunk size. Overly large chunks dilute embeddings; overly small ones lose context. Try adjusting
chunk_size/chunk_overlapand re-testing. - Check for vocabulary mismatch. If queries and documents use very different phrasing, a query transform like HyDE can help.
- Verify metadata filters aren't over-restrictive, silently excluding the correct Node.
- Adjust similarity_top_k up if relevant Nodes are close but just outside the current cutoff, or add a reranker if the right Node is in a larger candidate set but ranked too low.
- Confirm ingestion actually completed correctly, since a silently failed or truncated load will produce an index missing content entirely, which no amount of query tuning will fix.
- Reconsider the index type. A question needing information from across an entire document may be poorly served by a VectorStoreIndex's top-k retrieval and better handled with a SummaryIndex or tree_summarize.
More Related questions...