Skip to content
AgenticAIWiki
  1. Learn
  2. Part 4
  3. 21. Naive RAG
  4. 21.3

Lesson 21.3 · 3 of 5 · 4 min read · Reviewed 24 Nov 2026

Where naive RAG breaks

By the end, you can

  • Spot the ways naive RAG fails.
  • Match each failure to a fix.

Common failures

Failure Example Fix
Chunk split mid-idea Rule in one chunk, its exception in the next Better chunking, overlap (23.1)
Vocabulary mismatch Asks “PTO”, docs say “annual leave” Hybrid search, query rewriting (23.2, 23.4)
Chunk lacks context “It must be returned in 30 days” — what is “it”? Contextual retrieval (23.5)
Needs several documents “Compare plan A and plan B” Multi-query or agentic RAG (chapter 24)
Exact ids and codes Searching “ERR-4012” Keyword search alongside vectors
Stale index Policy changed last week Re-index on change
Too many weak chunks Twenty loosely related passages Reranking, fewer chunks (23.3)
Model ignores sources Answers from memory Stronger grounding prompt, citations (21.2)

Diagnose in two steps

  1. Retrieval: was the right chunkChunking: Splitting documents into smaller passages before embedding and indexing them. in the top results? Check with a test set (chapter 26).
  2. Generation: given the right chunk, did the model answer correctly and cite it?

Fixing the prompt when retrieval is the problem wastes time, and the other way round.

Key points

  • Naive RAG fails when retrieval misses: bad chunking, vocabulary mismatch, questions needing several documents, or stale indexes.
  • It also fails when retrieval succeeds but the model ignores or misreads the chunks.
  • Diagnose first: was the right chunk retrieved? Then fix retrieval or generation accordingly.
Hands-on labRuns in the Playground

Diagnose retrieval versus generation failures

Sort each failed RAG test case into a retrieval failure or a generation failure, so you fix the right half.

You will have: A diagnosis table over six test cases with counts per failure type.

Steps

  1. Read the test cases: the gold chunk id, the retrieved ids, and whether the answer was correct.
  2. If the gold chunk is not in the top retrieved ids, label it a retrieval failure.
  3. If it was retrieved but the answer is wrong, label it a generation failure.
  4. Count each label and print which half to work on first.

Done when

  • 2 cases are retrieval failures.
  • 1 case is a generation failure.
  • The script names retrieval as the first thing to fix.

Open in the Playground No API key needed.

Starter code (Python)
CASES = [
    {"q": "Return window for shoes?", "gold": "pol-4.2", "retrieved": ["pol-4.2", "pol-4.1"], "correct": True},
    {"q": "PTO carryover?", "gold": "hr-2.3", "retrieved": ["hr-1.1", "hr-5.0"], "correct": False},
    {"q": "Refund for ERR-4012 device?", "gold": "man-7.1", "retrieved": ["man-7.4", "man-7.2"], "correct": False},
    {"q": "Sale items returnable?", "gold": "pol-4.3", "retrieved": ["pol-4.3", "pol-4.2"], "correct": False},
    {"q": "Refund timing?", "gold": "pol-5.1", "retrieved": ["pol-5.1"], "correct": True},
    {"q": "Clothing return window?", "gold": "pol-4.1", "retrieved": ["pol-4.1", "pol-4.2"], "correct": True},
]

def diagnose(case):
    # TODO: return "ok", "retrieval" or "generation"
    return "ok"

counts = {"ok": 0, "retrieval": 0, "generation": 0}
for c in CASES:
    d = diagnose(c)
    counts[d] += 1
    print(f"{c['q']:30} {d}")
print(counts)
Show a solution
CASES = [
    {"q": "Return window for shoes?", "gold": "pol-4.2", "retrieved": ["pol-4.2", "pol-4.1"], "correct": True},
    {"q": "PTO carryover?", "gold": "hr-2.3", "retrieved": ["hr-1.1", "hr-5.0"], "correct": False},
    {"q": "Refund for ERR-4012 device?", "gold": "man-7.1", "retrieved": ["man-7.4", "man-7.2"], "correct": False},
    {"q": "Sale items returnable?", "gold": "pol-4.3", "retrieved": ["pol-4.3", "pol-4.2"], "correct": False},
    {"q": "Refund timing?", "gold": "pol-5.1", "retrieved": ["pol-5.1"], "correct": True},
    {"q": "Clothing return window?", "gold": "pol-4.1", "retrieved": ["pol-4.1", "pol-4.2"], "correct": True},
]

def diagnose(case):
    if case["gold"] not in case["retrieved"]:
        return "retrieval"
    return "ok" if case["correct"] else "generation"

counts = {"ok": 0, "retrieval": 0, "generation": 0}
for c in CASES:
    d = diagnose(c)
    counts[d] += 1
    print(f"{c['q']:30} {d}")
print(f"retrieval failures: {counts['retrieval']}, generation failures: {counts['generation']}, ok: {counts['ok']}")
first = "retrieval (chunking, hybrid search, query rewriting)" if counts["retrieval"] >= counts["generation"] else "generation (grounding prompt, citations)"
print("fix first:", first)
Quick checkAn answer is wrong, and the correct passage wasn't among the retrieved chunks. Which part needs fixing?
How sure are you?
Pick an answer and how sure you are