Deep dive · 03
Knowledge-graph RAG — reasoning baked into the datastore
In a product that must never improvise clinical facts, every answer has to trace back to an exact retrieval path. That requirement pushed me away from a plain vector store and toward a knowledge graph where the reasoning is built at ingestion time.
Where should the reasoning live?
Retrieve grounded clinical knowledge for a turn
A · Thin index, heavy agent
Vector store is just an index. The agent does the reasoning on the fly — extracting
and connecting facts at query time. Probabilistic: a fresh chance of failure on
every turn.
rejected B · Smart datastore, thin agent
Move the hard work into ingestion. The graph itself encodes the reasoning —
concepts as nodes, relationships as edges. The agent only has to ask the right
question; traversal supplies the connected facts.
chosen Detail — why determinism mattered here
On-the-fly generative reasoning carries a failure probability every single time it runs. By contrast, a graph traversal over a curated structure is repeatable and auditable: we can point at the exact nodes and edges behind any answer. For a clinical assistant where traceability is the whole premise, that property was worth the heavier ingestion investment.
Ingestion — turning specialist PDFs into a reasoning graph
Curated PDFs
Specialists pick documents & papers per chronic condition.
Text → facts
LLM extracts text, then atomic facts from the text.
Concepts → nodes
Fixed concept set — medication, symptom, therapy — wrapped as nodes.
Relations → edges
e.g. medication X treats symptom Y → Neo4j graph.
A concrete slice — menopause
hot flashessymptom
treats / treated by
hormone replacement therapytreatment
Retrieval — seed by similarity, reason by traversal
Agent question
The one job left to the agent: ask the right question.
Hybrid search
BM25 + semantic similarity, fused with RRF reranking, lands on seed
nodes.
Traverse n-hops
Walk to neighboring concepts — implicit, pre-built reasoning.
Grounded answer
The agent composes on top of a connected, traceable fact set.
How we knew retrieval was good
recall@k
did we fetch the right facts?
precision@k
how much noise came with them?
auto + HITL
automated metrics + doctor review
What we tried and dropped
Naive chunking
Fixed-size splits cut across the facts that mattered.
Contextual chunking
Better boundaries, still no guarantee the needed fact lived in one chunk.
Sliding window
More coverage, more redundancy and noise.