RAG from First Principles: Engineering retrieval-augmented generation systems with Python, LangChain, and LlamaIndex

RAG from First Principles: Engineering retrieval-augmented generation systems with Python, LangChain, and LlamaIndex book cover

RAG from First Principles: Engineering retrieval-augmented generation systems with Python, LangChain, and LlamaIndex

Author(s): Jia Huang (Author)

  • Publisher Finelybook 出版社: Packt Publishing
  • Publication Date 出版日期: May 29, 2026
  • Language 语言: English
  • Print length 页数: 492 pages
  • ISBN-10: 1835888666
  • ISBN-13: 9781835888667

Book Description

A rigorous, code-first guide to RAG engineering by a bestselling AI author. Master data ingestion, chunking, embeddings, vector storage, hybrid retrieval, reranking, and evaluation from the ground up.

Free with your book: DRM-free PDF version + access to Packt’s next-gen Reader*

Key Features

  • Engineer RAG systems layer by layer, from ingestion to evaluation
  • Master hybrid retrieval, reranking, and index optimization strategies
  • Learn through a dialogue-driven, code-first teaching style used by 10,000+ of students

Book Description

Most developers can spin up a RAG pipeline in an afternoon using LangChain or LlamaIndex. Far fewer understand why retrieval fails or how to fix it. This book is for those who want to go deeper.

RAG From First Principles dismantles the retrieval-augmented generation stack layer by layer, explaining how documents are ingested and parsed, why chunking strategy directly impacts answer quality, how embedding models encode meaning, what happens inside a vector database, and how sparse and dense retrieval interact in a hybrid system. Written by Jia Huang, a research engineer and bestselling AI author, it brings both research depth and production experience to one of AI’s most critical engineering disciplines.

Structured as a progressive dialogue between a seasoned engineer and two students, the book surfaces the questions practitioners actually ask. Each chapter builds on the last, covering topics from data import and chunking to embedding selection, index design, hybrid search, and post-retrieval processing, before moving on to response generation, evaluation, and advanced paradigms including GraphRAG, Agentic RAG, and Modular RAG.

By the end, you’ll have the architectural understanding to optimize, debug, and extend your RAG systems with confidence.

*Email sign-up and proof of purchase required

What you will learn

  • Parse and ingest diverse document types like PDFs, tables, images, web pages, and structured data
  • Apply the right chunking strategy for your content type and retrieval goals
  • Select, compare, and fine-tune embedding models for your domain
  • Design vector indexes and choose the right similarity metrics for production use
  • Improve result quality with reranking methods including RRF, cross-encoders, and ColBERT
  • Integrate retrieval results into generation pipelines using prompt engineering and Self-RAG

Who this book is for

This book is for AI engineers, ML practitioners, and software developers building LLM-powered applications who want a deeper understanding of how retrieval actually works, not just how to call a framework. It is ideal for readers who have built a basic RAG pipeline and now want architectural clarity, optimization strategies.

Technical leads and architects designing production AI systems will find its systematic treatment of indexing, hybrid search, reranking, and evaluation particularly valuable. Familiarity with Python and foundational LLM concepts is assumed.

Table of Contents

  1. Data Import
  2. Text Chunking
  3. Information Embedding
  4. Vector Storage
  5. Pre-Retrieval Processing
  6. Index Optimization
  7. Retrieval Post-Processing
  8. Response Generation
  9. System Evaluation
  10. Complex RAG Paradigms

Editorial Reviews

Editorial Reviews

About the Author

Jia Huang is a Lead Research Engineer at A*STAR (Agency for Science, Technology and Research), Singapore, where his work focuses on NLP, large language models, and applied AI engineering. With over twenty years of experience leading large-scale AI and data projects across government, finance, healthcare, and e-commerce, he brings an unusually practical lens to technically rigorous subjects. In recent years, his research has primarily focused on NLP pre-trained large models and FinTech applications. He is the author of six bestselling technical books, including Hands-on AI Agent Development for Large Model Applications selected as one of JD Best Books of 2024 and GPT: How Large Models Are Built, named CSDN’s Most Influential IT Book of 2023. His online RAG engineering course has been completed by over 10,000 students.

View on Amazon

下载地址

PDF, EPUB | 53 MB | 2026-06-13

打赏
未经允许不得转载:finelybook » RAG from First Principles: Engineering retrieval-augmented generation systems with Python, LangChain, and LlamaIndex

评论 抢沙发

觉得文章有用就打赏一下文章作者

您的打赏,我们将继续给力更多优质内容

支付宝扫一扫

微信扫一扫