GraphRAG Explained: Knowledge Graphs for Better Retrieval

How GraphRAG uses knowledge graphs of entities and relationships to answer multi-hop and global questions that plain vector RAG struggles with.

Published December 1, 2026

Vector RAG retrieves passages similar to the question. That works for "what does the refund policy say?" but struggles with questions that require connecting facts across many documents ("which suppliers are linked to delayed shipments in projects led by the Pune team?") or summarising a whole corpus ("what are the main themes in these 2,000 support tickets?"). GraphRAG adds a knowledge graph of entities and relationships to handle these cases.

The concept

During indexing, an LLM (or NLP pipeline) extracts entities (people, products, companies, systems) and relationships between them from each chunk, building a graph. Some approaches also cluster the graph into communities and pre-generate summaries for each community, which enables answering broad, corpus-level questions.

At query time, the system identifies entities in the question, traverses the graph to gather connected facts (multi-hop), and combines them with relevant text chunks before generation. The trade-offs are cost and complexity: extraction with LLMs is expensive for large corpora, graphs need updating as documents change, and many questions do not need it.

Building the graph

chunksbuildclusterDocumentsExtract entities + relationsLLMKnowledge graphnodes, edgesCommunity summariesoptional
GraphRAG indexing.

When GraphRAG helps

Question typeVector RAGGraphRAG
Single-fact lookupGreatFine (overkill)
Multi-hop relationshipsWeakStrong
Corpus-wide themes / summariesWeakStrong (community summaries)
Frequently changing documentsEasy to updateGraph maintenance needed
Indexing costLowHigh (LLM extraction)

Querying

UserQuery plannerGraph DBVector indexLLMmulti-hop questiontraverse: Team→Project→Supplierrelated passagesfacts + passagesanswer with sources
Graph traversal plus text retrieval at query time.

Practical examples

Entity extraction prompt

Ask for structured triples.

Extract entities and relationships from the text as JSON:
{"entities": [{"name": ..., "type": "Person|Team|Project|Supplier|System"}],
 "relations": [{"source": ..., "relation": ..., "target": ...}]}
Only include facts stated in the text.

Multi-hop query in Cypher (Neo4j)

Graph queries express relationship chains naturally.

MATCH (t:Team {name: "Pune Platform"})-[:LEADS]->(p:Project)-[:USES]->(s:Supplier)
WHERE (s)-[:HAD]->(:Incident {type: "delayed_shipment"})
RETURN DISTINCT s.name, collect(p.name) AS projects

Hybrid context assembly

Combine graph facts with supporting passages.

facts = graph.query(cypher, params)
passages = vector_search(question, k=5)
context = format_facts(facts) + "\n\n" + "\n\n".join(p.text for p in passages)

Common mistakes

  • Building a graph for questions that simple vector search answers well.
  • Underestimating extraction cost on large corpora.
  • Letting the graph go stale as documents change.
  • Accepting extracted relations without quality checks.

Key takeaways

  • GraphRAG adds entities and relationships to retrieval.
  • It shines on multi-hop and corpus-level questions.
  • Indexing is more expensive and harder to maintain.
  • Use it selectively, often alongside vector RAG.

FAQ

Do I need a graph database?

Not necessarily; small graphs can live in relational tables or in memory, but graph databases make traversals easier at scale.

Is GraphRAG a specific product?

The term refers to a family of techniques; there are open-source implementations and vendor features.

Can I build the graph without LLMs?

Yes, with traditional NLP entity extraction or existing structured data, which is cheaper and more predictable.

More AI articles