How are people currently debugging retrieval failures and RAG quality issues in Haystack? #11697
Replies: 4 comments 11 replies
-
|
What works best for me is to separate this into three layers: single-query debugging, corpus health checks, and regression/evaluation. For a single bad query, I usually rerun the pipeline with intermediate outputs included: result = pipe.run(
data,
include_outputs_from={"retriever", "ranker", "prompt_builder"},
)Then I inspect, in this order:
That usually tells me whether the failure is retrieval, ranking, prompt construction, or generation. For step-by-step execution, Haystack's For document store validation, I keep a separate ingestion audit that checks:
For quality regression, I keep a small golden set and run it on every retriever/indexing change. With labels, I use document-level metrics such as recall/MRR/MAP. Without labels, I use model-based checks such as context relevance and faithfulness, but I treat them as triage signals rather than truth. The tool I would personally want is a "RAG debug bundle" around one query: run the pipeline with selected intermediate outputs, attach the trace id, show retrieved docs + scores + metadata, show prompt, run a few corpus checks for the touched docs, and diff this run against a previous known-good run. That would cover most of the manual work I currently do. |
Beta Was this translation helpful? Give feedback.
-
|
One thing I would make first-class is a reproducible failure artifact, not only a dashboard. For each bad query, I’d want a compact “debug bundle” that captures the pipeline version, embedding model/version, document store snapshot or index version, retriever filters, raw top-k before reranking, reranked top-k, final prompt, answer, and citations. That makes the failure diffable against a known-good run instead of only inspectable by eye. I’d also separate corpus-health checks from query-level eval. Duplicates, missing metadata, empty chunks, wrong embedding dimensions, and unexpected filter cardinality are ingestion problems; retrieval relevance/MRR/faithfulness are query problems. Mixing them makes the debugging surface feel larger than it is. The smallest useful tool, to me, would be: run one query, persist the full intermediate trace, attach corpus checks for the touched documents, and allow diffing against a previous run. |
Beta Was this translation helpful? Give feedback.
-
|
Confirmed on latest main (
One tiny leftover: the two smoke section headings still use an em dash, which renders as a replacement character in my captured console output. It does not fail the run, but if the goal is fully ASCII-safe smoke output, those separators could be changed to Looks good otherwise. |
Beta Was this translation helpful? Give feedback.
-
|
A workflow that’s been useful in production is treating retrieval debugging as a lineage problem. Every chunk gets stable metadata at indexing time: For document store validation, a small offline checker catches a lot before it becomes a RAG issue: from collections import Counter
def validate_documents(docs):
errors = []
ids = [doc.id for doc in docs]
duplicate_ids = [doc_id for doc_id, count in Counter(ids).items() if count > 1]
if duplicate_ids:
errors.append(f"duplicate document ids: {duplicate_ids[:10]}")
for doc in docs:
if not doc.content or not doc.content.strip():
errors.append(f"{doc.id}: empty content")
if "source_id" not in doc.meta:
errors.append(f"{doc.id}: missing source_id")
if "chunk_id" not in doc.meta:
errors.append(f"{doc.id}: missing chunk_id")
if "content_hash" not in doc.meta:
errors.append(f"{doc.id}: missing content_hash") |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I'm a haystack contributor and also use haystack daily in production for rag applications.
One thing I've noticed is that when retrieval quality drops or a query produces a poor answer, I often end up manually inspecting retrieved documents, pipeline outputs, evaluation metrics, and document stores to understand what went wrong.
I'm curious how others approach this today:
how do you debug retrieval failures?
how do you inspect pipeline execution step-by-step?
how do you validate document stores and catch issues such as duplicates, malformed documents, missing metadata, etc.?
are there existing tools or workflows you're using for observability and diagnostics around haystack pipelines?
I'd love to understand the current pain points and workflows before investing time into building anything around this area.
thanks!
Beta Was this translation helpful? Give feedback.
All reactions