Rag And Retrieval hard
Your offline eval shows recall@5 of 92% on a labeled set, so the gold passage is in the context for nearly every question. Yet human graders mark 35% of answers wrong, and the wrong answers often ignore or contradict the gold passage. Where should the team invest next?
- A Generation: tighten the prompt and context assembly, e.g., answer only from context, reorder chunks, and abstain when unsupported.
- B Retrieval: switch to a higher-dimensional embedding model, since 92% recall still leaves room and better vectors will raise answer accuracy too.
- C Retrieval: raise k from 5 to 25, so the generator sees more corroborating passages and is less likely to contradict the single gold passage.
- D Chunking: shrink chunks so the gold passage is less diluted, since the model's failure to use it suggests the embedding of that chunk is weak.
Answer: A. Generation: tighten the prompt and context assembly, e.g., answer only from context, reorder chunks, and abstain when unsupported.
Evaluating retrieval and generation **separately** locates the fault. Good retrieval paired with bad answers is a prompting and context-assembly problem. Improving recall from 92% can fix at most the 8% of misses, not a 35% error rate. A higher k adds distractors the model is already failing to ignore. Retrieval work is the right investment when recall@k is the low number.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- You must index 100M chunks using a 3,072-dimension embedding in fp32, served from RAM via HNSW. The raw vectors alone take about 1.2 TB before graph overhead. You need to cut memory several-fold while losing at most a point or two of recall@10. Which approach fits?
- A multi-tenant SaaS app stores all tenants in one vector index with a tenant_id field. Queries fetch the top 20 chunks by similarity and then drop chunks from other tenants. Small tenants often get 0-2 results. Why does this happen, and what is the fix?
- Runbooks are split into fixed 300-token chunks with no overlap. When a procedure step starts near the end of one chunk and finishes in the next, answers come back incomplete. What is the lowest-cost fix?
- Your product requires every RAG answer to include clickable source citations that users can verify. How should those citations be produced?
- A runbook RAG system uses fixed 500-token chunks with no overlap. Users who ask for a multi-step recovery procedure get answers that stop at step 4 of 9, and retrieval logs show the top hit ends mid-procedure. What is the most targeted fix?
- Policy documents live in a CMS. A nightly job embeds and inserts new documents into the vector index. Users keep getting answers that cite policies which were deleted or replaced weeks ago. What is the root cause and fix?