The Systematic RAG Improvement Runbook
Improve retrieval. Then improve the answer.
A complete improvement loop for RAG: establish a synthetic baseline, add metadata and hybrid search, learn from user feedback, and run production experiments that tell you what changed and why.
- Synthetic data
- Metadata
- Hybrid search
- User feedback
- Topic clustering
- Monitoring
- Latency trade-offs
In this guide
- Measure retrieval before you do anything else
- Some queries need structure
- Neither search method alone is enough
- Your feedback button is a measurement instrument
- Individual failures are noise. Clusters are signal.
- One variable per experiment. Every time.
- The cost of a wrong answer depends on the application
Measure retrieval before you do anything else
The typical RAG improvement cycle goes: bad answer → tweak the prompt → still bad answer → switch the model → still bad answer → add more context. None of these interventions necessarily touches retrieval, which is often where the failure originates.
Before changing a prompt, model or chunking strategy, you need a number: how often does your retrieval system return the right chunk? Synthetic data can give you an initial measurement in hours rather than weeks.
What the number should tell you
On questions generated directly from your own chunks, a high source-chunk hit rate — for example, 95–98% — is a useful target to investigate. It is not a universal production guarantee. If retrieval regularly misses the relevant document even on this test, improving answer synthesis will not fix the missing evidence.
Build the baseline in four steps
- Generate questions from each chunk. Ask an LLM for 3–5 questions that the chunk answers directly. Vary phrasing: keyword-heavy, paraphrased and inferential. Stress-test different query styles.
- Test each question against retrieval. Check whether the source chunk appears in the top-k results. Record a hit or miss for every question. With one known source per question, this is your source-chunk hit rate, often used as a recall@k proxy.
- Test full-text and vector search separately. Run the same questions against each before combining them. Their performance gap reveals whether keyword mismatch or semantic drift dominates your dataset.
- Lock the number as your baseline. Measure subsequent experiments against the same evaluation set. A subjective impression of better answers is not enough to show a retrieval improvement.
What the data can look like
| Illustrative evaluation | Source-chunk hit rate | Interpretation |
|---|---|---|
| Vector search on long-form documents | ~96% | Strong semantic match |
| Full-text search on long-form documents | ~94% | Slightly lower, often faster |
| Full-text search on structured data | ~60% | Keyword mismatch may dominate |
These are illustrative values, not benchmarks for your corpus. Prose and structured data behave differently. Always measure each content type separately.
# Minimal synthetic evaluation loop (application-specific APIs)
hits = 0
total = 0
for chunk in knowledge_base:
questions = llm.generate_questions(chunk.text, n=4)
for question in questions:
results = retriever.search(question, top_k=5)
retrieved_ids = [r.chunk_id for r in results]
if chunk.id in retrieved_ids:
hits += 1
total += 1
hit_rate = hits / total if total else 0
print(f"Source-chunk hit rate: {hit_rate:.1%}")
# Investigate retrieval misses before changing answer generation.Read the complete guide
Create a free account to read every section, example and template.
Checking your session…