Knowledge Graph Engine
Graph-Based Retrieval (RAG Alternative)
A graph-based retrieval system designed as a principled alternative to traditional RAG. Instead of embedding documents into vector space and retrieving by cosine similarity, documents are decomposed into entities, relationships, and claims using Claude. These are stored as a knowledge graph in Neo4j. At query time, the LLM generates Cypher queries to traverse the graph, producing retrievals that are structurally accurate, explainable, and context-rich. Built for domains where accuracy matters more than speed — legal, financial, technical documentation.
What Was Built
Document Ingestion Pipeline
PDF, Markdown, HTML documents decomposed into entities (people, companies, concepts, dates) and relationships (works_at, depends_on, contradicts) using Claude structured outputs with validation.
Knowledge Graph Storage
Neo4j with automatic schema evolution. New entity and relationship types are added dynamically as documents introduce novel concepts. Full-text indexing on entity properties.
Query Engine
natural language questions are translated to Cypher queries by Claude, executed against the graph, and results are synthesized into answers with citation paths. Multi-hop reasoning across relationship chains.
Graph Visualization
D3.js force-directed graph in the browser. Explore entities, relationships, and clusters interactively. Filter by entity type, relationship type, or source document.
Hybrid Retrieval
graph traversal for structured queries, pgvector fallback for fuzzy/unstructured queries. Automatic routing based on query classification.
Evaluation Framework
precision/recall benchmarks against traditional RAG on the same document corpus. Side-by-side comparison UI.
How It's Built
FastAPI backend with async Neo4j driver for concurrent graph operations
Claude structured outputs for entity/relationship extraction with JSON schemas
Neo4j Aura for managed graph database with automatic backups
Cypher query generation with validation and injection prevention
pgvector (via Supabase) as hybrid fallback for unstructured queries
Next.js 15 frontend with D3.js graph visualization
Docker Compose for local development, Railway for production
Evaluation harness comparing graph retrieval vs. vector RAG accuracy
Technical Stack
Results & Impact
Higher retrieval accuracy than vector RAG on structured domain queries
Explainable results — every answer traces through a relationship path
Interactive graph exploration reveals document relationships invisible to embeddings
Hybrid mode captures both structured and fuzzy query patterns
