Moosa Memon
← Index of work

RAG that can answer multi-hop questions

NexusGraph-RAG: converts documents into a Neo4j property graph while keeping Qdrant vector embeddings, then fuses k-hop graph traversal with semantic search through reciprocal rank fusion for questions dense retrieval can't answer.

Type
RAG
Stack
Neo4j / Qdrant / FastAPI / Claude API / Pydantic / Docker
Status
Complete; full offline test suite, docker-compose full stack

Problem

Standard vector RAG fails on questions that need global understanding or multi-hop logic: “which vendors mentioned in Q3 contracts are affected by the compliance update in Doc B?” No single chunk contains the answer. The answer is a path through entities across documents.

System

An LLM extractor (Claude, with schema-validated structured outputs) turns documents into entities and typed relations; a heuristic extractor stands in for offline use. Entities and relations land in Neo4j, chunks and embeddings in Qdrant. Retrieval runs dense cosine search over chunks and k-hop expansion from query-matched entities, then fuses both lists with weighted reciprocal rank fusion. Seeded hierarchical Louvain detects communities over the entity graph, stored as nodes for summary-level questions.

Worth knowing

Have a workflow that looks like this?

Most of these start as a messy, manual process someone got tired of. Twenty minutes is usually enough to sketch how I'd approach yours.