Prompt
How do I test whether retrieval or generation caused the error?
Latest observation
Nov 18, 2026
OpenAI APIWeb search: off
A good way to tell whether the mistake came from retrieval or from generation is to isolate each stage and compare against a known-good input.
1) Test retrieval by itself
Check whether the system retrieved the right source material.
- Run the retrieval step alone for the same query.
- Inspect the top-k passages/documents.
- Ask:
- Is the needed information present?
- Is it ranked highly enough?
- Is irrelevant or misleading content being retrieved instead?
If the retrieved context is wrong or missing the answer, the problem is retrieval.
2) Test generation with fixed, correct context
Feed the generator the correct reference text directly, bypassing retrieval.
- Take a passage that definitely contains the answer.
- Give only that passage to the model.
- See whether it answers correctly.
If the model still makes the same mistake with correct context, the problem is generation.
3) Cross-check with four cases
This makes diagnosis clearer:
| Retrieved context | Generated answer | Likely issue |
|---|---|---|
| Wrong / incomplete | Wrong | Retrieval |
| Wrong / incomplete | Correct | Generator compensating, retrieval still weak |
| Correct | Wrong | Generation |
| Correct | Correct | Both okay |
4) Look for specific failure modes
- Retrieval errors
- Wrong document
- Missing key chunk
- Chunking split the answer apart
- Query wording mismatch
- Generation errors
- Hallucination
- Misreading the context
- Ignoring retrieved evidence
- Bad reasoning or instruction following
5) Use an ablation test
A simple practical approach:
- Ablation A: retrieval + generation as normal
- Ablation B: replace retrieval with gold context
- Ablation C: use retrieval results but ask the model to quote only supported facts
Compare outputs across these runs.
6) Measure separately if possible
If you have logs or annotations, evaluate independently:
- Retrieval metrics: recall@k, precision@k, MRR, whether gold passage appears in top-k
- Generation metrics: factual accuracy given gold context, citation correctness, faithfulness
Quick rule of thumb
- If the model fails even when given the right evidence, it’s probably generation.
- If the model succeeds with gold evidence but fails in the full pipeline, it’s probably retrieval.
If you want, I can also give you a step-by-step debugging checklist or a small experiment design for a RAG system.