GraphRAG & Knowledge Graphs for LLMs: Multi-Hop Retrieval Beyond Vector Search
Why vector search fails on 'global themes' and 3-hop entity connections, how Knowledge Graphs + community summaries work, and Hybrid Vector + GraphRAG architectures
GraphRAG extracts structured Entities and Relationships (Subject, Predicate, Object) from text into a Knowledge Graph—plus hierarchical community summaries—enabling multi-hop traversal and corpus-wide reasoning.
Standard vector RAG only finds local top-5 chunks similar to one query; it fails miserably on global questions ('What are the top 5 risk themes across all 10,000 filings?') or multi-hop links (Company A → Supplier B → Sanctioned Owner C).
Financial compliance, biomedical discovery, and enterprise root-cause analysis rely on multi-hop entity relationships that flat chunk vectors cannot connect.
Combining Neo4j/graph traversal with vector retrieval lets you answer 3-hop queries in milliseconds without stuffing 100 chunks into the prompt.
Hierarchical community summaries unlock map-reduce answers to corpus-wide 'what are the main trends?' queries.
Increasingly common senior AI question: 'When does standard Hybrid Vector RAG fail, and how does GraphRAG solve it—plus what is the cost tradeoff?'
Which query MOST clearly requires GraphRAG over standard Vector RAG?
- Identify the two exact query types where Vector RAG fails and GraphRAG excels: Multi-Hop Entity Traversal and Global Corpus Sensemaking.
- Trace the GraphRAG indexing pipeline: Entity/Relation Extraction → Graph Construction → Community Detection (Leiden) → Hierarchical Summaries.
- Compare GraphRAG indexing cost vs. Vector RAG and know when Hybrid Vector + Graph is worth the complexity.
Flat chunk retrieval sees islands of text; a Knowledge Graph builds bridges between entities across documents, and community summaries give you a bird's-eye map of the whole corpus.
1. Vector RAG vs. GraphRAG Cost & Capability Tradeoff
| Dimension | Vector / Hybrid RAG | GraphRAG |
|---|---|---|
| Indexing Cost | Cheap (fast embeddings) | Expensive (LLM entity extraction per chunk!) |
| Single-Fact Lookup | Fast & accurate | Overkill |
| Multi-Hop Entity Chains | Weak (misses intermediate hops) | Strong (exact 2–3 hop graph traversal) |
| Global Themes ('Across all docs...') | Fails (only sees top-K chunks) | Strong (hierarchical community summaries) |
The exact honest questions almost every beginner wonders — answered in plain English without hiding behind jargon.
No! GraphRAG indexing costs 10×–50× more tokens than embeddings and requires entity deduplication. Start with Hybrid RAG (BM25 + Dense + Reranker) and add a Knowledge Graph only when multi-hop entity links or global summaries are core product needs.
Dual-Branch BM25 + Dense Vector → RRF Fusion Animator
Watch exact lexical BM25 and semantic Dense search run in parallel and merge via rank-only Reciprocal Rank Fusion.
from collections import defaultdict, deque
# Minimal Multi-Hop Knowledge Graph Traversal (2-Hop GraphRAG Context Fetcher)
triples = [
("Acme", "SUPPLIED_BY", "ChipCo"),
("ChipCo", "LOCATED_IN", "Taiwan"),
("ChipCo", "AUDITED_BY", "AuditFirmX"),
("AuditFirmX", "FLAGGED_FOR", "ComplianceRisk"),
]
graph = defaultdict(list)
for s, r, o in triples:
graph[s].append((r, o))
def fetch_khop_facts(start_entity: str, max_hops: int = 2) -> list[str]:
facts, q, seen = [], deque([(start_entity, 0)]), {start_entity}
while q:
node, depth = q.popleft()
if depth == max_hops: continue
for rel, nxt in graph[node]:
facts.append(f"({node}) -[{rel}]-> ({nxt})")
if nxt not in seen:
seen.add(nxt)
q.append((nxt, depth + 1))
return facts
print("2-hop GraphRAG context for Acme:")
for f in fetch_khop_facts("Acme", max_hops=2):
print(" ", f)