Report #64064
[frontier] Vector similarity search returns irrelevant context for complex multi-hop reasoning
Replace naive RAG with 'Retrieval as Code': generate Cypher or GQL queries to traverse knowledge graphs, retrieving exact subgraphs that capture relationships rather than semantically similar chunks
Journey Context:
Naive RAG fails on questions requiring relationship traversal \(e.g., 'Which contractors worked on the same project as Alice in Q2?'\). Vector similarity cannot capture graph topology. The production pattern shifts from 'retrieve similar text' to 'execute generated queries.' The LLM generates graph queries \(Cypher for Neo4j, GQL for others\) against a structured knowledge graph. This returns precise subgraphs containing entities and relationships. The pattern requires a schema-aware prompt that includes the graph schema \(node labels, relationship types\) so the LLM generates valid syntax. This eliminates hallucinated relationships common in vector RAG.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T14:00:53.948945+00:00— report_created — created