liveBook · Manning

What you will learn in Essential GraphRAG

Knowledge Graph-Enhanced RAG

by Tomaž Bratanič and Oskar Hane
Foreword by Paco Nathan

Chapter by chapter

Chapter 1: Improving LLM accuracy

This introduction frames GraphRAG as a way to improve LLM accuracy and currency by combining retrieval-augmented generation with knowledge graphs that connect structured and unstructured data.

1.1 Introduction to LLMs · 1.2 Limitations of LLMs · 1.2.1 Knowledge cutoff problem · 1.2.2 Outdated information · 1.2.3 Pure hallucinations · 1.2.4 Lack of private information · 1.3 Overcoming the limitations of LLMs · 1.3.1 Supervised finetuning · 1.3.2 Retrieval-augmented generation · 1.4 Knowledge graphs as the data storage for RAG applications · 1.5 Summary

What you learn in chapter 1 →

Chapter 2: Vector similarity search and hybrid search

This chapter introduces using embeddings, vector similarity search, and hybrid search in a RAG application to answer questions from unstructured data.

2.1 Components of a RAG architecture · 2.1.1 The retriever · 2.1.2 The generator · 2.2 RAG using vector similarity search · 2.2.1 Application data setup · 2.2.2 The text corpus · 2.2.3 Text chunking · 2.2.4 Embedding model · 2.2.5 Database with vector similarity search function · 2.2.6 Performing vector search · 2.2.7 Generating an answer using an LLM · 2.3 Adding full-text search to the RAG application to enable hybrid search · 2.3.1 Full-text search index · 2.3.2 Performing hybrid search · 2.4 Concluding thoughts · 2.5 Summary

What you learn in chapter 2 →

Chapter 3: Advanced vector retrieval strategies

This chapter introduction motivates improving a basic RAG retriever with query rewriting and advanced document-embedding strategies to retrieve more relevant, complete context for answer generation.

3.1 Step-back prompting · 3.2 Parent document retriever · 3.2.1 Retrieving parent document strategy data · 3.3 Complete RAG pipeline · 3.4 Summary

What you learn in chapter 3 →

Chapter 4: Generating Cypher queries from natural language questions

This chapter introduces generating Cypher queries from natural-language questions to make knowledge-graph retrieval more flexible and dynamic.

4.1 The basics of query language generation · 4.2 Where query language generation fits in the RAG pipeline · 4.3 Useful practices for query language generation · 4.3.1 Using few-shot examples for in-context learning · 4.3.2 Using database schema in the prompt to show the LLM the structure of the knowledge graph · 4.3.3 Adding terminology mapping to semantically map the user question to the schema · 4.3.4 Format instructions · 4.4 Implementing a text2cypher generator using a base model · 4.5 Specialized (finetuned) LLMs for text2cypher · 4.6 What we’ve learned and what text2cypher enables · 4.7 Summary

What you learn in chapter 4 →

Chapter 5: Agentic RAG

This introduction frames agentic RAG as a multi-retriever system in which a router selects suitable retrieval agents, typically through LLM tool use.

5.1 What is agentic RAG? · 5.1.1 Retriever agents · 5.1.2 The retriever router · 5.1.3 Answer critic · 5.2 Why do we need agentic RAG? · 5.3 How to implement agentic RAG · 5.3.1 Implementing retriever tools · 5.3.2 Implementing the retriever router · 5.3.3 Implementing the answer critic · 5.3.4 Tying it all together · 5.4 Summary

What you learn in chapter 5 →

Chapter 6: Constructing knowledge graphs with LLMs

This chapter introduces using LLMs to extract structured information from unstructured text and turn it into a knowledge graph for queries that embeddings alone handle poorly.

6.1 Extracting structured data from text · 6.1.1 Structured Outputs model definition · 6.1.2 Structured Outputs extraction request · 6.1.3 CUAD dataset · 6.2 Constructing the graph · 6.2.1 Data import · 6.2.2 Entity resolution · 6.2.3 Adding unstructured data to the graph · 6.3 Summary

What you learn in chapter 6 →

Chapter 7: Microsoft’s GraphRAG implementation

This chapter introduces Microsoft’s GraphRAG pipeline, which builds a summarized knowledge graph and retrieves from it through global and local search.

7.1 Dataset selection · 7.2 Graph indexing · 7.2.1 Chunking · 7.2.2 Entity and relationship extraction · 7.2.3 Entity and relationship summarization · 7.2.4 Community detection and summarization · 7.3 Graph retrievers · 7.3.1 Global search · 7.3.2 Local search · 7.4 Summary

What you learn in chapter 7 →

Chapter 8: RAG application evaluation

This chapter introduces a benchmark-based approach to evaluating a RAG agent at tool-selection, retrieval, answer-generation, and end-to-end levels using RAGAS.

8.1 Designing the benchmark dataset · 8.1.1 Coming up with test examples · 8.2 Evaluation · 8.2.1 Context recall · 8.2.2 Faithfulness · 8.2.3 Answer correctness · 8.2.4 Loading the dataset · 8.2.5 Running evaluation · 8.2.6 Observations · 8.3 Next steps · 8.4 Summary

What you learn in chapter 8 →

Concepts explained in this book

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.