Page
1
(This page has no text content)
Page
2
(This page has no text content)
Page
3
Advanced Retrieval-Augmented Generation
Page
4
IEEE Press 445 Hoes Lane Piscataway, NJ 08854 IEEE Press Editorial Board Jon Atli Benediktsson, Editor-in-Chief Massoud Amin Moeness Amin Adam Drobot James Duncan Hugo Enrique Hernandez Figueroa Ekram Hossain Brian Johnson Jim Lyke Joydeep Mitra Desineni Subbaram Naidu Hugo Proenca Yi Qian Tony Quek Behzad Razavi Tom Robertazzi Albert Wang Patrick Chik Yue
Page
5
Advanced Retrieval-Augmented Generation Bridging Large Language Models and Knowledge Graphs Wendy Ran Wei Huijun Wu
Page
6
Copyright © 2026 by The Institute of Electrical and Electronics Engineers, Inc. All rights reserved. Published by John Wiley & Sons, Inc., Hoboken, New Jersey. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning, or otherwise, except as permitted under Section 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, Inc., 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 750-4470, or on the web at www.copyright.com. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permission. The manufacturer’s authorized representative according to the EU General Product Safety Regulation is Wiley-VCH GmbH, Boschstr. 12, 69469 Weinheim, Germany, e-mail: Product_Safety@wiley.com. Trademarks: Wiley and the Wiley logo are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates in the United States and other countries and may not be used without written permission. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book. Limit of Liability/Disclaimer of Warranty: While the publisher and the authors have used their best efforts in preparing this work, including a review of the content of the work, neither the publisher nor the authors make any representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation any implied warranties of merchantability or fitness for a particular purpose. No warranty may be created or extended by sales representatives, written sales materials or promotional statements for this work. The fact that an organization, website, or product is referred to in this work as a citation and/or potential source of further information does not mean that the publisher and authors endorse the information or services the organization, website, or product may provide or recommendations it may make. This work is sold with the understanding that the publisher is not engaged in rendering professional services. The advice and strategies contained herein may not be suitable for your situation. You should consult with a specialist where appropriate. Further, readers should be aware that websites listed in this work may have changed or disappeared between when this work was written and when it is read. Neither the publisher nor authors shall be liable for any loss of profit or any other commercial damages, including but not limited to special, incidental, consequential, or other damages. For general information on our other products and services or for technical support, please contact our Customer Care Department within the United States at (800) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002. Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic formats. For more information about Wiley products, visit our web site at www.wiley.com. Library of Congress Cataloging-in-Publication Data: Names: Wei, Wendy Ran author | Wu, Huijun (Writer on cloud computing) author Title: Advanced retrieval-augmented generation : bridging large language models and knowledge graphs / Wendy Ran Wei, Huijun Wu. Description: Hoboken, New Jersey : Wiley, [2026] | Includes bibliographical references and index. Identifiers: LCCN 2026003339 | ISBN 9781394374687 hardback | ISBN 9781394374700 adobe pdf | ISBN 9781394374694 epub Subjects: LCSH: Semantic networks (Information theory) | Natural language processing (Computer science) | Generative artificial intelligence | Information retrieval—Automation Classification: LCC Q387.5 .W45 2026 LC record available at https://lccn.loc.gov/2026003339 Cover Design: Wiley Cover Image: © Wendy Ran Wei
Page
7
To my beloved cats—Coco, Milk, Pudding, and Cream—for the purrs and company through every page. And to my family, for igniting my dreams. —Wendy For wanderers who found their compass, may you discover light in exploration. —Huijun
Page
8
(This page has no text content)
Page
9
Contents Foreword xiii About the Authors xv Preface xvii Acknowledgments xxi Introduction xxiii About the Companion Website xxvii Part I From Traditional Information Retrieval to Modern RAG 1 1 Information Retrieval 3 1.1 Definition and Historical Evolution 3 1.1.1 Definition 3 1.1.2 Historical Evolution 4 1.2 Information Retrieval Components 14 1.2.1 Overview 14 1.2.2 Pre-retrieval 16 1.2.3 Retrieval Models 21 1.2.4 Post-retrieval 30 1.3 Information Retrieval Applications 34 1.3.1 Search Systems 35 1.3.2 Recommendation Systems 38 1.3.3 Example: WANDS Dataset 40 1.4 Challenges with IR Systems 45 1.4.1 Lack of Context Awareness 45 1.4.2 Cold-start Problem 45 1.4.3 Scalability 45 1.4.4 Difficulty in Handling Complex Queries 45 1.5 Summary 46 References 46 2 Large Language Models 49 2.1 LLMs Overview 49 2.1.1 Evolution of ML Paradigms 49 2.1.2 LLM Fundamentals 54 2.1.3 LLM Families 75
Page
10
viii Contents 2.1.4 LLM Paradigms 83 2.2 LLM Use Case in Information Retrieval 91 2.2.1 Use LLM for Search Systems 91 2.2.2 Use LLM for Recommendation Systems 102 2.3 Challenges of LLMs for Information Retrieval 108 2.3.1 Core Limitations: Hallucinations and Knowledge Staleness 108 2.3.2 The RAG Solution: Dynamic Knowledge Integration 110 2.3.3 Practice: LLM for Search and Recommendation Tasks 114 2.3.4 Practice: Contextual LLM Responses 115 2.4 Summary 119 References 119 3 Retrieval-Augmented Generation 123 3.1 RAG Overview 123 3.1.1 RAG Components 123 3.1.2 From Tokens to Passage Embeddings 124 3.1.3 RAG as a Retrieval-agnostic Architecture 125 3.2 Data Preparation and Indexing 126 3.2.1 Understanding Data Source Types 126 3.2.2 Data Preprocessing 129 3.2.3 Chunking Techniques 131 3.2.4 Indexing 136 3.3 Retrieval Approaches 139 3.3.1 The Distinctive Nature of RAG Retrieval 140 3.3.2 Core Retrieval Methods in RAG 140 3.3.3 Advanced Retrieval Patterns 145 3.3.4 Retrieval Performance Optimization 146 3.3.5 Reranking and Filtering 147 3.4 Generation 148 3.4.1 Generation Pipeline 149 3.4.2 Model Selection Framework 150 3.4.3 Parameter Tuning 150 3.4.4 Inference Speed and Optimization Techniques 151 3.5 Summary 153 References 153 4 Practice: RAG Implementation 157 4.1 Overview of LangChain and LlamaIndex 157 4.1.1 LangChain and LangGraph 157 4.1.2 LlamaIndex 158 4.1.3 Comparison Summary 159 4.2 Implementing RAG Pipelines with LlamaIndex 159 4.2.1 Offline Stages: Loading and Indexing 160 4.2.2 Online Stage: Querying 166 4.2.3 Key Takeaways 175 4.3 Example: Implementing RAG on the WANDS Dataset 175 4.3.1 Indexing Phase 175
Page
11
Contents ix 4.3.2 Query Phase 176 4.3.3 Key Takeaways 189 4.4 Implementing Agentic RAG 189 4.4.1 Offline Index Construction 190 4.4.2 Offline Agent Construction 191 4.4.3 Online Query Processing 192 4.4.4 Key Takeaways 195 4.5 Summary 195 References 196 Part II Graphs and Knowledge Graphs 197 5 Graphs and Graph Databases 199 5.1 Introduction to Graphs 199 5.1.1 Types of Graphs 200 5.1.2 Graph Representation 207 5.1.3 Graph Operations 210 5.1.4 Graph Algorithms 213 5.1.5 Applications of Graphs 216 5.2 Graph Databases: Comparison and Analysis 217 5.2.1 Notable Graph Databases 218 5.2.2 Comparison Summary 221 5.3 Introduction to Neo4j and Cypher 221 5.3.1 Cypher Basic Operations 222 5.3.2 Neo4j Utility Functions: APOC 224 5.3.3 Neo4j Graph Analytics: GDS 226 5.4 Practice: Flight Network Analysis and Optimization 228 5.4.1 Problem Setting 228 5.4.2 Understanding the Network Structure 229 5.4.3 Set Up Database and Load Data 229 5.4.4 Graph Algorithms in Flight Networks 232 5.5 Summary 244 References 245 6 Knowledge Graphs 247 6.1 Understanding KGs 247 6.1.1 Core Structure and Components 248 6.1.2 Example: Marvel Universe KG 249 6.1.3 Types of KGs 253 6.1.4 Ontology in KGs 256 6.2 Construction and Management of KGs 261 6.2.1 Schema Design 261 6.2.2 Data Sources and Extraction Techniques 265 6.3 KGs Analytics and Enrichment 268 6.3.1 Graph Algorithms in KGs 268 6.3.2 Graph Embeddings 279 6.3.3 Graph Neural Networks 282
Page
12
x Contents 6.4 LLMs and KGs 287 6.4.1 Comparisons and Unifications 288 6.4.2 Leveraging LLMs to Enrich KGs 288 6.4.3 Using KGs to Enhance LLMs: A Preview of Graph-RAG 292 6.5 Practice: Constructing KG from the WANDS Dataset 293 6.5.1 LlamaIndex Neo4j Integration 294 6.5.2 Extract Query-product Triples 294 6.5.3 Extract Product-class Triples 296 6.5.4 Extract Product-category Triples 298 6.5.5 Load Documents into Neo4j 300 6.5.6 Key Takeaways 300 6.6 Practice: Construct KG from Unstructured Data 301 6.6.1 Key Takeaways 302 6.7 Summary 303 References 304 Part III Integrate RAG with Graph 307 7 Graph-based Retrieval-augmented Generation 309 7.1 Introduction to Graph-RAG 309 7.1.1 The Graph-RAG Paradigm 309 7.1.2 Why Graph-RAG? 310 7.2 Architecture and Components of Graph-RAG 315 7.2.1 Graph-based Indexing 316 7.2.2 Graph-based Retrieval 318 7.2.3 Graph-based Generation 333 7.3 Applications 337 7.3.1 Downstream Tasks 337 7.3.2 Application Domains 338 7.4 Summary 340 References 341 8 Practice: Graph-RAG Implementations 345 8.1 Graph-RAG on WANDS Dataset with LlamaIndex 345 8.1.1 Querying with Neo4j and Chroma 345 8.1.2 Removing Chroma Dependency 351 8.1.3 Key Takeaways 352 8.2 Graph-RAG on Wiki and Kaggle Data with LangChain 352 8.2.1 Wikipedia Text Search and Question Answering 352 8.2.2 Answering Kaggle CSV Recommendation Questions 357 8.3 Summary 364 Reference 365 9 Graph-RAG Evaluations 367 9.1 Performance Metrics Framework 367 9.1.1 Retrieval-specific Metrics 367 9.1.2 Generation Quality Metrics 372
Page
13
Contents xi 9.1.3 Graph-specific Metrics 376 9.1.4 System Performance Metrics 380 9.2 Quality Assessment Methodologies 382 9.2.1 Human Evaluation Framework 383 9.2.2 Automated Evaluation Methods 386 9.2.3 Meta-evaluation 389 9.2.4 Best Practices for Quality Assessment 391 9.3 Benchmarking Frameworks 392 9.3.1 Established Benchmarks 392 9.3.2 Benchmark Design Principles 394 9.3.3 Comparative Analysis Framework 395 9.4 Tools and Platforms for Graph-RAG Evaluations 396 9.4.1 Tools and Platforms Overview 396 9.4.2 Integration Best Practices 399 9.4.3 Future Directions in Tooling 400 9.5 Practice: Evaluating RAG Pipelines Using Ragas 400 9.5.1 Preparing the Evaluation Dataset 400 9.5.2 Defining Evaluation Metrics 401 9.5.3 Executing the Evaluation Process 402 9.5.4 Key Takeaways 402 9.6 Summary 402 References 403 Part IV Advanced Implementations and Frontiers 405 10 Graph-RAG Frameworks for Enhanced Information Retrieval 407 10.1 Overview of Graph-RAG Frameworks for Search and Recommendations 407 10.1.1 RAPTOR: Recursive Abstractive Processing for Tree-organized Retrieval 408 10.1.2 G-Retriever: Joint Text-graph Embeddings 411 10.1.3 Microsoft GraphRAG: Global Sensemaking Through Community Summaries 414 10.1.4 HippoRAG: Neurobiologically-inspired Long-term Memory 417 10.2 Graph-RAG Tools and Software Overview 421 10.2.1 What Is Available in the Current Market for Graph-RAG? 421 10.2.2 When to Choose Which Framework? 423 10.3 Practice: Run Graph-RAG Frameworks 424 10.3.1 RAPTOR 424 10.3.2 G-Retriever 429 10.3.3 Microsoft GraphRAG 432 10.3.4 HippoRAG 444 10.4 Summary 453 References 454 11 Frontiers of Graph-RAG 455 11.1 Emerging Trends in Graph-RAG 455 11.1.1 Multimodal Knowledge Graphs 455 11.1.2 Temporal and Dynamic Graphs 462
Page
14
xii Contents 11.1.3 Advanced GNNs for RAG 468 11.2 Ethical Considerations and Bias Mitigation 478 11.2.1 The Dual Nature of Bias in Graph-RAG 478 11.2.2 Comprehensive Mitigation Strategies 479 11.2.3 Ethical AI Governance Framework 481 11.3 Future Research Directions 482 11.3.1 Explainable Graph-RAG: Making AI Reasoning Transparent 482 11.3.2 Automated Knowledge Graph Construction and Maintenance 483 11.3.3 RL for Intelligent Graph Traversal 485 11.3.4 Federated Learning for Privacy-preserving Graph-RAG 486 11.3.5 Transformative Industry Applications 488 11.4 Summary 490 11.5 Conclusion and Final Thoughts 491 References 492 A Set Up Experiment Servers 495 A.1 Two Models Hosted by vLLM 497 A.1.1 Chat Model Service 497 A.1.2 Embedding Model Service 498 A.2 LLM Gateway 499 A.3 UI for LLMModels 500 A.4 Vector Store 500 A.5 Graph Database 501 B Prepare Synthetic Recommendation Data from WANDS 503 B.1 Step 1: Download the WANDS Dataset 503 B.2 Step 2: Load the Dataset 503 B.3 Step 3: Prepare the Data for Recommendation Tasks 504 B.4 Step 4: Generate Synthetic Recommendation Data 504 B.4.1 Session-based Recommendation Data 507 B.4.2 User-query Synthetic Profiles 508 B.4.3 Next-item Prediction Sequences 508 B.5 Step 5: Dataset Statistics and Sample Entries 509 Index 511
Page
15
Foreword This book is a rare achievement in technical literature: it teaches not by presenting isolated con- cepts, but by guiding readers through a carefully orchestrated intellectual journey. From the open- ing pages, one senses it was written with exceptional discipline, foresight, and genuine care for how deep understanding develops. Each chapter serves dual purposes—functioning both as a rig- orous, comprehensive survey of its domain and as a foundation stone supporting the next stage of learning. Reading it feels like ascending a series of carefully designed terraces, where each level broadens your view, deepens your perspective, and prepares you for the challenges ahead. The book’s architecture reflects this pedagogical intent. Part I establishes our foundations in the long arc of information retrieval, tracing its evolution from keyword search through neural methods, then positioning large languagemodels and their inherent limitations before introducing retrieval-augmented generation (RAG). Part II pivots to graphs and knowledge graphs, revealing how structured representations provide the rigor, grounding, and explanatory power that pure lan- guage models lack. Part III synthesizes these approaches, demonstrating how RAG can be seam- lessly integrated with graph-based knowledge into coherent, production-ready systems. Finally, Part IV expands the horizon—surveying advanced frameworks including RAPTOR, G-Retriever, Microsoft GraphRAG, and HippoRAG, while thoughtfully examining the ethical considerations and research frontiers that will shape our field’s future. What strikes me most profoundly is the balance the authors achieve throughout. Each chapter delivers not merely exposition but also rich bibliographies and practical, working code examples. This approach transforms abstract concepts into tangible implementations, ensuring that theoret- ical insights are always grounded in executable reality. This pattern of theory-to-practice integra- tion continues seamlessly through the final chapters, with supplemental materials and appendices providing readers with the hands-on foundation needed to fully internalize the concepts they’ve absorbed. For those of us advancing distributed and agentic systems, this book transcends the role of a reference manual—it provides the core constructs of task orientation and knowledge integra- tion that will underpin the next generation of intelligent systems. Its methodology—progressively detailed, successively deeper, yet always maintaining coherence—mirrors the very architecture of the sophisticated systems it describes. I want to acknowledge the exceptional authors behind this work.Wendy RanWei recently joined my Relevance and Personalization team at Airbnb, bringing the same intellectual depth and clarity that illuminate every page of this book. I’m excited to see her apply this expertise to advance our work in relevance, personalization, agentic systems, and matching as we push Airbnb toward new
Page
16
xiv Foreword frontiers. Her co-author, HuijunWu, contributes complementary insights and technical depth that clearly strengthen the entire work. Together, they have created a resource that will serve as both a foundation and a catalyst for our rapidly evolving field. Sanjeev Katariya Head of Relevance and Personalization, Airbnb
Page
17
About the Authors Wendy Ran Wei Wendy Ran Wei is a Machine Learning Engineer at Airbnb, where she works on large-scale search, recommendation systems, and LLM-driven relevance and personalization. She specializes in building production-grade AI systems that bridge information retrieval, knowledge graphs, and retrieval-augmented generation. Wendy holds a Ph.D. in Statistics from The Ohio State University, with a minor in Computer Science, and a Bachelor’s degree in Mathematics and Statistics from Zhejiang University. Her academic training provides a strong foundation in statistical modeling, machine learning, and data-driven systems. She has extensive industry experience across leading technology companies, including Twitter, Pinterest, Meta, and Coupang, developing large-scale machine learning systems for social networks and e-commerce platforms. Her work spans recommendation systems, ads rel- evance, search retrieval, and user modeling, with a focus on delivering high-impact, real-world applications. Wendy is also a co-author of the book Data Science: Methods and Practice (China Machine Press, 2025). Her recent work focuses on integrating large language models with traditional retrieval sys- tems, advancing techniques in RAG, knowledge-enhanced AI, and generative applications. Huijun Wu Huijun Wu is an Engineer at Samsung Electronics America (SEA), where he builds large-scale data platforms, advanced AI model infrastructure, and LLM-driven solutions for Samsung Ads. He holds a PhD in Computer Science from Arizona State University (ASU) and graduated from Huazhong University of Science and Technology (HUST). Huijun’s career began in 2007 with the development of CacheDB, an in-memory real-time database kernel adopted by China Southern Power Grid, earning him two patents. In 2011, he pur- sued his PhD at ASU, focusing on mobile cloud computing; during this time, he co-authored the bookMobile Cloud Computing and developed POEM, a framework that won the Best Student Paper Award at IEEE MS 2015. After graduating in 2016, Huijun joined Twitter to work on Apache Heron, an open-source dis- tributed stream processing engine built for petabyte-scale real-time analytics, and co-authored the book Heron Streaming. His collaborative research on forecasting SQL query costs at Twitter also
Page
18
xvi About the Authors won the Best Industry Track Paper Award at IEEE IC2E 2021. He thenmoved to Samsung Research America (SRA) to design large-scale AI infrastructure and LLM-powered privacy guardrails. An experienced technical author, his expertise spans distributed systems, AI model infrastructure, enterprise LLM deployment, and generative AI applications.
Page
19
Preface Over the past few years, the world has witnessed a profound shift in how machines understand, process, and generate language. With the rise of large language models (LLMs), natural language processing (NLP) has evolved from task-specific pipelines into general-purpose engines capable of reasoning, dialog, and creative generation. Yet, even as these models impress with their linguistic fluency, they continue to struggle with grounding—relying solely on pretrained knowledge, which leads to hallucinations, stale information, and a lack of verifiability. Retrieval-augmented genera- tion (RAG) emerged as a critical solution to this problem, allowing models to dynamically retrieve external data to augment their responses. When combined with structured knowledge representa- tions like graphs and knowledge graphs, RAG systems become evenmore powerful, capable of con- textualized reasoning, accurate referencing, and rich semantic understanding. This fusion, which we call Graph-RAG, forms the central focus of this book. As artificial intelligence (AI) practitioners and researchers, we havewitnessed firsthand the limi- tations of traditional information retrieval systems and the challenges of maintaining factual accu- racy in AI-generated content. Through our combined experience at leading technology companies, we recognized the urgent need for a comprehensive resource that addresses these challenges. This book is the result of years of practical experience, research, and collaboration with the AI commu- nity. It represents not just a technical manual, but a roadmap for the future of intelligent informa- tion systems. We wrote it with the conviction that the integration of knowledge graphs with RAG will fundamentally transform how AI systems understand and interact with human knowledge. Why This Book Exists While the fusion of RAGwith knowledge graphs represents the new frontier of intelligent informa- tion systems, there is a lack of resources that detail the practical implementation of such systems. Most existing literature focuses on either RAG or knowledge graphs in isolation, leaving practition- ers and researchers without a clear roadmap for their integration. This book fills that gap, offering both theoretical insights and actionable techniques for creating systems that are not only smart but also explainable and robust.
Page
20
xviii Preface This book serves as a comprehensive guide for readers interested in building intelligent systems that merge retrieval, generation, and knowledge representation. By the end of this book, readers will: • Understand the core principles of RAG and knowledge graphs. • Learn practical techniques to integrate these technologies for search and recommendation tasks. • Explore real-world use cases where this integration can transform application performance and user experience. • Gain hands-on experience through step-by-step examples and case studies, enabling them to implement these concepts in their own domains. Who This Book Is For We designed this book to serve a diverse audience, including developers, researchers, data sci- entists, and AI enthusiasts who are interested in building advanced search and recommendation systems. • For Beginners: If you have a general understanding of data science and software engineering but are new to domain-specific concepts (such as NLP, LLM, and knowledge graphs), Parts I and II provide a gentle introduction. These sections are rich with definitions, examples, and illustrations that build your understanding from the ground up. You’ll find these chapters suitable as university course materials for introductory classes. • For AI and Machine Learning Practitioners: If you’re already familiar with information retrieval and LLMs but new to RAG, you can start directly with Chapter 3. This approach allows you to leverage your existing knowledge while quickly getting up to speed with RAG concepts. • For Advanced Readers: Those who have already mastered NLP, LLM, RAG, and Graph con- cepts can dive straight into Part III, where we explore the integration of RAGwith graph tech- nologies. This intermediate-level content bridges the gap between traditional approaches and cutting-edge graph-based solutions. • For Researchers and Graduate Students: Part IV is designed for those at the frontier of AI research. These chapters read like research seminar discussions, exploring state-of-the-art frameworks and future directions. This content is ideal for graduate-level courses and those looking to contribute to the field’s advancement. While the concepts and techniques are explained in a practical and accessible manner, a basic understanding of computer science principles, such as algorithms and data structures, will be helpful. Readers should also have a working knowledge of Python, as the book includes hands- on examples and implementations using Python-based libraries and frameworks. Familiarity with foundational AI and machine learning concepts is a plus but not mandatory, as relevant ideas are introduced and explained as needed throughout the book. How to Use This Book This book is designed to be accessible while covering advanced topics. To help you gauge your readiness and identify areas for review: