Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying RAG from First Principles
  • Table Of Contents Toc
RAG from First Principles

RAG from First Principles

By : Jia Huang
close
close
RAG from First Principles

RAG from First Principles

By: Jia Huang

Overview of this book

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
Table of Contents (14 chapters)
close
close
12
Other Books You May Enjoy
13
Index

Summary

At this point, Lewis believes that the most commonly used and important, as well as the most inspiring data import scenarios, have been covered. The tools Lewis selected are far from comprehensive, but are instead focused on solving specific scenarios and problems. As for more file types, tools, and scenarios, further exploration is up to everyone.

Other scenarios that may arise in project practice are as follows:

  • Importing code blocks (refer to the LangChain documentation on loading code, which is also covered in Section 2)
  • Cleaning redundant information from PDF documents, such as headers, footers, etc. (refer to the Unstructured documentation for file cleaning instructions)
  • Connecting various databases and cloud service data platforms (refer to the integration interface sections of LangChain and LlamaIndex).
  • Importing audio and video data (refer to related multimodal large models)

Alex: There’s still so much to learn!

Lewis: Of course. You have seen only a part of the bigger picture. We’ve only worked on a small part among the many file types, scenarios, and tools, and we’ve only explained a little. There is still much knowledge about data import and parsing for you all to discover.

Alex: What we’ve learned is just a drop in the ocean.

Anna: Everyone should learn to see the bigger picture from the small details.

Lewis: You have indeed understood what I wanted to say.

In the next chapter, we will see how to divide long texts into appropriately sized fragments to facilitate embedding, indexing, and storage, and to improve retrieval accuracy. You will learn to perform text chunking, also known as text splitting.

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
RAG from First Principles
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon