Graph RAG and knowledge graphs

Graph RAG uses entity relationships as additional evidence.

What you will learn

  • Explain: explicit relationships with provenance
  • Apply the idea in an example: Graph RAG and knowledge graphs
  • Recognize limitations and verify the exercise outcome

Graph RAG uses entity relationships as additional evidence. Graph and documents complement each other, but both need verification.

These steps refer to features identified in the application code. This material has not been validated on a live instance; check the documentation and the options in your version.

How it works, step by step

Explicit relationships with provenance

A graph contains entities and relationships, such as Product → uses → Part. LLM extraction can confuse names or invent relationships; preserve the document supporting each fact. Bounded traversal looks for connections across multiple hops. Local Graph RAG combines Neo4j facts with vector passages. It is not automatically the Microsoft GraphRAG pipeline with community detection and reports. Dependency questions can benefit from a graph; simple FAQ questions may be cheaper with vector retrieval.

RAG accesses evidence, it does not retrain

RAG means retrieval-augmented generation: retrieval supplies relevant passages before the model answers. Ingestion prepares documents, while query execution searches the index and builds context. An embedding model represents text numerically; the response model writes the answer. Rerankers, vision, graph and router models have different roles when needed. RAG helps with private or changing information but does not guarantee truth. Use an authorized API for balances, exact inventory or permissions; an old document is not a reliable source for current state.

Good documents come before good answers

Prepare readable text, clear headings, tables with headers and sources without unnecessary duplicates. Chunking divides a document into separately retrievable passages; overlap preserves continuity between neighbors. A short chunk can lose conditions, while a large one introduces noise. Metadata preserves source, position and version, plus access scope where enforced by the implementation. Upload stores the file; indexing makes it searchable. When a source changes, check that old chunks disappear and new ones are retrieved before declaring the knowledge base current.

Detailed lab

Depth, limits and entity resolution

vector_top_k controls text passages; graph_depth bounds traversed relationships; graph_limit bounds returned facts. Do not increase everything together. For the adapter question compare depth 1 and 2 and check the required connection through P-12.

Similarly named products may have different SKUs. Entity resolution must preserve exact identifiers. Compare each returned relation against its source. Greater depth can add irrelevant relationships and cost rather than useful evidence alone.

The visual map

Graph RAG and knowledge graphs Follow the solid arrows for the main flow. Dashed blue arrows supply data or context; dashed pink arrows show feedback or returning results. Colors and shapes distinguish models, stores, decisions and outputs. Graph facts and vector passages converge. LX-240 → P-12 → A-7 illustrates a two-hop relationship, not an automatic guarantee of truth. Retrieval returns evidence. If a response model is enabled, it also composes an answer; retrieved evidence still needs checking. Connections: User request → Extract entities from query; Extract entities from query → Bounded graph traversal; Bounded graph traversal → Fuse facts and passages; Fuse facts and passages → Response model (optional); Response model (optional) → Evidence with sources; Extract entities from query → Semantic search; Semantic search → Fuse facts and passages; Neo4j knowledge graph → Bounded graph traversal; Vector index → Semantic search; Bounded graph traversal → LX-240 (Example path); LX-240 → P-12 (uses); P-12 → A-7 (uses). R06 · Relationship map Graph RAG and knowledge graphs Input User request Store / index Neo4j knowledge graph Store / index Vector index AI model / agent Extract entities from query Processing Bounded graph traversal Processing Fuse facts and passages Processing Semantic search Data LX-240 Data P-12 Data A-7 AI model / agent Response model (optional) Output Evidence with sources Example path uses uses Main flow Data and context Feedback and return

Follow the solid arrows for the main flow. Dashed blue arrows supply data or context; dashed pink arrows show feedback or returning results. Colors and shapes distinguish models, stores, decisions and outputs. Graph facts and vector passages converge. LX-240 → P-12 → A-7 illustrates a two-hop relationship, not an automatic guarantee of truth. Retrieval returns evidence. If a response model is enabled, it also composes an answer; retrieved evidence still needs checking. On smaller screens, scroll horizontally to follow the entire diagram.

A complete example

The catalog says LX-240 uses P-12, and the manual links P-12 to adapter A-7. Asking about the adapter needs two relationships and original-passage verification.

template: Graph
vector_top_k: 4
graph_depth: 2
graph_limit: 20

Try it yourself

  1. Select Graph and a graph model; compare graph_depth=1 and 2 and inspect retrieved facts.
  2. Record the input, source and expected outcome before running the experiment. Use only the fictional data in the example.
  3. Follow the diagram stages. At every step record what information is received and produced; do not confuse intermediate output with the final outcome.
  4. Repeat after removing necessary information or making the input ambiguous. Check whether the system clarifies, stops or invents an answer.
  5. Compare with the explained solution. Keep the configuration, date, result and an explanation for differences. Change one thing and retest.

An explained solution

The LX-240 → P-12 → A-7 path is source-supported; a similar name is not treated as the same entity. A successful exercise lets you show the connection between input, stages and outcome. When information is missing, a cautious answer is more useful than invented details. Compare more than style: check conditions, sources and operations too.

When it helps and what can go wrong

Local Graph RAG does not imply Microsoft GraphRAG community reports. Choose this approach when it improves a measured need. Keep a simple baseline and compare outcomes using identical inputs. One successful example does not establish reliability in every situation.

Check your understanding

Does an AI-extracted edge prove the relationship is true?

No. Check its source and the identities of the entities.

Does RAG change LLM parameters?

No. It supplies request-time context; parameter changes belong to training.

What outcome should this exercise produce?

The LX-240 → P-12 → A-7 path is source-supported; a similar name is not treated as the same entity.

Words to remember

  • Hop: Crossing one relationship in a graph.
  • Retrieval: Finding relevant information in accessible sources.
  • Chunk: A document passage that can be retrieved separately.

Sources and your next step

To prepare: R05 — Multimodal RAG: documents also contain images