3D graph of colored nodes connected inside stacked frames

Beyond Vector Search: Build Multi-Hop RAG with AWS’s graphrag-toolkit and Neo4j

Why Vector RAG Breaks on Multi-Hop Questions

A conventional RAG pipeline indexes documents as chunks, embeds each one, and retrieves by cosine similarity. Every chunk is an island. The index encodes what a passage is about, not what it relates to. For single-hop lookups that is sufficient. For multi-hop questions it is structurally insufficient, because the answer requires joining facts that never appear near each other in the source text.

Consider a retailer whose return policy sits in one document and whose international warranty terms sit in another. A question about returning a defective item bought abroad needs both, plus the relationship between them. Vector search will surface whichever chunk best matches the query wording and may never retrieve the second piece at all. The model can reason perfectly well; it simply never receives the material.

This is why better prompting and larger context windows do not reliably fix it. A bigger window helps only if the right passages are retrieved in the first place, and similarity ranking does not guarantee that. The same linear-pipeline assumption shows up wherever retrieval is treated as a single pass, and our earlier analysis of Agentic RAG vs. Naive RAG covers how multi-step queries expose it: the failure is architectural, not a matter of tuning.

What GraphRAG Actually Changes

Graph-enhanced RAG replaces the flat vector index, or supplements it, with a knowledge graph of explicit entities and relationships. Retrieval can then follow edges instead of relying only on embedding proximity. Neo4j’s explainer frames the approach as combining a graph’s explicit structure with an LLM’s generative fluency, so the model reasons over connected facts rather than isolated fragments. Oracle’s documentation of the same pattern describes chunks as independent islands and a graph as the record of how they connect, which entities recur across a collection, and how concepts relate across an entire document set. The two vendors differ on implementation, not on the diagnosis.

Inside graphrag-toolkit

graphrag-toolkit is an open-source, Apache 2.0-licensed Python toolkit from AWS Labs. It ships two components with different starting points:

  • lexical-graph automatically builds a hierarchical knowledge graph from unstructured documents and supports querying it. This is the component the rest of this article uses.
  • BYOKG-RAG (Bring Your Own Knowledge Graph) is a multi-strategy question-answering layer for teams that already maintain a graph and do not want to re-extract it from scratch.

AWS introduced the toolkit in a launch blog post, and the design behind lexical-graph is documented in a research paper titled “Hierarchical Lexical Graph for Enhanced Multi-Hop Retrieval.” The paper is the right place to look for the retrieval mechanics; the documentation is the right place to look before writing configuration.

The Six-Level Lexical Graph Model

According to the toolkit’s graph model documentation, a lexical graph organizes extracted content into six connected levels:

  1. Source: the originating document.
  2. Chunk: a passage extracted from the source.
  3. Topic: a thematic grouping spanning chunks.
  4. Statement: an assertion extracted from a chunk.
  5. Fact: a normalized, structured form of a statement.
  6. Entity: the people, products, policies, and other named things that facts reference.

The hierarchy matters because retrieval can hop between levels. A query can start at an entity, walk to the facts that mention it, trace those facts back to statements and chunks, and pull in adjacent topics that a chunk-level index would never surface. That traversal is the structural feature that makes multi-hop questions answerable: the graph supplies the connective tissue that the embedding index discards.

How the Pieces Fit Together

The build uses Neo4j as the graph store and pgvector for embeddings, which keeps the vector side in PostgreSQL and the graph side in a database designed for traversal. The division of labor is straightforward: the builder parses documents into chunks, extracts statements and facts, resolves entities, and writes the six-level hierarchy into Neo4j, while embeddings land in pgvector. A query then does two things at once. It resolves an entity or topic in the graph and follows edges outward, and it runs a similarity search in pgvector to anchor the starting point. The graph supplies the joins; the vector index supplies the entry.

The configuration surface is where the project’s youth shows. Option names have moved between releases, so check every key against the toolkit’s documentation rather than from memory before wiring the builder to an embedding model, a completion model, and the two storage backends. Then run a small ingestion against a handful of documents and inspect the resulting nodes and edges before scaling up. That last step is not optional. Graph construction is an extraction pipeline driven by a language model, and its output quality varies with the input. Verifying the shape of the graph on a small corpus saves considerable debugging later.

The payoff is visible on questions that require joining facts. Returning to the retailer: a query about a defective item bought abroad can resolve the product entity, follow edges to both the return policy facts and the international warranty facts, and assemble an answer from material that a chunk-level index would have split across unrelated retrievals. The same pattern applies to research corpora, where a finding in one paper constrains a method in another, and to internal documentation, where a configuration note in one runbook changes the meaning of a procedure in another.

Production Signals and Caveats

The strongest signal that lexical-graph is production-ready rather than a demo comes from Deloitte, which uses it in its Amazon Neptune-based GenAI Security Intelligence Center. The work was presented in a technical session at re:Invent 2025. A security intelligence center is a demanding environment for retrieval: the questions are inherently multi-hop, connecting indicators, entities, and incidents across sources.

The caveats are equally real. Graph construction is extraction-heavy: every chunk passes through a language model, so ingestion costs scale with corpus size in a way that embedding-only pipelines do not. The toolkit’s documentation does not publish a fixed count of LLM calls per document or per chunk, and the number depends on how much content the extractor pulls from each passage, so budget from a measured sample of your own corpus rather than from a published figure. Graph maintenance is ongoing work, since new documents must be reconciled against existing entities or the graph fragments into duplicates. And a plain vector store remains the right call for single-hop lookups over a stable, well-partitioned corpus. If your queries never need two facts joined, the graph is overhead.

The Retrieval Layer Is Becoming a Graph Problem

The most useful part of this story is the diagnosis itself. Chunk-level retrieval was designed for lookup, and it is being asked to answer questions that require joins. AWS Labs responded with an Apache 2.0 toolkit that implements a six-level lexical graph and lets retrieval hop across it. That is a meaningful shift in how the industry frames the problem: not as a prompting deficiency, not as a context-window deficiency, but as a missing representation of how facts relate.

For engineers, the practical takeaway is to instrument for multi-hop failures before choosing an architecture. If your evaluation set contains questions that require joining facts from separate documents, and your vector pipeline misses them, the fix is structural. graphrag-toolkit, Neo4j, and pgvector give you a credible way to build that structure, with the documentation and the hierarchical lexical graph paper as your reference points. The decisive test remains local: run your own hardest questions against both pipelines and count what each one retrieves.

Similar Posts