← Projects Applied AI Personal project · 2026
A knowledge graph that didn't beat vector search
Does a knowledge graph extracted by a small local LLM retrieve maintenance-manual evidence better than plain vector search, especially for multi-hop questions? On two chapters of an FAA handbook, it didn't, and the write-up is about why.
- 0.23 vs 0.72
- Multi-hop recall@5, graph vs vector
- 4 vs 15 of 24
- Correct answers, graph vs vector
- 272 of 378
- Extracted triples kept
- kappa 0.94
- Key-term grader vs reference labels
Architecture
- 01 FAA handbook 2 chapters, parsed with PyMuPDF
- 02 Chunks 375, ~180 words each
- 03 Triple extraction qwen3:4b + Pydantic rules
- 04 Graph NetworkX, 297 entities
- 05 Retrieval vector, BM25, graph, hybrid
- 06 Answers qwen3:4b, graded three ways
The problem
A maintenance technician asks which pump feeds a unit, which fluid that system uses, and which seals that fluid needs. The answer is spread over several pages of a manual. Graph RAG is often proposed for exactly these relational, multi-hop questions.
I wanted to test that claim the way a team with a laptop GPU would actually build it, on the FAA Aviation Maintenance Technician Handbook - Airframe, chapters 12 (hydraulic and pneumatic power) and 13 (landing gear).
What I built
The PDF is parsed with PyMuPDF into 375 sentence-aligned chunks. Then two pipelines:
- Vector RAG: BGE-small embeddings in FAISS, plus BM25 as a non-graph control.
- Graph RAG:
qwen3:4bthrough Ollama extracts typed triples from the text. Pydantic validates each one: the schema, that both entities are specific and appear in the passage, and that the types fit the relation. Kept triples go into a NetworkX graph. Retrieval links the question to entities and expands one hop along the graph. - Hybrid: vector and graph lists fused with reciprocal rank fusion.
I wrote 60 reference questions from the handbook (30 single-hop, 30 multi-hop) with verbatim evidence quotes. The local model then answered 24 of them from each system’s top 5 chunks. Answers were graded three ways (a key-term rule, the same LLM as judge, and my own blind reference labels) so I could check the graders too.
A Neo4j compose file and loader are included, but the verified run used NetworkX.
Results
Graph retrieval lost to vector search, and fusion didn’t close the gap. Recall@5 was 0.47 single-hop and 0.23 multi-hop for the graph, against 0.97 and 0.72 for vector. Fusing the graph list into the vector list lowered single-hop recall@5 from 0.97 to 0.67. The same fusion with BM25 instead raised it to 1.00, so fusion wasn’t the problem. The graph list was.
The multi-hop case didn’t favour the graph either. On 16 bridge questions, where the second passage is reached through an entity named only in the first, complete@10 was 0.25 for the graph and 0.62 for vector.
Every hop lowered recall. Matching entity names alone reached 0.77 / 0.62. One hop dropped to 0.47 / 0.23, two hops to 0.30 / 0.18. Broad seeds like “brake” or “pump” flood the ranking. The best graph setting used no edges at all.
Answers follow retrieval. With every gold passage in context, the model answered 30 of 34 correctly. Without, 2 of 38. Graph context produced 4 correct answers out of 24, and 11 replies that narrated a search instead of answering.
A 4B judge needs a strict verdict. Counting only “correct” as a pass, the LLM judge reached kappa 0.75 against my labels. Counting “partial” as a pass dropped it to 0.40. The key-term rule reached 0.94.
Why it went this way
Coverage. The GPU budget let the LLM read 126 of 375 chunks. Where every gold chunk had been extracted, graph recall@5 was 0.75. Where none had, 0.25.
Quality. 272 of 378 triples passed validation. Of 40 kept triples I spot-checked, 25 were fully supported by the source, 10 partly and 5 not.
The questions favour lexical matching. I wrote them from the text, and on average 76% of a question’s content words occur in its gold chunks. That’s why BM25 was the strongest retriever overall.
So these are negative results for Graph RAG under a tight budget, not a general verdict.
Limits
- No external benchmark exists for this corpus, so validation is internal, and the questions and reference labels come from a single annotator.
- Small samples: 60 retrieval questions and 24 answered. Differences of a few answers between hybrid and vector are within noise.
- One 4B model, one prompt, a third of the corpus read. A larger extraction model, extraction from every chunk, better entity resolution, community summaries or a reranker could all change the outcome. None was tested.
- One fix after the first full run: entity mentions were linked on the chapter title too. It changed little, and the first-run tables are kept in the repo.
- Neo4j was not run against a database.