AI
GraphRAG vs RAG: When a Knowledge Graph Helps
GraphRAG builds a knowledge graph from your documents so AI can answer big-picture questions. How it works, GraphRAG vs RAG, cost and when to use it.
GraphRAG is a form of retrieval-augmented generation that builds a knowledge graph from your documents (the people, organisations, products, events and how they relate) and uses that graph, plus summaries of related groups, to answer questions. Standard RAG finds the text chunks most similar to a question; GraphRAG can also follow connections between things and answer "big picture" questions about a whole collection, such as "What are the main themes in these 5,000 support tickets?". The trade-off is cost and complexity: building the graph usually means running a language model over all your text, which is far more expensive than creating embeddings.
This guide explains what GraphRAG is, how it works, GraphRAG vs RAG and GraphRAG vs vector RAG, knowledge graph RAG with an existing graph, GraphRAG cost and cheaper variants, and when it's worth using.
What Is GraphRAG?
The term became popular through Microsoft Research, which published a paper in April 2024 describing a "Graph RAG" approach for question answering over large private text collections, and released the GraphRAG software as open source later that year. Many other tools now use the name more broadly for any RAG system that uses a graph.
In Microsoft's approach, GraphRAG:
- Extracts a knowledge graph from your documents using a language model: entities (people, places, organisations, concepts) and the relationships between them.
- Groups related entities into communities, clusters of closely connected nodes, at several levels of detail.
- Writes a summary of each community in advance.
- Answers questions using the graph, the community summaries and the original text.
The key insight is that some questions can't be answered from a handful of similar passages. "What are the main risks discussed across all these reports?" needs an overview of everything; GraphRAG's community summaries provide that.
How GraphRAG Works
Indexing: building the graph
- Split documents into chunks, as in normal RAG.
- Extract entities and relationships from each chunk with a language model. For example, from "Acme acquired Brightline in March to expand into logistics", it extracts the entities Acme and Brightline and the relationship "acquired".
- Merge duplicates so "Acme", "Acme Inc." and "the company" become one node where possible.
- Detect communities of closely connected entities using a graph clustering algorithm.
- Summarise each community with a language model, at several levels, from small detailed groups to broad themes.
- Store everything: the graph, the summaries, the original chunks and usually embeddings too.
Querying: three main modes
- Local search starts from the entities mentioned in the question, gathers their neighbours, relationships and related text chunks, and answers from that focused context. Good for "What do we know about Acme's partnerships?"
- Global search works over the community summaries: each relevant summary produces a partial answer, and these are combined into a final one. Good for "What are the main themes in this dataset?"
- Hybrid modes, such as Microsoft's DRIFT search, combine the two: start broad with community information, then drill into local details.
GraphRAG vs RAG
GraphRAG vs RAG comes down to the questions you need to answer:
| Standard (vector) RAG | GraphRAG | |
|---|---|---|
| What it retrieves | Chunks most similar to the question | Entities, relationships, community summaries and chunks |
| Best questions | Specific facts in one or two passages | Questions about connections, or the whole collection |
| "Big picture" questions | Weak: only sees a few chunks | Strong: uses pre-built summaries |
| Multi-hop questions | Often weak | Better: can follow relationships |
| Indexing cost | Low (embeddings) | High (language model reads all text) |
| Query cost | Low | Low to high, depending on mode |
| Setup and maintenance | Simple | More complex: extraction, graph storage, updates |
| Explainability | Shows source chunks | Shows entities, relationships and sources |
Our guide to what RAG is covers how standard RAG works.
GraphRAG vs Vector RAG
GraphRAG vs vector RAG is a narrower version of the same question, because "vector RAG" means retrieval by embedding similarity. Where vector search struggles:
- Global questions: "Summarise the main complaints across all reviews" needs every review, not the top five similar ones.
- Relationships: "Which suppliers are connected to the delayed projects?" requires joining facts that sit in different documents.
- Different wording: an entity mentioned by several names across documents is easier to connect in a graph after merging.
- Counting and coverage: vector search can't tell you how many documents mention something, or whether it found them all.
Where vector RAG is still better:
- Simple factual questions, where a passage contains the answer.
- Fast-changing content, where re-building a graph is costly.
- Small budgets, since embeddings are cheap.
In practice, most GraphRAG systems also keep vector search: the graph adds structure, and embeddings still find relevant text.
Knowledge Graph RAG With an Existing Graph
Knowledge graph RAG doesn't have to start from extracted text. Many organisations already have structured data that forms a graph: customers, products, orders and contracts in databases, or a dedicated knowledge graph in a graph database. In that case:
- The model queries the graph directly, for example by generating a graph query (such as Cypher for Neo4j) from the question, or by calling tools that look up entities and relationships.
- Results are precise: relationships come from your data, not from an LLM's extraction.
- Text and graph combine: structured facts from the graph, plus explanations from documents through vector search.
This is often the most reliable form of graph RAG for business data, because the graph is already accurate. Extraction-based GraphRAG is most useful when the knowledge lives only in unstructured text.
Knowledge Graph vs RAG: Not Either-Or
People often ask "knowledge graph vs RAG" as if they compete. They don't: RAG is a pattern (retrieve information, then generate an answer), and a knowledge graph is one place to retrieve from. The real choices are:
- What to retrieve: text chunks, graph facts, community summaries or all three.
- How to retrieve: similarity search, graph queries, keyword search, or an agent choosing among them.
- Where the graph comes from: extracted from documents by a model, or built from structured data you already trust.
GraphRAG vs agentic RAG is a similar pairing. An agentic RAG system decides what to search and when; GraphRAG gives it a richer source to search. Many advanced systems combine both.
A GraphRAG Example
Imagine 5,000 customer support tickets and the question: "What are the main reasons enterprise customers churned this year, and which product areas are involved?"
With vector RAG, the system retrieves the ten tickets most similar to the question. They mention churn, but they're a tiny, possibly unrepresentative sample. The answer sounds confident and misses most of the picture.
With GraphRAG:
- During indexing, the model extracted entities such as customers, product areas, features, competitors and issues, plus relationships such as "customer reported issue with feature".
- Community detection grouped related entities: one cluster around billing errors and invoicing, another around a slow reporting module, another around a competitor's pricing.
- Each cluster has a pre-written summary.
- Global search asks each relevant summary which churn reasons it covers, then combines the partial answers into a ranked list with the product areas involved and example tickets as evidence.
The answer covers the whole dataset rather than a sample, which is exactly the kind of question GraphRAG was designed for.
Best Database for GraphRAG
Where you store the graph depends on scale and existing tools:
| Option | Good for |
|---|---|
| The GraphRAG tool's own storage (files or tables) | Experiments and small to medium datasets |
| Neo4j | Mature graph database with graph RAG tooling and vector search built in |
| Memgraph, FalkorDB | Fast in-memory graph databases aimed at real-time and AI workloads |
| Amazon Neptune, other cloud graph services | Teams already on that cloud |
| PostgreSQL with graph extensions (such as Apache AGE) | Teams that want to stay on Postgres |
Pick the one your team can operate. Many GraphRAG projects start with the tool's default storage and move to a graph database only when queries or scale demand it.
GraphRAG Cost
GraphRAG cost is the main reason teams hesitate:
- Indexing is expensive. A language model reads every chunk to extract entities and relationships, then writes summaries for every community. Microsoft has said graph extraction accounts for the bulk of indexing cost.
- Cheaper variants exist. In November 2024, Microsoft Research introduced LazyGraphRAG, which builds its index with lightweight language-processing techniques instead of a large model and defers most model work to query time. Microsoft reported that LazyGraphRAG's indexing cost is the same as vector RAG and about 0.1% of full GraphRAG's, implying full GraphRAG indexing can cost around a thousand times more than a vector index. It also reported comparable quality to GraphRAG's global search on global questions at more than 700 times lower query cost.
- Query cost varies by mode. Local search is similar to RAG with extra context. Global search can call the model many times, once per relevant community summary, then once more to combine answers.
- Updates add cost. New documents need extraction and may change communities and summaries.
Practical ways to control cost:
- Start with a sample of your documents and measure extraction cost before indexing everything.
- Use a smaller, cheaper model for extraction and a stronger one for answering, after checking extraction quality.
- Limit entity types to the ones you care about (for example people, companies and products).
- Consider lazy or hybrid approaches if most questions are local.
- Re-index incrementally rather than rebuilding the whole graph.
When to Use GraphRAG
| Situation | Recommendation |
|---|---|
| Questions are mostly simple lookups | Vector RAG; improve chunking and add reranking |
| People ask about themes and trends across a collection | GraphRAG with global search |
| Questions depend on relationships between entities | GraphRAG or knowledge graph RAG |
| You already have structured data with clear relationships | Knowledge graph RAG on your existing graph |
| Documents change daily | Vector RAG, or a lazy graph approach |
| Budget is tight but some global questions matter | LazyGraphRAG-style indexing, or summaries built only for key collections |
| Questions need several steps and sources | Combine with an agent; see our guide to agentic RAG |
Good GraphRAG use cases: research and intelligence analysis across many reports, investigations, customer-feedback analysis, compliance reviews, scientific literature, and any knowledge base where "how is this connected to that?" is a common question.
How to Build a GraphRAG System
- Define the questions you need to answer and check whether vector RAG already handles them.
- Pick an approach: Microsoft's open-source GraphRAG, a graph database with GraphRAG features (such as Neo4j's tools), lighter open-source projects such as LightRAG, or a framework like LlamaIndex with graph indexes.
- Design the schema: which entity and relationship types matter.
- Run extraction on a sample, review the graph by hand, and fix prompts or entity types.
- Store the graph in a graph database or the tool's own storage, alongside a vector database for text chunks.
- Test with real questions, comparing answers and costs with your vector RAG baseline.
- Plan updates for new and changed documents.
Common GraphRAG Problems
- Messy extraction: the model invents relationships, misses entities or splits one entity into several. Review samples and tune extraction prompts.
- Over-connected graphs: generic entities ("customer", "system") connect everything and blur communities. Filter or merge them.
- Stale summaries: community summaries go out of date as documents change.
- Slow global queries: many model calls per question. Use a smaller model for partial answers or a lazy approach.
- Unclear benefit: if your questions are simple lookups, the graph adds cost without improving answers.
FAQ
What is GraphRAG?
GraphRAG is retrieval-augmented generation that uses a knowledge graph built from your documents. It extracts entities and relationships, groups them into communities with summaries, and uses this structure to answer questions about connections and whole collections, not just individual passages.
What is the difference between GraphRAG and RAG?
Standard RAG retrieves the text chunks most similar to a question. GraphRAG also uses a graph of entities and relationships, plus pre-written summaries, so it can answer questions about connections and themes across many documents. It costs more to build.
Is GraphRAG better than vector RAG?
For global and relationship-heavy questions, usually yes. For simple factual lookups, vector RAG is cheaper and often just as good. Many systems combine both.
How much does GraphRAG cost?
Indexing is the expensive part, because a language model reads all your text to extract entities and write summaries. Microsoft reported that its cheaper LazyGraphRAG variant indexes for about 0.1% of the cost of full GraphRAG, roughly the same as a vector index.
What is knowledge graph RAG?
Knowledge graph RAG uses a structured graph of entities and relationships, either extracted from text or from existing data, as a retrieval source for a language model. The model queries the graph for facts and connections, often alongside vector search over documents.