Case study 01
GraphRAG: what it takes to turn a prototype into a module the platform keeps
Context
The company’s agentic RAG framework answered questions over document collections. Retrieval at the time was chunk similarity plus keyword matching: good at “what does this document say about X”, weak at questions whose evidence is spread across documents and whose answer depends on which entities are the same entity. A question like “which of these suppliers also appear in the incident reports” needs a graph, not a better embedding.
I proposed a GraphRAG module, built the prototype, and took it into the framework. The work below is that module, not the platform around it.
Problem
Three problems had to be solved before a graph was worth having:
- What counts as an entity. Extraction without a type system produces noise that resolves into the wrong things. We needed an ontology the domain actually uses.
- Which mentions are the same thing. “Vendor A”, “A Ltd”, and “A Limited” arrive as three nodes unless resolution is explicit and auditable.
- How retrieval uses the graph. A graph that only serves graph-shaped queries is a sidecar. It has to feed the same retrieval path that already worked.
My contribution
Proposed and led a GraphRAG module and took it from prototype into the company’s agentic RAG framework, where it now runs in production.
Concretely: the module’s design, the ontology iterations, the entity-resolution rules, the hybrid retrieval path, and the evaluation of each version. The framework, the ingestion pipeline and the customer documents were already there; the platform team owns them.
The requirement that shaped everything else
The questions that motivated the module are joins, not lookups. “Which of these suppliers also appear in the incident reports” has no single document that answers it: one side of the join lives in a vendor list, the other in a set of reports, and the thing that makes them the same is an entity, not a phrase. A chunk-similarity retriever can find both halves and still fail the question, because nothing in the ranking knows that two differently spelled names are one company.
So the module’s output was never meant to be a picture of a graph. It had to hand retrieval something it could use: a set of candidate chunks narrowed by the join, with provenance back to where each claim came from, so an answer can be checked instead of trusted. Everything downstream of that requirement follows - extraction has to be typed, resolution has to be explicit and auditable, and the type list has to stay small enough that a reviewer can still hold it in their head.
Deciding that first was the most useful week of the project. Most graph work I have seen dies because it is built as a separate query mode with its own interface: it looks impressive, nobody uses it, and it drifts away from the retrieval path that actually ships. Making the graph a constraint on an existing path gave it a reason to exist and a testable definition of done.
How the ontology changed, and why it keeps changing
An ontology is not a document you write once. The first version was a flat list of entity types and relation groups, drawn from what the customer documents seemed to contain. Extraction then produced near-duplicates that resolved into separate nodes, so the second version did the opposite of what a type list usually does: it cut the top level and pushed the precision into subtypes and relation categories underneath. Fewer things at the top, more discipline lower down.
The rule I ended up with is that a type has to earn admission. It went in only if it appeared on both sides of a relation the documents actually showed, and the questions from the labelled set filled the gaps the documents did not argue for; everything else stayed out of the list. That kept the type set small enough to review and small enough to re-extract, which are the same constraint seen from two sides. A stronger extraction model did not settle it either: it produced far more candidates and a weaker relative trim on relations, so more is not the same as better. I left that as an open question, because neither mapping had been scored on a downstream task.
The real cost is maintenance, and it grows with the corpus. Every new document genre arrives carrying entities the list has never seen - a new kind of contract, a product name, an internal team - and each addition is paid for twice: once in extraction, and again in the review that decides whether the new node is a real distinction or noise. The graph is cheap to query and expensive to keep honest, which is why the list is kept smaller than the evidence rather than equal to it.
Later versions of that ontology were adopted and kept being iterated by the team as the corpus grew. I designed the admission rule and ran the versions described here; the shape of the problem - keep the list smaller than the evidence, let subtypes carry the detail - did not change.
Results
The module runs inside the company’s RAG framework, and the simplified structure is the one that survived: the top-level list got smaller, the precision moved into subtypes and relation categories, and the first ones built were the ones with support from both the documents and the user questions.
What I cannot point to is an end-to-end answer-quality number for the module. That measurement belongs to the platform, not to me, and I am not going to quote it as mine.
What I would do differently
I built the extraction before the label set. The ontology would have converged a round earlier if I had spent the first two weeks labelling 200 documents and looking at what the domain owner called the same thing, instead of building extraction and asking afterwards.