CSE Roadmap

Common tier · about 5 hours · 6 parts

Part 3 of 6 · 2 min read

GraphRAG

Connect the facts first, then walk the graph. Advanced: skip on a first read.

Think of a map of who is connected to whom, drawn before anyone asks a question. To answer, you walk along the lines of the map instead of searching for loose pages.

Knowledge graph

A set of entities (nodes) joined by labelled relationships (edges), stored as triples: (billing, owned_by, Payments).

GraphRAG

Retrieval that uses a knowledge graph built from the documents. Questions are answered by traversing edges (and, in some designs, by summaries of clusters of related nodes) instead of, or as well as, searching text.

Building the graph is a one-time pass over every passage: a model reads each chunk and extracts triples. Then "Which office does the manager of the team that owns the billing service work in?" is three edge lookups and zero text searches.

AAAWgmp1bWIAAAAeanVtZGMycGEAEQAQgAAAqgA4m3EDYzJwYQAAABZcanVtYgAAAEdqdW1kYzJtYQARABCAAACqADibcQN1cm46YzJwYToyZTFjMzBiYy05OWRmLTQ4NTQtYTg2OC0xYTNlNTMwZTFhZGMAAAADl2p1bWIAAAApanVtZGMyYXMAEQAQgAAAqgA4m3EDYzJwYS5hc3NlcnRpb25zAAAAALxqdW1iAAAARGp1bWRjYm9yABEAEIAAAKoAOJtxE2MycGEuaW5ncmVkaWVudC52MwAAAAAYYzJzaG+zx6NPR7DFetFC90VvqkcAAABwY2JvcqNpZGM6Zm9ybWF0bWltYWdlL3N2Zyt4bWxqaW5zdGFuY2VJRHgseG1wOmlpZDozMDQzOGY4Yy05OTI3LTQ1NGMtYjRlNC0yNmY3Y2QzYzJmZGFscmVsYXRpb25zaGlwaHBhcmVudE9mAAAB4mp1bWIAAABBanVtZGNib3IAEQAQgAAAqgA4m3ETYzJwYS5hY3Rpb25zLnYyAAAAABhjMnNoo4aN65Bzb980b5k4QTaqNAAAAZljYm9yomdhY3Rpb25zgqJmYWN0aW9ua2MycGEub3BlbmVkanBhcmFtZXRlcnOha2luZ3JlZGllbnRzgaJjdXJseC1zZWxmI2p1bWJmPWMycGEuYXNzZXJ0aW9ucy9jMnBhLmluZ3JlZGllbnQudjNkaGFzaFgg0MH9IR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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPZYQKtEZO+XetkmwAjwyVMY+ItmEQGV5I+FX+fJIDnsp632hDxhaxLYV1lWPIZXRsdObcbgVLWo8HXBAzzJHQN/UKE=The graph built from the 20 passages: 12 edges, and one missingSERVICETEAMMANAGEROFFICEYEARbillingPaymentsPriya NairPune2019owned bymanaged bybased inopenednotificationssearchDiscoveryTomas BergOslo2015owned byreports tobased inopenedauthPlatformAmara OkoyeLagos2021owned bymanaged bybased inopenedowned byDashed red: the passage "The Discovery team reports to Tomas Berg" did not fit the extraction schema, so the edge is missing.Every question about the Discovery manager, or anything beyond, then fails on the graph even though the text says the answer.
The graph built from the wiki: 12 edges from 20 passages, and one edge the extraction missed

Things a graph does well:

  • Multi-hop questions run as a short walk.
  • Reverse and aggregate questions such as "Which services does the Payments team own?" follow edges backwards and collect everything, where a text search may return only some of the passages.
  • Thematic questions ("what are the main topics?") can be answered from cluster summaries built on the graph, which no single search can do. (The example does not implement this; see Hard 3.)

Things it does badly or at a cost:

  • Construction cost. Every passage is read by a model at index time. This can be prohibitive for large corpora.
  • Extraction quality. Entities are easy; relationships are hard. In the example, "The Discovery team reports to Tomas Berg" did not match the schema, so the edge is missing and every question that goes through the Discovery manager fails (graph accuracy: 83%, 75%, 67% on two-, three- and four-hop questions), although the text plainly contains the answer.
  • Freshness. The graph is a copy. When the Payments manager changes, a graph built earlier still says Priya Nair; it needs re-extraction. The agentic system, which searches current text, answers correctly at once.
  • Entity resolution. "Payments", "the Payments team" and "Payments group" must be recognised as one node, or the walk breaks.