RAG Needs a Map: Using GraphRAG to Retrieve Connected Context — Nyah Macklin, Neo4j

In “RAG Needs a Map: Using GraphRAG to Retrieve Connected Context,” Nyah Macklin presents GraphRAG as an enhanced Retrieval-Augmented Generation approach that integrates knowledge graphs with vector-based methods to enable more explainable, multi-hop reasoning AI, especially useful in complex, regulated domains. The session includes a hands-on workshop using Neo4j’s platform to build knowledge graphs from unstructured text, configure AI agents combining vector search and graph traversal, and demonstrates practical applications and resources for further learning.

In the presentation “RAG Needs a Map: Using GraphRAG to Retrieve Connected Context,” Nyah Macklin, a senior software engineer and developer advocate at Neo4j, introduces the concept of graph-based Retrieval-Augmented Generation (GraphRAG) as an advancement over traditional vector-based RAG systems. She begins by polling the audience on their familiarity with RAG and GraphRAG, then provides foundational knowledge about knowledge graphs, explaining how they represent data as interconnected nodes and relationships. This structure allows for more transparent, explainable, and traceable AI decision-making, which is particularly valuable in regulated industries like finance, medicine, and legal sectors.

Nyah contrasts traditional RAG pipelines, which rely on vector embeddings and document retrieval, with GraphRAG pipelines that incorporate knowledge graphs into the retrieval process. She emphasizes that while vector-based RAG is effective for straightforward search tasks, GraphRAG excels in scenarios requiring multi-hop reasoning, aggregation, and concatenation of data from diverse sources. The combination of vector and graph approaches is advocated to leverage the strengths of both, enhancing accuracy, context richness, and explainability in AI agents.

The workshop then transitions into a hands-on session using Neo4j’s Graph Academy platform, where participants create accounts, set up free Neo4j Aura cloud instances, and access provided OpenAI API keys. Nyah guides attendees through constructing a knowledge graph from unstructured text, using large language models (LLMs) to extract entities and relationships, and loading this structured data into Neo4j. She explains the use of Cypher, Neo4j’s graph query language, to visualize and query the knowledge graph, demonstrating how the graph grows and evolves with repeated queries.

Next, the focus shifts to building and configuring an AI agent within the Neo4j Aura platform that leverages the constructed knowledge graph. Nyah walks through creating a vector index for similarity search, integrating it with the agent, and setting up tools that enable the agent to answer questions grounded in the knowledge graph data. The agent is shown to provide accurate, context-aware responses based on the Graph Academy course content, illustrating the practical benefits of combining vector search with graph traversal for enhanced AI interactions.

Finally, Nyah reviews the code behind the knowledge graph builder, highlighting key components such as the OpenAI LLM, embeddings, text chunking, and the Neo4j driver. She underscores the importance of defining node and relationship types to guide the LLM in generating a coherent graph schema. The session concludes with an invitation to explore further learning resources on Graph Academy, an announcement of an upcoming Neo4j meetup in San Francisco, and encouragement to engage with Neo4j experts for deeper understanding and support in applying GraphRAG techniques.

Useful Links