Evaluating Graph Retrieval: How to Prove a Knowledge Graph Helps¶
Adding a knowledge graph to a RAG pipeline feels like progress. It is a hypothesis. Whether it improves answers is an empirical question, and most teams skip the experiment, which is why most retrieval changes cannot be trusted.
This article describes a method. It reports no results of its own, because the numbers that matter are the ones from your corpus and your questions.
Start with what you are testing¶
State the claim in a form that can fail:
For multi-step and version-sensitive questions, graph-expanded retrieval returns more of the context the answer needs, and produces answers that are more faithful to the sources, than flat retrieval over the same corpus.
Notice the scope. Graphs rarely help every question. A claim you can test is narrower than "the graph makes it better".
Build a question set that can discriminate¶
The test set matters more than the metric. A set made of easy, single-passage questions will show no difference between approaches, and a set written to flatter the graph will show a difference that disappears in production.
Draw questions from real sources (search logs, support tickets, zero-result queries) and label each one by type:
| Type | Example | Expected to favour |
|---|---|---|
| Single-passage fact | "What is the default port?" | Neither; a control group |
| Multi-step procedure | "How do I run a vector search?" | Graph (prerequisites) |
| Version-sensitive | "How does this work in 2.1?" | Metadata scoping and version edges |
| Cross-topic | "Which guides cover authentication?" | Graph (coverage edges) |
| Unanswerable | "Does it support a feature that does not exist?" | Tests whether the system declines |
Keep the control group. If the graph variant is worse on single-passage questions, you want to know.
For each question, record the reference answer and the set of topics that must appear in context for the answer to be correct. Have a subject-matter expert review the labels, because a wrong label silently corrupts every score.
Define the variants¶
Change one thing at a time, and keep everything else fixed: same corpus, same chunking, same embedding model, same language model, same prompt, same temperature.
- Baseline: flat retrieval (vector, or hybrid search with reranking).
- Metadata-scoped: baseline plus filters on product and version.
- Graph-expanded: metadata-scoped plus traversal from the entry chunks along chosen edge types, with depth and size limits.
Having both the second and third variants matters. Many apparent graph gains come from metadata scoping, which is cheaper to build.
Choose metrics at two levels¶
Retrieval quality (did the right context arrive?)
- Context recall: the share of required topics that appear in the retrieved context.
- Context precision: the share of retrieved context that was actually needed. Graph expansion can raise recall while hurting precision, so report both.
- Required-prerequisite coverage: for procedural questions, whether every prerequisite appeared.
Answer quality (did the model use it correctly?)
- Faithfulness: whether each claim in the answer is supported by the retrieved context.
- Answer relevance: whether the answer addresses the question.
- Version-mismatch rate: the share of answers that cite or describe the wrong product version. For versioned documentation this is often the most important number, and the one generic frameworks do not give you.
- Abstention accuracy: on unanswerable questions, how often the system declines rather than invents.
Faithfulness, answer relevance, and context recall are the core metrics of RAGAS-style evaluation. Treat any model-graded metric as a measurement with error, not ground truth: calibrate it by having a person grade a sample and checking agreement.
Track cost alongside quality¶
Graph expansion adds context, so it adds tokens and latency. Record context size, tokens per answer, and response time for every variant. A gain that doubles cost may still be worth it, but only if you can see the trade.
Analyse by question type, not just overall¶
A single average hides the story. Report each metric per question type. The expected pattern, if the hypothesis holds, is a clear gain on multi-step and cross-topic questions, no change on single-passage questions, and no extra hallucination on unanswerable ones. If the gain appears only on one hand-picked type, say so.
Report sample size and uncertainty. With small question sets, differences of a few points are noise; use paired comparisons on the same questions and show intervals or per-question wins and losses rather than only means.
Make it a gate¶
A one-off experiment tells you whether to build the graph. A recurring one tells you whether a change broke something.
- Store the question set, reference answers, and variant configuration in version control.
- Run the evaluation in CI on every change to chunking, metadata, embeddings, prompts, or the graph itself.
- Fail the build when faithfulness, context recall, or version-mismatch rate crosses a threshold you set from your own baseline.
- Keep failing cases as a regression set so a fixed bug stays fixed.
This is how a release gate blocks inaccurate or wrong-version answers before users see them.
Read the failures¶
Aggregate scores say whether; individual failures say why. For every question where the graph variant lost or tied, ask:
- Was the edge missing, wrong, or stale?
- Did traversal go too deep, or follow a weak relationship?
- Was the entry chunk wrong, so everything downstream was wrong?
- Was the question really unanswerable from the corpus?
Each answer points to a fix in a different layer: the ontology, the edges, the traversal limits, or the content.
A minimal evaluation record¶
One question, stored in a way that supports all of the above:
id: q-0142
type: multi-step
question: "How do I run a vector search?"
product: data-platform
version: "2.1"
required_topics: [system-requirements, installation-guide, create-account,
connect-data-source, api-authentication, vector-search]
reference_answer: |
...reviewed by a subject-matter expert...
reviewed_by: sme-initials
What not to claim¶
- Do not generalise from one corpus. Results on your documentation say little about someone else's.
- Do not report a model-graded score without saying which model graded it.
- Do not credit the graph for gains that metadata scoping alone delivers.
- Do not report an average without question types and sample size.
Takeaway¶
A knowledge graph is a hypothesis about your content: that structure carries part of the answer. Test it like one. Build a discriminating question set, change one variable at a time, measure retrieval and answer quality separately, break the results down by question type, watch the cost, and keep the whole thing running as a gate. If the graph earns its place, you will be able to show where and by how much. If it does not, you will have found out cheaply.
For the modeling side, see From Taxonomy to Knowledge Graph and Vector Search, Knowledge Graphs, and GraphRAG.