The eight stages, what each is for, and the debug checklist that maps a bad answer to one failing stage.
INGEST -> CHUNK -> EMBED -> INDEX (offline, per document change)
QUERY -> RETRIEVE -> RERANK -> GENERATE (online, per question)
| Stage | Job | Skipped or broken, you see |
|---|---|---|
| Ingest | Pull sources into clean text + metadata; track updates and deletes | Missing or stale content: correct answers are impossible for the generator |
| Chunk | Split into retrievable fact-bundles with context kept | Fragments that match but cannot answer; answers cut mid-fact |
| Embed | Turn each chunk into a vector; same model for queries | Paraphrased questions retrieve nothing relevant at any k |
| Index | Store vectors + keywords + metadata for fast filtered search | Slow queries, or filters silently dropping valid rows |
| Query | Rewrite, expand or route the raw question; extract filters | Exact constraints ("under 400k") treated as vague similarity |
| Retrieve | Top-k candidates via dense, sparse or hybrid + filters | Gold chunk absent from top k: recall@k is the ceiling |
| Rerank | Rescore candidates reading query + chunk together; keep top n | Right chunk retrieved at rank 18, ignored by the generator |
| Generate | Answer only from provided chunks, with citations, or say "not found" | Fluent inventions; correct chunks present but contradicted |
Run top to bottom; stop at the first "no". Adapted from the seven failure points of Barnett et al.[1]
| Knob | Sane start | Move when |
|---|---|---|
| Chunk size | 200-500 tokens, plus chunk context line | Recall low and chunks look fragmentary |
| Retrieve k | 20-150 candidates | Reranker present: raise; no reranker: keep small |
| Rerank keep n | 5-20 chunks | Faithfulness drops as n grows (noise) |
| RRF constant k | 60 | Rarely; it is deliberately insensitive |
Sources: Lewis et al. 2020, Anthropic contextual retrieval, Barnett et al. 2024, Liu et al. 2023. Full list in RESOURCES.md.