Why does your RAG ignore or contradict retrieved context?

Tests separation of retrieval failures from generation grounding in RAG. Strong answers trace symptoms to root causes like bad chunks, prompt ordering, or parametric knowledge override, then outline systematic debugging. Do not just say hallucination.
What's really being asked
This question probes your understanding of the full RAG stack beyond the LLM itself. Interviewers want to see if you can decompose a vague symptom, ignoring or contradicting context, into specific component failures across retrieval, context assembly, prompting, and model inference. They are looking for systematic debugging instincts rather than guesses.
The full answer
First, retrieval quality issues such as low relevance scores or embedding drift where the top-k documents are only 60 to 80 percent relevant instead of 95 percent, causing the model to distrust the context. Second, context assembly failures including chunk ordering that buries the most relevant passage at the end, token limit truncation that cuts off critical evidence, or poor delimiter formatting that makes documents blend together. Third, prompt design problems where instructions to use only the provided context are weak, ambiguous, or overridden by system prompts emphasizing helpfulness. Fourth, model-level grounding failures where parametric knowledge dominates retrieved evidence, especially in older models or when temperature is set too high. Fifth, a systematic debugging workflow: establish a baseline query with known correct retrieval, inspect retrieval scores and document content, swap in a golden context to isolate generation behavior, test prompt variations, and validate the full trace end to end.
The mistakes people make
Blaming hallucination without inspecting retrieval traces is the biggest red flag. Another weak pattern is suggesting retraining the embedding model or switching vector databases as a first step without evidence that retrieval is actually broken. Candidates who only talk about prompt engineering while ignoring chunking strategy or reranking pipelines also signal shallow RAG experience. Finally, proposing aggregate metrics like overall accuracy instead of per-trace inspection shows a lack of production debugging rigor.
What usually comes next
How would you measure retrieval relevance independently from generation quality? What changes if the contradiction only happens on edge cases or long documents? How do you prevent prompt injection from retrieved documents? Would you use a reranker, and where in the pipeline? How do you set up observability so the next failure is caught in hours instead of days?
A concrete example
Suppose a legal RAG system answers that the statute of limitations is two years when the retrieved document clearly states three years. The debug trace shows the correct document was retrieved at rank four with a score of 0.71 while three irrelevant FAQ chunks scored 0.74 and were placed first, causing the model to fixate on the wrong information. The fix is to add a cross-encoder reranker boosting the statute document to rank one, increase the prompt emphasis on the highest-ranked excerpt, and add a citation requirement so contradictions are explicit.
Interview question
A RAG system contradicts retrieved evidence. Debugging reveals the correct document was retrieved but ranked below irrelevant chunks. What is the most targeted immediate fix?
- a.Label the issue as model hallucination and add a system prompt instructing the model to trust retrieved documents
- b.Lower the generation temperature to zero to force adherence to the provided context
- c.Add a cross-encoder reranker to boost the relevant document and increase prompt emphasis on the top-ranked excerptCorrect
- d.Swap the vector database for a more advanced alternative to improve semantic search
Why? this is the answer
The correct fix targets the diagnosed ranking failure by reordering chunks and reinforcing prompt priority, which directly resolves the contradiction. Blaming hallucination ignores the explicit retrieval trace evidence, which is the biggest debugging red flag, and merely adding a trust-context instruction does not fix the ranking inversion.
Just read this? Test yourself on what you have been reading.
Read the original → dev.to
- #rag
- #llm
- #debugging
- #retrieval
- #generative-ai
You just looked this up. Could you explain it out loud?
That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Open roles that interview on rag — each one lists the topics its interview covers.
See open roles