Chapter 2.9 — GraphRAG and Knowledge Graphs¶
🎯 Objective¶
Present GraphRAG as a complement — not a replacement — to textual RAG, with a clear criterion for when it is worth paying the cost of maintaining a graph.
🧠 When GraphRAG makes sense¶
- Multi-hop questions ("who approved what that affects what").
- Relational compliance (lineage of decisions, dependency between contracts, the impact of one clause on others).
- Investigation (root cause, fraud, security, audit).
- Structural explainability (showing the "path" that connected A to B).
When it does not make sense:
- A small, relatively flat corpus.
- Predominantly "find the passage that talks about X" questions.
- A team without an organizational mandate to curate the ontology.
🧠 Components¶
- Knowledge graph. Entities, relations, properties.
- Property graph (Neo4j, openCypher). A pragmatic, widely used model.
- Ontology (optional). RDF/OWL for formal semantics and inference.
- Construction. NER + relation extraction + human curation. The automatic part is necessary; the human part is what separates a useful graph from a graph full of noise.
- Querying. Cypher, SPARQL or Gremlin.
- Subgraph summarization. Linearizing the relevant subgraph to send to the LLM as context.
🧠 Usage patterns¶
- Hybrid RAG + Graph. Textual RAG retrieves passages; the graph retrieves relations; the prompt combines the two.
- Graph-first for structured questions, RAG for textual questions. The router decides where it goes.
- Graph as a filter. The graph restricts the universe (e.g., "only contracts from tenant X signed after Y"), and textual RAG delivers the content.
⚠️ Cautions¶
- Maintaining the graph is expensive. Automatic extraction produces noise; curation is continuous work.
- Indexing cost is dominated by LLM calls. In classic GraphRAG, extracting entities and relations and pre-generating community summaries consumes LLM over the whole corpus before the first query. The LazyGraphRAG variant (research proposal, 2024) indexes with NLP noun-phrase extraction and co-occurrence, without an LLM, at about 0.1% of the indexing cost of full GraphRAG (comparable to vector RAG), and shifts the LLM to query time with an explicit budget; in the published measurements it matched GraphRAG's global search at more than 700× lower cost per query. Treat it as a proposal to validate on your corpus, not as a default.
- Quality depends on governance. Without an owner of the schema, the graph rots within months.
- GraphRAG does not replace textual RAG for most cases; it complements it.
- Promises of "symbolic reasoning" via graph still lack robust empirical support for most production cases; treat it as an enriched retrieval heuristic, not a solver.
📚 References¶
- Microsoft GraphRAG: https://microsoft.github.io/graphrag/
- Microsoft Research — From Local to Global: A Graph RAG Approach to Query-Focused Summarization: https://arxiv.org/abs/2404.16130
- Microsoft Research — LazyGraphRAG: Setting a new standard for quality and cost (2024): https://www.microsoft.com/en-us/research/blog/lazygraphrag-setting-a-new-standard-for-quality-and-cost/
- Neo4j GraphRAG: https://neo4j.com/docs/neo4j-graphrag-python/current/
- Google Cloud — GraphRAG with Spanner Graph: https://docs.cloud.google.com/architecture/gen-ai-graphrag-spanner