Graph RAG Best Practices: Build a Knowledge Graph That Answers
Graph RAG adds a knowledge graph to retrieval, so answers follow relationships between entities instead of guessing from text similarity alone.
On this page
Short answer
Graph RAG is a retrieval method that stores information as a graph of entities and their relationships, then uses that graph to find answers that need more than one fact. It works because many questions are about connections: who owns what, what depends on what, and what caused what. The best results come from a clean graph, queries that walk the relationships, and measurement against plain vector retrieval.
What is graph RAG?
Graph RAG is a retrieval method that stores information as a knowledge graph of entities and relationships, then retrieves answers by walking the connections between them. An entity is a thing such as a person, a product or a regulation; a relationship is a typed link such as owns, depends on or caused.
Plain vector retrieval finds passages that sound like the question. That works well for single-fact questions, but it struggles when the answer needs two or three facts joined together, such as which supplier provides the part that a faulty product uses. A graph stores those joins explicitly, so the retrieval step can follow them instead of hoping the right passage happens to be near the question in vector space.
Graph RAG does not replace vector search. Most systems use both: the graph answers the relationship part of the question, and vector search supplies the surrounding text. For the basic idea, see what graph RAG is.
How do you build the graph well?
You build the graph well by defining a small, fixed set of entity and relationship types before you extract anything, and by extracting from clean, current source documents. A graph built without a schema becomes a tangle of inconsistent types that no query can use reliably.
Start with the questions you need to answer, and let them set the schema. If users ask about ownership, dependencies and causes, your relationship types should include owns, depends on and caused by, and nothing else at first. Ten well-used types beat fifty types that appear once each.
Extraction quality matters more than extraction volume. Use a language model with a fixed prompt that returns entities and relationships in a strict format, then validate the output: check that every relationship links two entities that exist, and that entity names are consistent across documents. The build steps are in how to implement graph RAG.
How do you query the graph for retrieval?
You query the graph by finding the entities in the question, then walking outward along the relationships that matter, and collecting the facts you find as the retrieval context. The walk is the retrieval step: it replaces guessing which passages are relevant with following explicit links.
Limit the walk. Two or three hops from the starting entities usually covers the answer; further hops pull in loosely related facts that dilute the context and confuse the answer. Also limit the number of facts per hop, keeping the highest-confidence relationships and dropping the rest.
Community summaries help for broad questions. When a question asks about a whole topic rather than a single entity, a summary of the relevant community of entities gives better context than a long list of individual facts. Build summaries for the largest communities first, and refresh them when the graph changes.
How do you combine graph and vector retrieval?
You combine graph and vector retrieval by running both and merging their results, using the graph for relationship questions and the vector index for descriptive questions. Neither method covers every question type, so the combination is the system, not a fallback.
| Question type | Best method | Why |
|---|---|---|
| Who owns what? | Graph | Ownership is a stored link |
| What caused the failure? | Graph | Causes chain across facts |
| What does this term mean? | Vector | Definition lives in prose |
| How does the process work? | Vector | Steps live in documents |
| Which parts depend on X? | Graph | Dependencies are stored links |
| Summarise this topic | Both | Graph for structure, text for detail |
Route by question type when you can, and merge when you cannot. A simple route is to check whether the question names entities that exist in the graph; if it does, run the graph walk and add vector results as supporting text. The combination habits in advanced RAG techniques apply here too.
How do you keep the graph fresh?
You keep the graph fresh by treating it as a derived view of your source documents, rebuilt when the sources change, rather than as a hand-maintained database. A graph that drifts from its sources will confidently answer with facts that are no longer true.
Rebuild incrementally: when a document changes, re-extract its entities and relationships, replace the old ones, and leave the rest of the graph alone. Full rebuilds are simpler but slower, and they make it hard to tell what changed. Either way, keep a record of which document each fact came from, so a wrong answer can be traced to its source.
Watch for stale entities. A product that was renamed, a supplier that was replaced, or a regulation that was updated will leave old entities in the graph unless the update removes them. A monthly check for entities with no recent source document catches most of this drift.
How do you measure graph RAG quality?
You measure graph RAG quality on a fixed test set of questions with known good answers, comparing the graph system against plain vector retrieval on the same questions. If the graph does not win on the relationship questions, the graph or the queries need work.
Split the test set by question type. Relationship questions should favour the graph, while definition and process questions may favour vector search. A single average hides this, so report the two groups separately. Also track faithfulness: the share of answers whose claims can be traced to a retrieved fact.
Include multi-hop questions in the test set, since they are the reason to build a graph at all. A test set of single-fact questions will show no difference between graph and vector retrieval, and you will conclude the graph was not worth building. The measurement habits in RAG best practices are a good starting point.
Example (hypothetical): a support graph that answers dependency questions
Example (hypothetical): a software company keeps 2,000 support articles and a product catalogue. Customers ask questions such as "which connector does the ZX-400 use, and is it affected by the outage in region B?" That question needs two facts joined: the connector for the ZX-400, and whether that connector depends on region B.
The team builds a graph with entity types for product, component, supplier and region, and relationship types for uses, depends on and supplied by. They extract from the catalogue and the outage notices, and they keep the source document for every fact.
On a test set of 80 questions, plain vector retrieval answers 41 correctly in the top five, while graph RAG answers 63.
The 17 questions the graph still misses split into two groups: 9 need a fact that is missing from the graph, and 8 use a product name the graph stores under a different spelling. The team fixes the spelling with an alias list and adds the missing facts, and the score rises to 71 of 80.
What are the common mistakes?
The most common graph RAG mistakes are building a graph with no fixed schema, walking too far from the question, and testing only on single-fact questions that never needed a graph. Each one hides the value of the approach.
- No fixed schema. Extracting without a fixed set of entity and relationship types produces a tangle that queries cannot use. Define ten types, then expand slowly.
- Walking too far. Four or five hops from the question pulls in loosely related facts that dilute the context. Two or three hops is usually enough.
- Wrong test set. Single-fact questions show no difference from vector search. Include multi-hop questions, since they are the reason the graph exists.
- Stale graph. A graph that is not rebuilt when sources change will answer with facts that are no longer true. Trace every fact to its source document.
- Ignoring the vector side. Definitions and process descriptions live in prose, not in links. Keep vector retrieval for the questions the graph cannot answer.
- No alias handling. The same product under two spellings becomes two entities. Keep an alias list for names that vary.
Start with one question type that plain retrieval handles badly, build the graph for it, and measure before expanding. The evaluation habits in RAG evaluation give the measurement a repeatable shape.
Key takeaways
- Graph RAG stores facts as entities and relationships, so answers follow real links
- Define a small fixed schema before extracting anything; ten types beat fifty rare ones
- Walk two or three hops from the question, and keep vector search for descriptive questions
- Trace every fact to its source document so stale answers can be found and fixed
- Test on multi-hop questions, and report relationship and definition questions separately
Frequently asked questions
What is graph RAG in simple terms?
Graph RAG is a retrieval method that stores information as a graph of entities and their relationships, then answers questions by walking the links between them. It suits questions that need two or three facts joined together, such as which supplier provides the part a faulty product uses.
When is graph RAG better than plain vector search?
It is better for relationship questions: ownership, dependencies, causes and chains of facts. Plain vector search is better for definitions and process descriptions that live in prose. Most systems use both, routing by question type or merging the results.
How many hops should a graph query walk?
Two or three hops from the entities in the question is usually enough. Further hops pull in loosely related facts that dilute the context and confuse the answer. Limit the number of facts per hop as well, keeping the highest-confidence relationships.
How do you keep a knowledge graph up to date?
Treat the graph as a derived view of your source documents and rebuild the affected part when a document changes. Keep a record of which document each fact came from, and run a monthly check for entities with no recent source document, which usually means they are stale.
What is the most common graph RAG mistake?
Building a graph without a fixed schema is the most common mistake. Without a small set of entity and relationship types agreed in advance, extraction produces a tangle of inconsistent types that no query can use reliably. Define ten types, then expand slowly.
Does graph RAG replace vector search?
No. Graph RAG handles the relationship part of a question, while vector search supplies descriptive text and definitions. The two complement each other, and most production systems run both and merge the results.