Knowledge Graph Development: How GraphRAG Makes AI Answers Traceable

Knowledge graph development is the work of turning scattered company data into a connected map of entities and the relationships between them. In this way an AI system can reason over facts instead of guessing from loose text. For banks, insurers and healthcare companies this is becoming the difference between an AI pilot and an AI system an auditor will accept.
Most retrieval augmented generation (RAG) systems search text chunks by similarity. That works for "what does policy X say?". It breaks on questions that need several hops: "which patients on drug A also have condition B that interacts with it?" or "which of our counterparties share a beneficial owner with a sanctioned entity?". A knowledge graph stores those links explicitly, and GraphRAG lets the language model follow them and show the path it took.
This article explains what a knowledge graph is, how ontology development shapes it, where a clinical knowledge graph pays off, and why graphs help with explainable AI compliance. It also shows how Code & Pepper builds them as part of our RAG optimization and evaluation services.
What is knowledge graph development?
A knowledge graph is a database that stores facts as nodes (a patient, a drug, a policy, a company) and edges that name how they relate ("prescribed", "contraindicated with", "owns 25% of"). Knowledge graph development is the full project of designing that model, filling it from your sources and keeping it correct as data changes.
In practice a knowledge graph project has five parts:
- Ontology: the agreed list of entity types, relationship types and rules (what a "customer" is, which relations are allowed).
- Ingestion: connectors to databases, APIs and documents, plus LLM-based extraction of entities and relations from unstructured text.
- Entity resolution: deciding that "J. Smith", "John Smith" and customer #4471 are the same person.
- Graph store and queries: a graph database such as Neo4j or TypeDB, queried in Cypher or TypeQL.
- AI layer: GraphRAG retrieval, so an LLM answers questions from the graph and cites the nodes and edges it used.
The last part is new. Graphs have powered search engines, fraud detection and drug discovery for over a decade; what changed in 2024-2026 is that LLMs can now both build graphs from text and use them to answer questions in plain language.
Knowledge graph vs vector RAG vs GraphRAG
GraphRAG is retrieval augmented generation that retrieves from a knowledge graph instead of, or alongside, a vector index. Microsoft Research's GraphRAG paper reported that graph-based global answers beat plain vector RAG on comprehensiveness in 72–83% of comparisons, and used over 97% fewer context tokens at the top summary level.
|
Vector RAG |
Knowledge graph (no LLM) |
GraphRAG |
|
|
Stores |
Text chunks as embeddings |
Entities and typed relations |
Both: graph plus linked source text |
|
Good at |
"What does document X say about Y?" |
Exact queries, rules, lookups |
Multi-hop and "whole-dataset" questions in plain language |
|
Weak at |
Questions that join facts from many documents |
Natural language, unstructured data |
Higher build cost; needs an ontology |
|
Explainability |
Shows retrieved chunks |
Shows the query and path |
Shows the path through the graph and the source passages |
|
Typical build |
8-14 weeks |
Varies |
12-20 weeks |
Vector RAG is still the right default for document Q&A. GraphRAG earns its cost when answers depend on relationships, when the same entity appears in many systems, or when a regulator will ask why the AI said what it said. Most of the systems we build are hybrid: vector search finds the passages, the graph connects them.
If your problem is less about connected data and more about an AI that plans its own searches across many sources, read our companion article on AI Research Agent & Agentic RAG Development.
Ontology development
Ontology development is defining the vocabulary of your graph: which types of things exist, how they may relate and which rules always hold. A weak ontology produces a graph that looks impressive in a demo and returns wrong answers in production, because the same idea is stored in three different ways.
A good ontology for an AI system is:
|
Built from real questions |
We start from 30-50 questions users and auditors actually ask, then model only what those questions need. |
|
Aligned with standards where they exist |
FIBO for financial instruments and legal entities; SNOMED CT, ICD-10, LOINC and RxNorm for clinical data; HL7 FHIR resources for data exchange |
|
Owned by domain experts |
Underwriters, compliance officers or clinicians sign off relationship definitions, not just engineers. |
|
Versioned |
Ontology changes go through review like code, so answers given last quarter can be reproduced. |
|
Small at first |
Ten well-defined entity types beat two hundred vague ones. The graph grows when new questions justify it. |
Clinical knowledge graphs in healthcare
A clinical knowledge graph links patients, diagnoses, medications, procedures, lab results, payers and guidelines into one model, mapped to standard medical codes. It lets an AI assistant answer clinical and administrative questions with a traceable chain of evidence instead of a fluent guess.
Typical uses:
- Medication safety - flag drug–drug and drug–condition interactions across a patient's full record, not just the current prescription
- Medical coding and claims - connect documented services to ICD-10 and CPT codes and to payer rules, so denials can be predicted and explained.
- Eligibility and benefits - model plans, coverage rules and providers so staff get a clear answer on what is covered and why
- Clinical trial matching - match patient attributes to inclusion and exclusion criteria written in free text
- Guideline-grounded assistants - answer staff questions from approved clinical guidelines, with the guideline and patient facts shown side by side
Healthcare data adds constraints a generic graph project ignores: HIPAA and GDPR rules on who can see which nodes, consent tracked as data, and often EU or on-premise hosting. We design access control into the graph itself, so retrieval never returns a patient fact the user is not allowed to see.
Code & Pepper has worked on regulated healthcare platforms such as Sohar Health (real-time insurance eligibility and AI-assisted medical coding for behavioral health providers), Pelago (digital addiction clinic, HIPAA) and Patchwork Health (NHS workforce platform). We also built frontend tooling for Vaticle's TypeDB, a knowledge graph database with its own reasoning engine.
Knowledge graphs and explainable AI compliance
Explainable AI compliance means being able to show a regulator, an auditor or the affected person how an AI-supported decision was reached. Knowledge graphs help because every answer can be traced to specific nodes, edges and source documents, and that trace can be stored.
The EU AI Act makes this concrete for high-risk systems, which include credit scoring and risk pricing for life and health insurance (Annex III). Under the Digital Omnibus timeline, Annex III obligations apply from 2 December 2027. The articles a graph helps with:
|
EU AI Act requirement |
What it asks |
How a knowledge graph helps |
|
Art. 12 Record-keeping |
Automatic logs over the system's lifetime |
Each answer stores the graph path and source IDs it used |
|
Art. 13 Transparency |
Deployers can interpret the output and use it correctly |
Answers show which facts and relations led to them |
|
Art. 14 Human oversight |
People can understand, override and stop the system |
Reviewers see the reasoning path and can correct a wrong edge at its source |
|
Art. 86 Right to explanation |
Affected persons get "clear and meaningful explanations of the role of the AI system" (Art. 86) |
The stored path becomes the basis of the explanation letter |
GDPR Article 22 and sector rules (EBA guidelines, HIPAA audit controls) push the same way. A graph does not make a system compliant on its own; it gives you the evidence trail that a compliance process needs. For the full assessment, see our EU AI Act compliance service.
This section is general information, not legal advice.
How we build a knowledge graph: our process
A production GraphRAG system usually takes 12-20 weeks from discovery to launch. We work in five phases, each ending with something you can test.
- Discovery and question set (2-3 weeks)
We collect the 30-50 questions the system must answer, map data sources and agree on what "correct" means with your domain experts. - Ontology and data model (2-4 weeks)
We design the ontology, align it with industry standards and test it against the question set on paper before loading any data. - Graph build (4-7 weeks)
Ingestion pipelines, LLM-based extraction with human review of samples, entity resolution and access rules in the graph. - GraphRAG and evaluation (3-4 weeks)
Retrieval that combines graph traversal and vector search, then measurement against the question set: answer accuracy, faithfulness to sources and path correctness. - Production and monitoring (1-2 weeks, then ongoing)
Deployment in your cloud or on-premise, tracing of every answer, drift checks when sources change, and a process for experts to fix wrong facts.
Evaluation is where most graph projects fail quietly. We use the same methods as in our RAG optimization and evaluation services: a fixed test set, automated metrics in Ragas or DeepEval, and traces in Langfuse, so you can see whether a change to the ontology made answers better or worse.
Tech stack for knowledge graph development
We pick tools to fit your data, hosting rules and team, not the other way round.
|
Layer |
Tools we use |
|
Graph databases |
Neo4j, TypeDB, Amazon Neptune, PostgreSQL with Apache AGE |
|
Graph + LLM frameworks |
Microsoft GraphRAG, LangChain / LangGraph, LlamaIndex property graphs, Neo4j GraphRAG for Python |
|
Vector search (hybrid) |
Neo4j vector index, pgvector, Qdrant, Weaviate |
|
Models |
Claude, GPT, Gemini via cloud APIs; Llama, Mistral, Qwen for private LLM deployment |
|
Standards |
FIBO, SNOMED CT, ICD-10, LOINC, RxNorm, HL7 FHIR, RDF / OWL |
|
Evaluation and tracing |
Ragas, DeepEval, Langfuse (LLM observability) |
FAQ
What is knowledge graph development?
Knowledge graph development is designing, building and maintaining a database that stores entities and the relationships between them. It covers ontology design, data ingestion, entity resolution, the graph store and, increasingly, a GraphRAG layer that lets LLMs answer questions from the graph.
What is the difference between a knowledge graph and an ontology?
The ontology is the schema: the types of entities, relationships and rules. The knowledge graph is the data filled into that schema. Ontology development comes first; without it the graph has no consistent meaning.
What is GraphRAG?
GraphRAG is retrieval augmented generation that retrieves facts and paths from a knowledge graph, usually together with vector search over source text. It answers multi-hop questions better than vector-only RAG and shows the path behind each answer.
When do I need a knowledge graph instead of vector RAG?
You likely need one when answers depend on links between records (ownership, interactions, coverage rules), when the same entity appears in several systems, or when you must explain AI outputs to auditors. For simple document Q&A, vector RAG is cheaper and usually enough.
What is a clinical knowledge graph?
A clinical knowledge graph connects patients, diagnoses, drugs, procedures, labs and payer rules using standard codes such as SNOMED CT, ICD-10 and RxNorm. It supports medication safety checks, coding and claims, eligibility and guideline-based assistants.
How do knowledge graphs support explainable AI compliance?
Each answer can be traced to specific graph facts and source documents, and that trace can be logged. This supports EU AI Act record-keeping (Art. 12), transparency (Art. 13), human oversight (Art. 14) and the right to explanation (Art. 86) for high-risk systems.
How long does knowledge graph development take?
A pilot on one domain takes about 6-8 weeks. A production GraphRAG system usually takes 12-20 weeks, depending on the number of sources, data quality and hosting requirements.
Which graph database should we use?
Neo4j is the most common choice for GraphRAG and has the widest LLM tooling. TypeDB suits domains with complex rules and inheritance. Amazon Neptune fits AWS-only stacks, and PostgreSQL with Apache AGE works when you want to stay on Postgres. We recommend after the discovery phase, not before.
