Skip to content

Repository files navigation

Advanced Retrieval-Augmented Generation: Bridging Large Language Models and Knowledge Graphs

Book Cover
πŸ“š Get the Book on Amazon
Book Outline
Book Structure

Code companion repository for the book Advanced Retrieval-Augmented Generation: Bridging Large Language Models and Knowledge Graphs by Wendy Ran Wei and Huijun Wu (Wiley-IEEE Press).

Large language models are powerful β€” but they hallucinate. This book offers a complete guide from the foundations of information retrieval (IR) to the cutting-edge frontiers of Retrieval-Augmented Generation (RAG). Bridging LLMs and knowledge graphs (KGs), it provides the theoretical principles, practical techniques, and hands-on frameworks needed to build reliable AI systems that minimize hallucinations and improve factual correctness β€” with core Graph-RAG concepts and applications across search, recommendation, and enterprise AI, using implementations in LlamaIndex, Neo4j, and leading Graph-RAG frameworks.

This repository contains the code examples accompanying the book. Each chapter's code is organized into its own directory, with Jupyter notebooks and Python scripts illustrating the concepts, techniques, and end-to-end systems discussed in the text.

πŸ“– Get the Book

Format Link
πŸ›’ Amazon amazon.com/dp/1394374682
πŸ“˜ Wiley (Hardcover) wiley.com β€” 9781394374687
πŸ’» Wiley (E-book) wiley.com β€” 9781394374694

πŸ—‚οΈ Repository Structure

Each chapter_XX directory corresponds to a chapter in the book and contains Jupyter notebooks (.ipynb) and Python scripts (.py) that illustrate the key concepts and techniques from that chapter. appendix_a and appendix_b contain supporting code referenced in the book's appendices.

To run the code examples, navigate to the relevant chapter directory and follow the setup instructions in its own README.md, which lists chapter-specific requirements and a summary of contents.

πŸš€ Getting Started

git clone https://github.com/GraphRAGBook/book_code.git
cd book_code

Each chapter directory includes its own dependencies and setup notes. We recommend using a fresh virtual environment (venv or conda) per chapter to avoid dependency conflicts between frameworks (e.g., LlamaIndex, LangChain, Neo4j drivers).

python -m venv venv
source venv/bin/activate  # on Windows: venv\Scripts\activate
pip install -r chapter_XX/requirements.txt

🀝 Contributing

Found an issue, a bug, or an opportunity to improve an example? Contributions are welcome β€” please open an issue or submit a pull request.

πŸ“ Citing This Book

If this book or repository is useful in your research or work, please consider citing:

@book{wei2026advancedrag,
  title     = {Advanced Retrieval-Augmented Generation: Bridging Large Language Models and Knowledge Graphs},
  author    = {Wei, Wendy Ran and Wu, Huijun},
  publisher = {Wiley-IEEE Press},
  isbn      = {9781394374687},
  year      = {2026}
}

πŸ‘©β€πŸ’» About the Authors

Wendy Ran Wei, PhD, is a Machine Learning Engineer at Airbnb specializing in search, recommendation, and relevance/personalization systems. She previously held engineering roles at Meta, Pinterest, and Twitter, building large-scale search and recommendation solutions. She holds a PhD in Statistics from The Ohio State University. More at wendywei.ai.

Huijun Wu, PhD, is an Engineer at Samsung Research America with expertise spanning knowledge graphs, information retrieval, and applied machine learning. He holds a PhD in Computer Science from Arizona State University.

About

Book code of the "Advanced RAG: Bridging LLM and KG"

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages