RAG and Knowledge Engineering

RAG and Knowledge Engineering

GraphRAG

50 of 81 in this book · 4 min read

What it is

Retrieving over a graph of entities and relations extracted from a corpus instead of, or alongside, retrieving passages: following edges from the entities a question mentions, gathering a connected subgraph, or reading pre-computed summaries of densely connected regions. It exists to answer questions whose evidence is distributed — no passage contains the answer because the answer is a pattern across many of them.

Why it is not the knowledge graph

The graph is an artifact with a schema, an identity model, a provenance record and a maintenance lifecycle, and it may have been built for reporting, compliance or master data long before anyone wanted to retrieve over it. This capability is one way of querying such a graph to produce material for a generated answer, and it can be run over a graph built for other purposes or over a disposable one extracted solely for this. The two fail independently: traversal and summarisation policies can waste an excellent graph, and a crude extracted graph can still support useful retrieval.

Why it matters

There is a question shape that passage retrieval cannot serve at all, and it is the shape executives ask: what are the recurring themes across these two thousand incident reports, how is this supplier connected to that contract, which teams are affected by this dependency. Top-k similarity returns the k passages most like the question, which for a question about the whole corpus is an arbitrary sample. Building a structure over the corpus first — and summarising its regions — turns a question about everything into a bounded read. The cost is that the structure must be built with a model pass over the entire corpus and kept current, which is the largest standing expense in any retrieval design that uses it.

Key decisions

  • Whether summaries of graph regions are pre-computed at build time or the graph is traversed per query. Pre-computation makes corpus-wide questions cheap and makes every update expensive; traversal is the reverse.
  • What is extracted and at what granularity — which entity types, which relation types, whether claims and attributes are nodes or edge properties. Extracting more makes the graph denser and the traversal noisier.
  • Whether this is the only retriever or a second arm alongside passage retrieval, and how the two sets of results are reconciled when they disagree.
  • Hop budget and expansion policy, because an unconstrained traversal from a common entity returns a substantial fraction of the graph.
  • How results trace back to source passages, since a summary of summaries supports no citation unless the lineage was retained deliberately.
  • What happens on ingestion: which summaries are invalidated by a new document, and whether recomputation is incremental or a rebuild.
  • How this is evaluated, given that its advantage appears on a question class that conventional retrieval metrics do not represent.

Failure modes

  • The extraction pass over a large corpus costs more than the product's entire annual budget, and the discovery happens after the pilot on ten thousand documents looked affordable.
  • The same organisation appears as a dozen nodes under spelling variants, so traversal fragments and every path through it is partial.
  • Pre-computed region summaries are never recomputed after ingestion, and answers about the corpus reflect its state at build time while passage retrieval reflects today.
  • A hub entity — a parent company, a shared platform, a common date — connects to everything, and every traversal that touches it returns the same enormous neighbourhood.
  • The answer is produced from a summary of summaries and cannot be attributed to any sentence in any document, so the product cannot show a source.
  • It is applied to the whole query population, and lookup questions that one passage answered precisely now go through a traversal that returns thematic material instead.
  • Relations are extracted without direction or with direction inverted, and the traversal asserts that the supplier owns the customer.
  • The comparison that justified the approach was against a weak passage baseline with no reranking, and the advantage disappears when the baseline is competent.

Related capabilities


Applies: Production readiness · Design questions