All patterns
Retrieval
GraphRAG hybrid search
Combine entity-relationship knowledge graphs, hierarchical community summaries, dense vector search, and sparse BM25 keyword matching for global corpus understanding and multi-hop reasoning.
clientservicemodeldatabaseagentexternal
Explanation
Standard vector RAG excels at pinpoint local chunk retrieval but fails on global corpus questions ('What are the primary systemic risks across all audit reports?') and multi-hop entity traversal. GraphRAG extracts entities, claims, and relationships at ingestion time, grouping them into hierarchical communities with pre-computed summaries. At query time, a router determines whether the query requires local chunk search (vector + BM25), global community synthesis, or a hybrid blend, delivering holistic grounding across disparate documents.
Components
Entity and relation extraction pipelineGraph database (e.g. Neo4j, FalkorDB, Kùzu)Hierarchical community detection (Leiden algorithm)Vector index (pgvector / HNSW)BM25 index for keyword searchReciprocal Rank Fusion (RRF) and cross-encoder reranker
When to use
- Enterprise knowledge bases with complex entity interconnections (legal, medical, financial)
- Corpora requiring global, thematic synthesis across thousands of documents
- Multi-hop queries where facts connect through multiple intermediate entities
When NOT to use
- Simple FAQ lookups or localized doc search where vector/BM25 is sufficient
- Frequently mutating real-time streaming data with low write latency budgets
- Cost-sensitive projects unable to invest in LLM-assisted graph extraction
Failure modes
- Entity resolution failures creating fragmented duplicate nodes for identical entities
- Community summaries drifting out of date as documents update incrementally
- Retrieval returning overly generic community summaries that dilute specific factual answers
Production checklist
- Implement entity canonicalisation and alias resolution in the ingestion pipeline
- Partition retrieval paths: local queries bypass global community summaries
- Pre-compute and cache hierarchical community summaries
- Track and limit LLM extraction costs during corpus ingestion
- Validate multi-hop recall against a curated golden benchmark