liveBook · Manning

Chapter 13: Knowledge graph–powered retrieval-augmented generation

What you will learn in chapter 13 of Knowledge Graphs and LLMs in Action

The introduction contrasts the ease of building NLP applications with LLMs against the work still needed to make them useful in enterprise production.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The introduction contrasts the ease of building NLP applications with LLMs against the work still needed to make them useful in enterprise production.

Key terms: GPT-3.5, prompt engineering, downstream task, AI agents, LLM operations (LLMOps), production enterprise-grade scenarios

13.1 AI agents

This section defines AI agents, explains why complex tasks call for capabilities beyond simple LLM question answering, and illustrates how specialized agents can work together.

Key terms: AI agents, autonomy, adaptability, multistep reasoning, deep relational patterns, knowledge cutoff, multiagent system, Researcher, Writers, Reviewer

13.2 Chatting with the LLM

The section builds a simple conversational LLM agent and shows why a follow-up can improve an answer while an out-of-the-box model still needs relevant data for specific responses.

Key terms: pretrained LLM, memory, messages, message history, follow-up question, out-of-the-box models, specific answers

13.3 Challenges in the production environment

This section explains why LLM-based agents face production challenges and why access to current external information can help with one of them.

Key terms: hallucinations, next token, freshness, knowledge cutoff, external sources, knowledge graph, transparency, information sources, reliability, confidence level

13.4 Chatting with the AI about private data

This section motivates an AI interface that lets people ask questions about a private knowledge graph without learning graph-query tools.

Key terms: LLM, specialized domains, private data, Rockefeller Archive Center, KG, influence network, proprietary data, AI interface, AI agents, pretrained LLM

13.4.1 Retrieval-augmented generation

This section explains how RAG grounds LLM answers in retrieved external information, illustrates vector-based retrieval, and notes why human oversight remains necessary.

Key terms: retrieval-augmented generation, RAG agent, external data source, grounding, tools, text chunks, embeddings, vector database, same model, most similar text chunks

13.4.2 Vector-based RAG limitations

This section explains why vector-based RAG can retrieve misleading or incomplete context and introduces knowledge graphs as a way to address those limitations.

Key terms: context fragmentation, document chunks, multihop relationships, chunking strategy, embeddings, dense vector, domain-specific nuances, static (precomputed) vectors, scalability, approximate search algorithms

13.4.3 Graph RAG

The section explains how a knowledge graph can supply and select context for RAG, then illustrates a graph-guided document retriever in a simple agent.

Key terms: text-attributed graph, text-paired graph, metadata, KG retriever, typed relationships, schema, Cypher, subgraph, KG-enhanced document retriever, precanned Cypher query

13.4.4 Reasoning agents

This section explains how a ReAct agent coordinates Graph RAG tools and what makes the illustrated agent more reliable or limited.

Key terms: ReAct, Reason and Act, tools, contextual information, structured ReAct agent, tool names, tool descriptions, default prompts, KG-powered Graph RAG, document re-ranking

13.4.5 Let’s chat with our KG

This section tests a Graph RAG agent on archive questions, showing how it selects retrieval tools and why a knowledge graph helps answer questions spanning multiple documents.

Key terms: Graph RAG agent, KG retriever, KG-enhanced document retriever, Thought/Action/Observation, structured KG content, aggregate question, vector search, Cypher, distraction phenomenon, self-correction loops

13.5 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 12: Node classification and link prediction with GNNs Chapter 14: Asking a KG questions with natural language →

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.